4
typedef struct fastwrtier_s fastwriter_t;
7
FASTWRITER_FLAGS_DEFAULT = 0,
8
FASTWRITER_FLAGS_BLOCK = 1, /**< by default the error will be returned if there is no space in the buffer to accomodate the data */
9
FASTWRITER_FLAGS_OVERWRITE = 2 /**< overwrite the data currently in the storage */
13
size_t buffer_size; /**< buffer size in bytes */
14
size_t buffer_used; /**< amount of data currently in the buffer */
15
size_t buffer_max; /**< maximal amount of data in the buffer */
16
size_t commited; /**< total commited data for current file */
17
size_t written; /**< total written data for currrent file */
20
#define FASTWRITER_BUFFER_DEFAULT 0
21
#define FASTWRITER_BUFFER_MAX ((size_t)-1)
24
* @fs - defines which writter implementation will be actually used. One can
25
* pass just a file name, then a type of partition will be autodetected.
26
* Otherwise, it is possible to pass the name of storage device. In this
27
* case either RingFS will be used or data will be pushed to the RAW device.
29
fastwriter_t *fastwriter_init(const char *fs, fastwriter_flags_t flags);
30
void fastwriter_destroy(fastwriter_t *ctx);
32
int fastwriter_set_buffer_size(fastwriter_t *ctx, size_t buffer_size);
33
int fastwriter_get_stats(fastwriter_t *ctx, fastwriter_stats_t *stats);
35
int fastwriter_open(fastwriter_t *ctx, const char *name, fastwriter_flags_t flags);
36
int fastwriter_close(fastwriter_t *ctx);
38
int fastwriter_push_chunk(fastwriter_t *ctx, size_t size, const void *buf);
39
int fastwriter_commit(fastwriter_t *ctx);
40
int fastwriter_cancel(fastwriter_t *ctx);
42
int fastwriter_push_data(fastwriter_t *ctx, size_t size, const void *buf);
44
#endif /* _FASTWRITER_H */