Skip to content

Commit

Permalink
Encode the writer's autodispose setting in response beads
Browse files Browse the repository at this point in the history
Signed-off-by: TheFixer <[email protected]>
  • Loading branch information
TheFixer committed Dec 30, 2023
1 parent f5a490e commit 72257c2
Show file tree
Hide file tree
Showing 3 changed files with 214 additions and 179 deletions.
6 changes: 6 additions & 0 deletions src/durability/include/dds/durability/durablesupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ typedef struct DurableSupport_set_t
dds_sequence_DurableSupport_id_t addressees;
} DurableSupport_set_t;

typedef struct DurableSupport_writer_properties_t
{
bool autodispose;
} DurableSupport_writer_properties_t;

#ifndef DDS_SEQUENCE_DURABLESUPPORT_RANGE_DEFINED
#define DDS_SEQUENCE_DURABLESUPPORT_RANGE_DEFINED
typedef struct dds_sequence_DurableSupport_range
Expand All @@ -197,6 +202,7 @@ typedef struct dds_sequence_DurableSupport_range
typedef struct DurableSupport_writer_t
{
DurableSupport_id_t id;
struct DurableSupport_writer_properties_t properties;
uint32_t flags;
dds_sequence_DurableSupport_range ranges;
} DurableSupport_writer_t;
Expand Down
15 changes: 8 additions & 7 deletions src/durability/src/dds_durability.c
Original file line number Diff line number Diff line change
Expand Up @@ -1473,11 +1473,12 @@ static enum ddsi_serdata_kind get_serdata_kind (uint8_t kind)
/* These are the offsets used in the data responses.
* TODO: These definitions should actually be shared between the ds and the client.
*/
#define RESPONSE_HEADER_OFFSET_WT 8
#define RESPONSE_HEADER_OFFSET_SEQNUM 16
#define RESPONSE_HEADER_OFFSET_WRITER_GUID 24
#define RESPONSE_HEADER_OFFSET_SERDATA_KIND 40
#define RESPONSE_HEADER_OFFSET_SERDATA 41
#define RESPONSE_HEADER_OFFSET_WT 8
#define RESPONSE_HEADER_OFFSET_SEQNUM 16
#define RESPONSE_HEADER_OFFSET_WRITER_GUID 24
#define RESPONSE_HEADER_OFFSET_SERDATA_KIND 40
#define RESPONSE_HEADER_OFFSET_SERDATA_AUTODISPOSE 41
#define RESPONSE_HEADER_OFFSET_SERDATA 42


static void dc_process_data_response (struct dc_t *dc, DurableSupport_response *response)
Expand All @@ -1494,7 +1495,7 @@ static void dc_process_data_response (struct dc_t *dc, DurableSupport_response *
enum ddsi_serdata_kind serdata_kind;
dds_guid_t wguid;
dds_return_t ret = DDS_RETCODE_OK;
bool autodispose;
bool autodispose = 0;
struct proxy_set_reader_t *proxy_set_rd;
char id_str[37];

Expand Down Expand Up @@ -1523,6 +1524,7 @@ static void dc_process_data_response (struct dc_t *dc, DurableSupport_response *
wt = ddsrt_fromBE8(*((int64_t *)(response->body._u.data.blob._buffer + RESPONSE_HEADER_OFFSET_WT)));
seqnum = ddsrt_fromBE8u(*((uint64_t *)(response->body._u.data.blob._buffer + RESPONSE_HEADER_OFFSET_SEQNUM)));
memcpy(&wguid.v, response->body._u.data.blob._buffer + RESPONSE_HEADER_OFFSET_WRITER_GUID, 16);
autodispose = *((uint8_t *)response->body._u.data.blob._buffer + RESPONSE_HEADER_OFFSET_SERDATA_AUTODISPOSE);
serdata_kind = get_serdata_kind(*((uint8_t *)response->body._u.data.blob._buffer + RESPONSE_HEADER_OFFSET_SERDATA_KIND));
/* We could now potentially figure out if the response that has been received
* contains fields that we cannot interpret. We can find that out by comparing
Expand Down Expand Up @@ -1556,7 +1558,6 @@ static void dc_process_data_response (struct dc_t *dc, DurableSupport_response *
serdata->sequence_number = seqnum;
serdata->timestamp.v = wt;
memcpy(&serdata->writer_guid, &wguid, 16);
autodispose = false; /* TODO: we have to retrieve the autodispose setting of the writer! */
if ((ret = dds_reader_store_historical_serdata(reader, wguid, autodispose, serdata)) != DDS_RETCODE_OK) {
DDS_ERROR("Failed to deliver historical data to reader \"%s\" [%s]\n", dc_stringify_id(proxy_set_rd->key.guid.v, id_str), dds_strretcode(ret));
goto err_store_historical_serdata;
Expand Down
Loading

0 comments on commit 72257c2

Please sign in to comment.