From e03b82dd89295305e655bea301b321b7f8e15844 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 2 Jun 2023 14:30:53 +0200 Subject: 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. --- src/im-asapo.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src/im-asapo.c') 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); -- cgit v1.2.3