aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/im-asapo.c20
-rw-r--r--src/im-asapo.h32
-rw-r--r--src/im-sandbox.c20
3 files changed, 19 insertions, 53 deletions
diff --git a/src/im-asapo.c b/src/im-asapo.c
index 362a73b0..ea6505a4 100644
--- a/src/im-asapo.c
+++ b/src/im-asapo.c
@@ -60,16 +60,10 @@ static void show_asapo_error(const char *msg, const AsapoErrorHandle err)
}
-AsapoStringHandle im_asapo_group_id_from_string(const char *str)
-{
- return asapo_string_from_c_str(str);
-}
-
-
-AsapoStringHandle im_asapo_make_unique_group_id(const char *endpoint,
- const char *token,
- const char *beamtime,
- const char *path)
+char *im_asapo_make_unique_group_id(const char *endpoint,
+ const char *token,
+ const char *beamtime,
+ const char *path)
{
AsapoConsumerHandle consumer;
AsapoSourceCredentialsHandle cred;
@@ -94,7 +88,7 @@ AsapoStringHandle im_asapo_make_unique_group_id(const char *endpoint,
return NULL;
}
- return group_id;
+ return strdup(asapo_string_c_str(group_id));
}
@@ -102,7 +96,7 @@ struct im_asapo *im_asapo_connect(const char *endpoint,
const char *token,
const char *beamtime,
const char *path,
- AsapoStringHandle group_id)
+ const char *group_id)
{
struct im_asapo *a;
AsapoSourceCredentialsHandle cred;
@@ -122,7 +116,7 @@ struct im_asapo *im_asapo_connect(const char *endpoint,
asapo_consumer_set_timeout(a->consumer, 1000);
- a->group_id = group_id;
+ a->group_id = asapo_string_from_c_str(group_id);
return a;
}
diff --git a/src/im-asapo.h b/src/im-asapo.h
index 3ffc5808..b0c413f5 100644
--- a/src/im-asapo.h
+++ b/src/im-asapo.h
@@ -36,34 +36,28 @@
#if defined(HAVE_ASAPO)
-#include <asapo/consumer_c.h>
-
extern struct im_asapo *im_asapo_connect(const char *endpoint,
const char *token,
const char *beamtime,
const char *path,
- AsapoStringHandle group_id);
+ const char *group_id);
extern void im_asapo_shutdown(struct im_asapo *a);
extern void *im_asapo_fetch(struct im_asapo *a, size_t *pdata_size);
-extern AsapoStringHandle im_asapo_group_id_from_string(const char *str);
-
-extern AsapoStringHandle im_asapo_make_unique_group_id(const char *endpoint,
- const char *token,
- const char *beamtime,
- const char *path);
+extern char *im_asapo_make_unique_group_id(const char *endpoint,
+ const char *token,
+ const char *beamtime,
+ const char *path);
#else /* defined(HAVE_ASAPO) */
-typedef void* AsapoStringHandle;
-
static UNUSED struct im_asapo *im_asapo_connect(const char *endpoint,
const char *token,
const char *beamtime,
const char *path,
- AsapoStringHandle group_id)
+ const char *group_id)
{
return NULL;
}
@@ -78,16 +72,10 @@ static UNUSED void *im_asapo_fetch(struct im_asapo *a, size_t *psize)
return NULL;
}
-static UNUSED AsapoStringHandle im_asapo_group_id_from_string(const char *str)
-{
- return NULL;
-}
-
-static UNUSED AsapoStringHandle im_asapo_make_unique_group_id(const char *endpoint,
- const char *token,
- const char *beamtime,
- const char *path
- AsapoStringHandle group_id)
+static char *im_asapo_make_unique_group_id(const char *endpoint,
+ const char *token,
+ const char *beamtime,
+ const char *path)
{
return NULL;
}
diff --git a/src/im-sandbox.c b/src/im-sandbox.c
index 554024b2..759c5442 100644
--- a/src/im-sandbox.c
+++ b/src/im-sandbox.c
@@ -62,10 +62,7 @@
#include "process_image.h"
#include "im-zmq.h"
#include "profile.h"
-
-#ifdef HAVE_ASAPO
#include "im-asapo.h"
-#endif
struct sandbox
@@ -114,9 +111,7 @@ struct sandbox
const char *asapo_token;
const char *asapo_beamtime;
const char *asapo_path;
-#ifdef HAVE_ASAPO
- AsapoStringHandle asapo_group_id;
-#endif
+ const char *asapo_group_id;
/* Final output */
Stream *stream;
@@ -344,10 +339,7 @@ static int run_work(const struct index_args *iargs, Stream *st,
{
int allDone = 0;
struct im_zmq *zmqstuff = NULL;
-
-#ifdef HAVE_ASAPO
struct im_asapo *asapostuff = NULL;
-#endif
if ( sb->profile ) {
profile_init();
@@ -365,7 +357,6 @@ static int run_work(const struct index_args *iargs, Stream *st,
}
}
-#ifdef HAVE_ASAPO
if ( sb->asapo ) {
asapostuff = im_asapo_connect(sb->asapo_endpoint,
sb->asapo_token,
@@ -377,7 +368,6 @@ static int run_work(const struct index_args *iargs, Stream *st,
return 1;
}
}
-#endif
while ( !allDone ) {
@@ -482,12 +472,10 @@ static int run_work(const struct index_args *iargs, Stream *st,
} else if ( sb->asapo ) {
-#ifdef HAVE_ASAPO
/* Temporary (?) abuse of "zmq_data", even though
* data comes via ASAP::O */
pargs.zmq_data = im_asapo_fetch(asapostuff,
&pargs.zmq_data_size);
-#endif
} else {
pargs.zmq_data = NULL;
@@ -511,9 +499,7 @@ static int run_work(const struct index_args *iargs, Stream *st,
/* These are both no-ops if argument is NULL */
im_zmq_shutdown(zmqstuff);
-#ifdef HAVE_ASAPO
im_asapo_shutdown(asapostuff);
-#endif
cleanup_indexing(iargs->ipriv);
cell_free(iargs->cell);
@@ -1160,16 +1146,14 @@ int create_sandbox(struct index_args *iargs, int n_proc, char *prefix,
return 0;
}
-#ifdef HAVE_ASAPO
if ( asapo_group_id != NULL ) {
- sb->asapo_group_id = im_asapo_group_id_from_string(asapo_group_id);
+ sb->asapo_group_id = strdup(asapo_group_id);
} else {
sb->asapo_group_id = im_asapo_make_unique_group_id(asapo_endpoint,
asapo_token,
asapo_beamtime,
asapo_path);
}
-#endif
sb->fds = NULL;
sb->fhs = NULL;