X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Ftrace-chunk-registry.h;h=5442d7997893eb744121d7661706d677fcbae127;hb=67ce756361aa64f41deac3705e0dd861f7e89a02;hp=f61e560808486c37b1640d3ed04bce0a6cf48555;hpb=ac497a37018f3c253d2e50397294f58d33f7f24f;p=lttng-tools.git diff --git a/src/common/trace-chunk-registry.h b/src/common/trace-chunk-registry.h index f61e56080..5442d7997 100644 --- a/src/common/trace-chunk-registry.h +++ b/src/common/trace-chunk-registry.h @@ -14,10 +14,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - struct lttng_trace_chunk_registry; /* @@ -61,6 +57,29 @@ void lttng_trace_chunk_registry_destroy( struct lttng_trace_chunk *lttng_trace_chunk_registry_publish_chunk( struct lttng_trace_chunk_registry *registry, uint64_t session_id, struct lttng_trace_chunk *chunk); +/* + * Adds the `previously_published` parameter which allows the caller + * to know if a trace chunk equivalent to `chunk` was previously published. + * + * The registry holds a reference to the published trace chunks it contains. + * Trace chunks automatically unpublish themselves from their registry on + * destruction. + * + * This information is necessary to drop the reference of newly published + * chunks when a user doesn't wish to explicitly maintain all references + * to a given trace chunk. + * + * For instance, the relay daemon doesn't need the registry to hold a + * reference since it controls the lifetime of its trace chunks. + * Conversely, the consumer daemons rely on the session daemon to inform + * them of the end of life of a trace chunk and the trace chunks don't + * belong to a specific top-level object: they are always retrieved from + * the registry by `id`. + */ +struct lttng_trace_chunk *lttng_trace_chunk_registry_publish_chunk( + struct lttng_trace_chunk_registry *registry, + uint64_t session_id, struct lttng_trace_chunk *chunk, + bool *previously_published); /* * Look-up a trace chunk by session_id and chunk_id. @@ -96,8 +115,4 @@ lttng_trace_chunk_registry_find_anonymous_chunk( unsigned int lttng_trace_chunk_registry_put_each_chunk( const struct lttng_trace_chunk_registry *registry); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_TRACE_CHUNK_REGISTRY_H */