1.1 --- a/src/cx/buffer.h Sat Apr 30 09:03:17 2022 +0200 1.2 +++ b/src/cx/buffer.h Sat Apr 30 09:47:20 2022 +0200 1.3 @@ -91,6 +91,40 @@ 1.4 /** Current size of the buffer content. */ 1.5 size_t size; 1.6 /** 1.7 + * The buffer may not extend beyond this threshold before starting to flush. 1.8 + * Default is \c SIZE_MAX (flushing disabled when auto extension is enabled). 1.9 + */ 1.10 + size_t flush_threshold; 1.11 + /** 1.12 + * The block size for the elements to flush. 1.13 + * Default is 4096 bytes. 1.14 + */ 1.15 + size_t flush_blksize; 1.16 + /** 1.17 + * The maximum number of blocks to flush in one cycle. 1.18 + * Zero disables flushing entirely (this is the default). 1.19 + * Set this to \c SIZE_MAX to flush the entire buffer. 1.20 + * 1.21 + * @attention if the maximum number of blocks multiplied with the block size 1.22 + * is smaller than the expected contents written to this buffer within one write 1.23 + * operation, multiple flush cycles are performed after that write. 1.24 + * That means the total number of blocks flushed after one write to this buffer may 1.25 + * be larger than \c flush_blkmax. 1.26 + */ 1.27 + size_t flush_blkmax; 1.28 + 1.29 + /** 1.30 + * The write function used for flushing. 1.31 + * If NULL, the flushed content gets discarded. 1.32 + */ 1.33 + size_t (*flush_func)( 1.34 + void const *, 1.35 + size_t, 1.36 + size_t, 1.37 + void * 1.38 + ); 1.39 + 1.40 + /** 1.41 * Flag register for buffer features. 1.42 * @see #CX_BUFFER_DEFAULT 1.43 * @see #CX_BUFFER_FREE_CONTENTS