From: Jérémie Galarneau Date: Wed, 2 Oct 2019 18:42:26 +0000 (-0400) Subject: Docs: document the session destruction handle API X-Git-Tag: v2.12.0-rc1~347 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=f16ab844d8b68af6e751a7507e890d8778d222a6;hp=cec6b2a556f6880230c326b07facbc3f673ee0c7;ds=sidebyside Docs: document the session destruction handle API Add function headers to the session destruction API declared in destruction-handle.h. Signed-off-by: Jérémie Galarneau --- diff --git a/include/lttng/destruction-handle.h b/include/lttng/destruction-handle.h index 1f00416cf..d21954136 100644 --- a/include/lttng/destruction-handle.h +++ b/include/lttng/destruction-handle.h @@ -25,33 +25,122 @@ extern "C" { #endif +/* + * Handle used to represent a specific instance of session destruction + * operation. + * + * See lttng_destroy_session_ext() in lttng/session.h. + */ struct lttng_destruction_handle; +/* + * Negative values indicate errors. Values >= 0 indicate success. + */ enum lttng_destruction_handle_status { + /* Generic error. */ LTTNG_DESTRUCTION_HANDLE_STATUS_ERROR = -2, + /* Invalid parameters provided */ LTTNG_DESTRUCTION_HANDLE_STATUS_INVALID = -1, + /* Success. */ LTTNG_DESTRUCTION_HANDLE_STATUS_OK = 0, + /* Destruction operation completed successfully. */ LTTNG_DESTRUCTION_HANDLE_STATUS_COMPLETED = 1, + /* Operation timed out. */ LTTNG_DESTRUCTION_HANDLE_STATUS_TIMEOUT = 2, }; +/* + * Destroy an lttng_destruction_session handle. + * The handle should be discarded after this call. + */ extern void lttng_destruction_handle_destroy( struct lttng_destruction_handle *handle); +/* + * Wait for the destruction of a session to complete. + * + * A negative timeout_ms value can be used to wait indefinitely. + * + * Returns LTTNG_DESTRUCTION_HANDLE_STATUS_COMPLETED if the session destruction + * operation was completed. LTTNG_DESTRUCTION_HANDLE_STATUS_TIMEOUT is returned + * to indicate that the wait timed out. + * On error, one of the negative lttng_destruction_handle_status is returned. + * + * Note: This function returning a success status does not mean that + * the destruction operation itself succeeded; it indicates that the _wait_ + * operation completed successfully. + */ extern enum lttng_destruction_handle_status lttng_destruction_handle_wait_for_completion( struct lttng_destruction_handle *handle, int timeout_ms); +/* + * Get the result of a session destruction operation. + * + * This function must be used on a session destruction handle which was + * successfully waited on. + * + * Returns LTTNG_DESTRUCTION_HANDLE_STATUS_OK if the result of the session + * destruction operation could be obtained. Check the value of 'result' to + * determine if the destruction of the session completed successfully or not. + * + * On error, one of the negative lttng_destruction_handle_status is returned. + * Returns LTTNG_DESTRUCTION_HANDLE_STATUS_INVALID if the session destruction + * was not waited-on using the handle or if the arguments of the function are + * invalid (e.g. NULL). + */ extern enum lttng_destruction_handle_status lttng_destruction_handle_get_result( const struct lttng_destruction_handle *handle, enum lttng_error_code *result); +/* + * Get the status of the session rotation performed as part of the session's + * destruction. + * + * A session will perform a final rotation if it was ever rotated over its + * lifetime. If this happens, this function returns the state of the rotation + * that was performed. + * + * This function must be used on a session destruction handle which was + * successfully waited on. + * + * Returns LTTNG_DESTRUCTION_HANDLE_STATUS_OK if the state of the session + * rotation could be obtained. Check the value of 'rotation_state' to + * determine if the rotation of the session completed successfully or not. + * + * On error, one of the negative lttng_destruction_handle_status is returned. + * Returns LTTNG_DESTRUCTION_HANDLE_STATUS_INVALID if the session destruction + * was not waited-on using the handle or if the arguments of the function are + * invalid (e.g. NULL). + * + * Note that if no rotation was performed, rotation_state will be set to + * LTTNG_ROTATION_STATE_NO_ROTATION. + */ extern enum lttng_destruction_handle_status lttng_destruction_handle_get_rotation_state( const struct lttng_destruction_handle *handle, enum lttng_rotation_state *rotation_state); +/* + * Get the location of the archive resulting from the rotation performed during + * the session's destruction. + * + * This function must be used on a session destruction handle which was + * successfully waited on and a session rotation must have been be completed + * successfully in order for this call to succeed. + * + * The location returned remains owned by the session destruction handle. + * + * Returns LTTNG_DESTRUCTION_HANDLE_STATUS_OK if the location of the archive + * resulting from the session rotation could be obtained. + * + * On error, one of the negative lttng_destruction_handle_status is returned. + * Returns LTTNG_DESTRUCTION_HANDLE_STATUS_INVALID if the session destruction + * was not waited-on using the handle, if no session rotation occurred as part + * of the session's destruction, or if the arguments of the function are + * invalid (e.g. NULL). + */ extern enum lttng_destruction_handle_status lttng_destruction_handle_get_archive_location( const struct lttng_destruction_handle *handle,