Kaa client C SDK
|
External log storage interface used by Kaa data collection subsystem to temporarily store the logs before sending them to Operations server. More...
Go to the source code of this file.
Data Structures | |
struct | kaa_log_record_t |
Wrapper for a serialized log entry. More... | |
Functions | |
kaa_error_t | ext_log_storage_allocate_log_record_buffer (void *context, kaa_log_record_t *record) |
Allocates the data buffer to serialize a log entry into. More... | |
kaa_error_t | ext_log_storage_deallocate_log_record_buffer (void *context, kaa_log_record_t *record) |
Deallocates the data buffer of a log record. More... | |
kaa_error_t | ext_log_storage_add_log_record (void *context, kaa_log_record_t *record) |
Adds a log entry to the log storage. More... | |
kaa_error_t | ext_log_storage_write_next_record (void *context, char *buffer, size_t buffer_len, uint16_t *bucket_id, size_t *record_len) |
Writes the next unmarked log entry into the supplied buffer and marks it with bucket_id the record size does not exceed the buffer_len . More... | |
kaa_error_t | ext_log_storage_remove_by_bucket_id (void *context, uint16_t bucket_id) |
Removes from the storage all records marked with the provided bucket_id . More... | |
kaa_error_t | ext_log_storage_unmark_by_bucket_id (void *context, uint16_t bucket_id) |
Unmarks all records marked with the provided bucket_id . More... | |
size_t | ext_log_storage_get_total_size (const void *context) |
Returns total size occupied by logs in the log storage. More... | |
size_t | ext_log_storage_get_records_count (const void *context) |
Returns total log records count. More... | |
kaa_error_t | ext_log_storage_destroy (void *context) |
Destroys the log storage (which may decide to self-destroy). More... | |
External log storage interface used by Kaa data collection subsystem to temporarily store the logs before sending them to Operations server.
Must be implemented in a concrete application for the data collection feature to function.
kaa_error_t ext_log_storage_add_log_record | ( | void * | context, |
kaa_log_record_t * | record | ||
) |
Adds a log entry to the log storage.
In case of success assumes ownership of the record
data
buffer. (No need to call ext_log_storage_deallocate_log_record_buffer.)
[in] | context | Log storage context. |
[in] | record | Log record to add to log storage. |
kaa_error_t ext_log_storage_allocate_log_record_buffer | ( | void * | context, |
kaa_log_record_t * | record | ||
) |
Allocates the data buffer to serialize a log entry into.
Allocates the data
buffer of size
bytes in the record
.
[in] | context | Log storage context. |
[in,out] | record | Log record to allocate buffer to. |
kaa_error_t ext_log_storage_deallocate_log_record_buffer | ( | void * | context, |
kaa_log_record_t * | record | ||
) |
Deallocates the data buffer of a log record.
Deallocates the data
buffer in the record
and sets size
to 0.
[in] | context | Log storage context. |
[in,out] | record | Log record to deallocate buffer of. |
kaa_error_t ext_log_storage_destroy | ( | void * | context | ) |
Destroys the log storage (which may decide to self-destroy).
[in] | context | Log storage context. |
size_t ext_log_storage_get_records_count | ( | const void * | context | ) |
Returns total log records count.
[in] | context | Log storage context. |
size_t ext_log_storage_get_total_size | ( | const void * | context | ) |
Returns total size occupied by logs in the log storage.
[in] | context | Log storage context. |
kaa_error_t ext_log_storage_remove_by_bucket_id | ( | void * | context, |
uint16_t | bucket_id | ||
) |
Removes from the storage all records marked with the provided bucket_id
.
[in] | context | Log storage context. |
[in] | bucket_id | Non-zero bucket ID to search for records to be removed. |
kaa_error_t ext_log_storage_unmark_by_bucket_id | ( | void * | context, |
uint16_t | bucket_id | ||
) |
Unmarks all records marked with the provided bucket_id
.
[in] | context | Log storage context. |
[in] | bucket_id | Non-zero bucket ID to search for records to be unmarked. |
kaa_error_t ext_log_storage_write_next_record | ( | void * | context, |
char * | buffer, | ||
size_t | buffer_len, | ||
uint16_t * | bucket_id, | ||
size_t * | record_len | ||
) |
Writes the next unmarked log entry into the supplied buffer and marks it with bucket_id
the record size does not exceed the buffer_len
.
[in] | context | Log storage context. |
[in] | buffer | Buffer to write next unmarked record into. |
[in] | buffer_len | Buffer length in bytes. |
[out] | bucket_id | Optional bucket ID of the next record. |
[out] | record_len | Size of the record data. |
KAA_ERR_NONE | a record of record_len was successfully written into the buffer. |
KAA_ERR_NOT_FOUND | there were no unmarked records in the storage. record_len is set to 0 in this case. |
KAA_ERR_INSUFFICIENT_BUFFER | the buffer size was not sufficient to fit in the next unmarked entry. record_len is set to the size of the record that was not written. |