client-c  0.6.3
ext_log_storage.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014 CyberVision, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
24 #ifndef EXT_LOG_STORAGE_H_
25 #define EXT_LOG_STORAGE_H_
26 
27 #include "../kaa_error.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 
34 
38 typedef struct {
39  char *data;
40  size_t size;
42 
43 
44 
56 
57 
58 
71 
72 
73 
85 
86 
87 
105 kaa_error_t ext_log_storage_write_next_record(void *context, char *buffer, size_t buffer_len
106  , uint16_t bucket_id, size_t *record_len);
107 
108 
109 
118 kaa_error_t ext_log_storage_remove_by_bucket_id(void *context, uint16_t bucket_id);
119 
120 
121 
130 kaa_error_t ext_log_storage_unmark_by_bucket_id(void *context, uint16_t bucket_id);
131 
132 
133 
142 kaa_error_t ext_log_storage_shrink_by_size(void *context, size_t size);
143 
144 
145 
153 size_t ext_log_storage_get_total_size(const void *context);
154 
155 
156 
164 size_t ext_log_storage_get_records_count(const void *context);
165 
166 
167 
175 kaa_error_t ext_log_storage_release(void *context);
176 
177 #ifdef __cplusplus
178 } /* extern "C" */
179 #endif
180 
181 #endif /* EXT_LOG_STORAGE_H_ */
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.
kaa_error_t ext_log_storage_add_log_record(void *context, kaa_log_record_t *record)
Adds a log entry to the log storage.
kaa_error_t
Definition: kaa_error.h:31
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 if the record...
size_t ext_log_storage_get_total_size(const void *context)
Returns total size occupied by logs in the log storage.
kaa_error_t ext_log_storage_release(void *context)
Releases the log storage (which may decide to self-destroy).
kaa_error_t ext_log_storage_shrink_by_size(void *context, size_t size)
Shrinks log storage by the specified size by removing records starting from the oldest ones...
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.
size_t ext_log_storage_get_records_count(const void *context)
Returns total log records count.
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.
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.