#include <jf/jf_config.h>
#include <jf/jf_errors.h>
#include <jf/jf_utils.h>
#include <jf/jf_cache_file.h>
#include <jf/jf_trace.h>
Go to the source code of this file.
|
Definition at line 42 of file jf_cache_file.c. |
|
Check the value of the "bytes" property against real allocated bytes; this is a _DEBUG method should be used only when checking code
References TRUE. |
|
Prepare a logical chunk for usage: this is a mix of jf_cache_file_merge and jf_cache_file_split; it MUST be used BEFORE every cache file update (see jf_cache_file_chunk_set_content)
References jf_cache_file_t::array, jf_cache_file_t::bytes, CATCH, jf_cache_file_elem_s::data, FALSE, jf_cache_file_range_s::first, jf_cache_file_is_empty(), jf_cache_file_is_safe(), jf_cache_file_merge(), jf_cache_file_search(), jf_cache_file_search_hint(), jf_cache_file_split(), jf_offset_t, JF_RC_INTERNAL_ERROR, JF_RC_MALLOC_ERROR, JF_RC_OBJ_CORRUPTED, JF_RC_OBJ_NOT_INITIALIZED, JF_RC_OK, JF_RC_OUT_OF_RANGE, JF_TRACE, jf_cache_file_range_s::last, jf_cache_file_elem_s::range, jf_cache_file_t::size, THROW, and TRUE. Referenced by jf_cache_file_set_content(). |
|
Set the content of a chunk
References jf_cache_file_t::array, byte_t, jf_cache_file_t::bytes, CATCH, jf_cache_file_elem_s::data, jf_cache_file_range_s::first, jf_offset_t, JF_RC_DESTINATION_TOO_SMALL, JF_RC_INTERNAL_ERROR, JF_RC_MALLOC_ERROR, JF_RC_OK, JF_RC_OUT_OF_RANGE, JF_TRACE, jf_cache_file_range_s::last, jf_cache_file_elem_s::range, jf_cache_file_t::size, and THROW. Referenced by jf_cache_file_set_content(). |
|
Clear and re-init a cache file: every allocated chunk is released and the cache file become a single chunk empty cache file
References CATCH, jf_cache_file_destroy(), jf_cache_file_get_last_pos(), jf_cache_file_get_limit(), jf_cache_file_init(), jf_cache_file_is_empty(), jf_cache_file_is_safe(), jf_offset_t, JF_RC_INTERNAL_ERROR, JF_RC_OBJ_CORRUPTED, JF_RC_OK, JF_TRACE, and THROW. Referenced by jf_journal_rollback_int(), and jf_journal_write_records(). |
|
Destroy a cache file object. Every created object (jf_cache_file_create) must be destroyed to avoid memory leaks.
References jf_cache_file_t::array, jf_cache_file_elem_s::data, jf_cache_file_is_safe(), jf_cache_file_reset(), jf_offset_t, JF_TRACE, and jf_cache_file_t::size. Referenced by jf_cache_file_clear(), and jf_journal_file_destroy(). |
|
Retrieve a list of free (non allocated) ranges between a specified range; every range is a set of (cache) file bytes
References jf_cache_file_t::array, CATCH, jf_cache_file_elem_s::data, jf_cache_file_range_s::first, jf_cache_file_is_empty(), jf_cache_file_is_safe(), jf_cache_file_search(), jf_offset_t, JF_RC_INTERNAL_ERROR, JF_RC_INVALID_OPTION, JF_RC_OBJ_CORRUPTED, JF_RC_OBJ_NOT_INITIALIZED, JF_RC_OK, JF_RC_REALLOC_ERROR, JF_TRACE, jf_cache_file_range_s::last, jf_cache_file_elem_s::range, and THROW. |
|
Retrieve a list of used (allocated) ranges between a specified range; every range is a set of (cache) file bytes
References jf_cache_file_t::array, CATCH, jf_cache_file_elem_s::data, jf_cache_file_range_s::first, jf_cache_file_is_empty(), jf_cache_file_is_safe(), jf_cache_file_search(), jf_offset_t, JF_RC_INTERNAL_ERROR, JF_RC_INVALID_OPTION, JF_RC_OBJ_CORRUPTED, JF_RC_OBJ_NOT_INITIALIZED, JF_RC_OK, JF_RC_REALLOC_ERROR, JF_TRACE, jf_cache_file_range_s::last, jf_cache_file_elem_s::range, and THROW. |
|
Initialize a cache file object: this method MUST be invoked after jf_cache_file_create and before every "useful" method
References jf_cache_file_t::array, jf_cache_file_t::bytes, CATCH, jf_cache_file_elem_s::data, jf_cache_file_range_s::first, jf_cache_file_is_empty(), jf_cache_file_set_limit(), jf_offset_t, JF_RC_INTERNAL_ERROR, JF_RC_MALLOC_ERROR, JF_RC_OBJ_NOT_VOID, JF_RC_OK, JF_RC_OUT_OF_RANGE, JF_TRACE, jf_cache_file_range_s::last, jf_cache_file_elem_s::range, jf_cache_file_t::size, and THROW. Referenced by jf_cache_file_clear(), jf_cache_file_resize(), and jf_journal_file_init(). |
|
Merge some consecutive chunk in a single one
References jf_cache_file_t::array, byte_t, jf_cache_file_t::bytes, CATCH, jf_cache_file_elem_s::data, FALSE, jf_cache_file_range_s::first, jf_cache_file_is_empty(), jf_cache_file_is_safe(), jf_offset_t, JF_RC_INTERNAL_ERROR, JF_RC_INVALID_OPTION, JF_RC_MALLOC_ERROR, JF_RC_OBJ_CORRUPTED, JF_RC_OBJ_NOT_INITIALIZED, JF_RC_OK, JF_RC_OUT_OF_RANGE, JF_TRACE, jf_cache_file_range_s::last, jf_cache_file_elem_s::range, jf_cache_file_t::size, THROW, and TRUE. Referenced by jf_cache_file_chunk_prepare(). |
|
Resize an already initialized (see jf_cache_file_init) object
References jf_cache_file_t::array, byte_t, jf_cache_file_t::bytes, CATCH, jf_cache_file_elem_s::data, jf_cache_file_range_s::first, JF_CACHE_FILE_DEFAULT_LIMIT, jf_cache_file_init(), jf_cache_file_is_empty(), jf_cache_file_is_safe(), jf_cache_file_search(), jf_offset_t, JF_RC_INTERNAL_ERROR, JF_RC_OBJ_CORRUPTED, JF_RC_OK, JF_RC_REALLOC_ERROR, JF_TRACE, jf_cache_file_range_s::last, jf_cache_file_elem_s::range, jf_cache_file_t::size, and THROW. Referenced by jf_journal_add_byte_data(), and jf_journal_open_attach_file(). |
|
Search a value in cache array and return the position of the interval containing the value; a hint is accepted to cut down search time (if hint is right, computation time become T(n)=O(1) )
References jf_cache_file_t::array, CATCH, FALSE, jf_cache_file_range_s::first, jf_cache_file_is_empty(), jf_cache_file_is_safe(), jf_offset_t, JF_RC_INTERNAL_ERROR, JF_RC_OBJ_CORRUPTED, JF_RC_OBJ_NOT_FOUND, JF_RC_OBJ_NOT_INITIALIZED, JF_RC_OK, JF_RC_OUT_OF_RANGE, JF_TRACE, jf_cache_file_range_s::last, jf_cache_file_elem_s::range, jf_cache_file_t::size, THROW, and TRUE. Referenced by jf_cache_file_chunk_prepare(), and jf_cache_file_search(). |
|
Set the content of a piece of (cache) file: this is the "high" level method should normally be used to update cache content
References jf_cache_file_t::array, byte_t, CATCH, jf_cache_file_range_s::first, jf_cache_file_chunk_prepare(), jf_cache_file_chunk_set_content(), jf_cache_file_search(), jf_offset_t, JF_RC_INTERNAL_ERROR, JF_RC_INVALID_STATUS, JF_RC_OK, JF_TRACE, jf_cache_file_range_s::last, jf_cache_file_elem_s::range, and THROW. Referenced by jf_journal_add_byte_data(). |
|
Split a record in cache file object
References jf_cache_file_t::array, byte_t, jf_cache_file_t::bytes, CATCH, jf_cache_file_elem_s::data, jf_cache_file_range_s::first, jf_cache_file_is_empty(), jf_cache_file_is_safe(), jf_offset_t, JF_RC_INTERNAL_ERROR, JF_RC_INVALID_OPTION, JF_RC_MALLOC_ERROR, JF_RC_OBJ_CORRUPTED, JF_RC_OBJ_NOT_INITIALIZED, JF_RC_OK, JF_RC_OUT_OF_RANGE, JF_RC_REALLOC_ERROR, JF_TRACE, jf_cache_file_range_s::last, jf_cache_file_elem_s::range, jf_cache_file_t::size, and THROW. Referenced by jf_cache_file_chunk_prepare(). |
|
Trace the content of a cache file object
References jf_cache_file_t::array, jf_cache_file_t::bytes, CATCH, jf_cache_file_elem_s::data, jf_cache_file_range_s::first, jf_cache_file_is_safe(), jf_offset_t, JF_OFFSET_T_FORMAT, JF_RC_INTERNAL_ERROR, JF_RC_OBJ_CORRUPTED, JF_RC_OK, JF_TRACE, jf_trace_hex_data(), jf_trace_text_data(), jf_word_t, jf_cache_file_range_s::last, jf_cache_file_elem_s::range, jf_cache_file_t::size, and THROW. |