aboutsummaryrefslogtreecommitdiff
path: root/src/im-asapo.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2023-06-02 14:30:53 +0200
committerThomas White <taw@physics.org>2023-06-02 14:30:53 +0200
commite03b82dd89295305e655bea301b321b7f8e15844 (patch)
tree0951f7c239c47a5d696bb36f193d3bf063599b06 /src/im-asapo.c
parent1d1a2a700d229852d9ba2e34b382a2f7b3c147f3 (diff)
ASAP::O: Use input stream name as output (add _hits to data source)
This means we don't need a stream name any more, so --asapo-output-stream became a simple flag parameter.
Diffstat (limited to 'src/im-asapo.c')
-rw-r--r--src/im-asapo.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/im-asapo.c b/src/im-asapo.c
index 4ae4d291..6bc43b11 100644
--- a/src/im-asapo.c
+++ b/src/im-asapo.c
@@ -54,7 +54,6 @@ struct im_asapo
AsapoProducerHandle producer;
AsapoStringHandle group_id;
int wait_for_stream;
- char *output_stream;
};
@@ -79,8 +78,7 @@ static int create_producer(struct im_asapo *a, struct im_asapo_params *params)
AsapoSourceCredentialsHandle cred;
AsapoErrorHandle err = asapo_new_handle();
- if ( params->output_stream == NULL ) {
- a->output_stream = NULL;
+ if ( !params->write_output_stream ) {
a->producer = NULL;
return 0;
}
@@ -98,6 +96,7 @@ static int create_producer(struct im_asapo *a, struct im_asapo_params *params)
"", /* beamline */
source,
params->token);
+ STATUS("Writing hits-only output stream as data source '%s'\n", source);
free(source);
a->producer = asapo_create_producer(params->endpoint,
@@ -115,7 +114,6 @@ static int create_producer(struct im_asapo *a, struct im_asapo_params *params)
}
asapo_free_handle(&err);
- a->output_stream = strdup(params->output_stream);
return 0;
}
@@ -146,12 +144,6 @@ struct im_asapo *im_asapo_connect(struct im_asapo_params *params)
ERROR("ASAP::O stream not specified.\n");
return NULL;
}
- if ( (params->output_stream != NULL)
- && (strcmp(params->stream, params->output_stream) == 0) )
- {
- ERROR("ASAP::O input and output streams cannot be the same.\n");
- return NULL;
- }
a = malloc(sizeof(struct im_asapo));
if ( a == NULL ) return NULL;
@@ -301,7 +293,7 @@ static void send_real(struct im_asapo *a, struct image *image)
0); /* Auto ID */
asapo_producer_send(a->producer, header, image->data_block,
- kDefaultIngestMode, a->output_stream,
+ kDefaultIngestMode, a->stream,
send_callback, &err);
if ( asapo_is_error(err) ) {
show_asapo_error("Couldn't ASAP::O message", err);
@@ -329,7 +321,7 @@ static void send_placeholder(struct im_asapo *a, struct image *image)
0); /* Auto ID */
asapo_producer_send(a->producer, header, "SKIPPED",
- kDefaultIngestMode, a->output_stream,
+ kDefaultIngestMode, a->stream,
send_callback, &err);
if ( asapo_is_error(err) ) {
show_asapo_error("Couldn't ASAP::O message", err);