libjf API reference guide

Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

jf_cache_file.h File Reference

#include <jf/jf_config.h>
#include <jf/jf_defines.h>
#include <jf/jf_wrappers.h>

Go to the source code of this file.

Data Structures

struct  jf_cache_file_elem_s
struct  jf_cache_file_range_s
struct  jf_cache_file_t

Defines

#define JF_CACHE_FILE_DEFAULT_LIMIT   (JF_CACHE_FILE_MIN_LIMIT * 64)
#define JF_CACHE_FILE_MIN_LIMIT   4096
#define JF_TRACE_MODULE   JF_TRACE_MOD_LIB_CACHE_FILE

Functions

LIBJF_EXPORT int jf_cache_file_check_bytes (const jf_cache_file_t *cf)
const byte_tjf_cache_file_chunk_get_content (const jf_cache_file_t *cf, jf_offset_t chunk)
const struct jf_cache_file_range_sjf_cache_file_chunk_get_range (const jf_cache_file_t *cf, jf_offset_t chunk)
size_t jf_cache_file_chunk_get_size (const jf_cache_file_t *cf, jf_offset_t chunk)
int jf_cache_file_chunk_is_used (const jf_cache_file_t *cf, jf_offset_t chunk)
int jf_cache_file_chunk_prepare (jf_cache_file_t *cf, const struct jf_cache_file_range_s *range)
LIBJF_EXPORT int jf_cache_file_chunk_set_content (jf_cache_file_t *cf, jf_offset_t chunk, size_t size, size_t offset, const byte_t *content)
int jf_cache_file_clear (jf_cache_file_t *cf)
void jf_cache_file_create (jf_cache_file_t *cf)
LIBJF_EXPORT void jf_cache_file_destroy (jf_cache_file_t *cf)
LIBJF_EXPORT int jf_cache_file_get_free_ranges (const jf_cache_file_t *cf, const struct jf_cache_file_range_s *range, size_t *size, struct jf_cache_file_range_s **array)
jf_offset_t jf_cache_file_get_last_pos (const jf_cache_file_t *cf)
jf_offset_t jf_cache_file_get_limit (const jf_cache_file_t *cf)
jf_offset_t jf_cache_file_get_size (const jf_cache_file_t *cf)
LIBJF_EXPORT int jf_cache_file_get_used_ranges (const jf_cache_file_t *cf, const struct jf_cache_file_range_s *range, size_t *size, struct jf_cache_file_range_s **array)
LIBJF_EXPORT int jf_cache_file_init (jf_cache_file_t *cf, jf_offset_t last_pos, jf_offset_t limit)
int jf_cache_file_is_empty (const jf_cache_file_t *cf)
int jf_cache_file_is_safe (const jf_cache_file_t *cf)
int jf_cache_file_limit_exceeded (const jf_cache_file_t *cf)
LIBJF_EXPORT int jf_cache_file_merge (jf_cache_file_t *cf, jf_offset_t first, jf_offset_t last)
void jf_cache_file_reset (jf_cache_file_t *cf)
LIBJF_EXPORT int jf_cache_file_resize (jf_cache_file_t *cf, jf_offset_t new_last_pos)
int jf_cache_file_search (const jf_cache_file_t *cf, jf_offset_t value, jf_offset_t *pos)
LIBJF_EXPORT int jf_cache_file_search_hint (const jf_cache_file_t *cf, jf_offset_t value, jf_offset_t *pos, jf_offset_t hint)
LIBJF_EXPORT int jf_cache_file_set_content (jf_cache_file_t *cf, jf_offset_t pos, size_t size, const byte_t *content)
int jf_cache_file_set_last_pos (jf_cache_file_t *cf, jf_offset_t last_pos)
void jf_cache_file_set_limit (jf_cache_file_t *cf, jf_offset_t limit)
LIBJF_EXPORT int jf_cache_file_split (jf_cache_file_t *cf, jf_offset_t pos, const struct jf_cache_file_range_s *range)
LIBJF_EXPORT int jf_cache_file_trace (const jf_cache_file_t *cf, FILE *out_stream)


Define Documentation

#define JF_CACHE_FILE_DEFAULT_LIMIT   (JF_CACHE_FILE_MIN_LIMIT * 64)
 

Default limit size for cache file objects Definition at line 60 of file jf_cache_file.h.

Referenced by jf_cache_file_resize(), jf_cache_file_set_limit(), and jf_set_default_journal_file_opts().

#define JF_CACHE_FILE_MIN_LIMIT   4096
 

Minimum limit size for cache file objects Definition at line 51 of file jf_cache_file.h.

Referenced by jf_cache_file_set_limit().

#define JF_TRACE_MODULE   JF_TRACE_MOD_LIB_CACHE_FILE
 

Definition at line 41 of file jf_cache_file.h.


Function Documentation

LIBJF_EXPORT int jf_cache_file_check_bytes const jf_cache_file_t cf  ) 
 

Check the value of the "bytes" property against real allocated bytes; this is a _DEBUG method should be used only when checking code

Parameters:
cf IN cache file object
Returns:
a boolean value: TRUE if "bytes" is OK, FALSE if "bytes" is not aligned to cache file object content
Definition at line 1250 of file jf_cache_file.c.

References TRUE.

const byte_t* jf_cache_file_chunk_get_content const jf_cache_file_t cf,
jf_offset_t  chunk
[inline, static]
 

Retrieve the data stored in a chunk

Parameters:
cf IN cache file object
chunk IN position returned by jf_cache_file_search
Returns:
a pointer to data stored in a chunk
Definition at line 532 of file jf_cache_file.h.

References jf_cache_file_t::array, byte_t, jf_cache_file_elem_s::data, jf_offset_t, and jf_cache_file_t::size.

Referenced by jf_journal_get_byte_data(), jf_journal_write_record(), and jf_journal_write_records().

const struct jf_cache_file_range_s* jf_cache_file_chunk_get_range const jf_cache_file_t cf,
jf_offset_t  chunk
[inline, static]
 

Retrieve the range of a chunk (id)

Parameters:
cf IN cache file object
chunk IN interesting chunk id
Returns:
a constant reference to the chunk range or NULL if "chunk" is "out of range"
Definition at line 500 of file jf_cache_file.h.

References jf_cache_file_t::array, jf_offset_t, jf_cache_file_elem_s::range, and jf_cache_file_t::size.

Referenced by jf_journal_get_byte_data(), jf_journal_write_record(), and jf_journal_write_records().

size_t jf_cache_file_chunk_get_size const jf_cache_file_t cf,
jf_offset_t  chunk
[inline, static]
 

Retrieve the size of a chunk

Parameters:
cf IN cache file object
chunk IN position returned by jf_cache_file_search
Returns:
the size of the chunk (bytes); 0 if "chunk" value is "out of range"
Definition at line 482 of file jf_cache_file.h.

References jf_cache_file_t::array, jf_cache_file_range_s::first, jf_offset_t, jf_cache_file_range_s::last, jf_cache_file_elem_s::range, and jf_cache_file_t::size.

int jf_cache_file_chunk_is_used const jf_cache_file_t cf,
jf_offset_t  chunk
[inline, static]
 

Is a chunk used?

Parameters:
cf IN cache file object
chunk IN identificator/position of the chunk
Returns:
a boolean value
Definition at line 547 of file jf_cache_file.h.

References jf_cache_file_t::array, jf_cache_file_elem_s::data, FALSE, jf_offset_t, and jf_cache_file_t::size.

Referenced by jf_journal_write_records().

int jf_cache_file_chunk_prepare jf_cache_file_t cf,
const struct jf_cache_file_range_s range
 

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)

Parameters:
cf IN/OUT cache file object
range IN range of (cache) file positions are going to be updated
Returns:
a reason code
Definition at line 851 of file jf_cache_file.c.

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().

LIBJF_EXPORT int jf_cache_file_chunk_set_content jf_cache_file_t cf,
jf_offset_t  chunk,
size_t  size,
size_t  offset,
const byte_t content
 

Set the content of a chunk

Parameters:
cf IN/OUT cache file object
chunk IN chunk cache position as returned by jf_cache_file_search
size IN number of bytes must be stored in chunk
offset IN storage displacement (0 if the content must be filled in starting at first byte)
content IN data must be copied in chunk
Returns:
a reason code
Definition at line 1191 of file jf_cache_file.c.

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().

int jf_cache_file_clear jf_cache_file_t cf  ) 
 

Clear and re-init a cache file: every allocated chunk is released and the cache file become a single chunk empty cache file

Parameters:
cf IN/OUT cache file object
Returns:
a reason code
Definition at line 124 of file jf_cache_file.c.

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().

void jf_cache_file_create jf_cache_file_t cf  )  [inline, static]
 

Create a new cache file object. Every created object must be destroyed with method jf_cache_file_destroy to avoid memory leaks

Parameters:
cf OUT cache file object
Definition at line 282 of file jf_cache_file.h.

References jf_cache_file_reset().

Referenced by jf_journal_file_create(), and jf_journal_file_tab_restore().

LIBJF_EXPORT void jf_cache_file_destroy jf_cache_file_t cf  ) 
 

Destroy a cache file object. Every created object (jf_cache_file_create) must be destroyed to avoid memory leaks.

Parameters:
cf IN/OUT cache file object
Definition at line 46 of file jf_cache_file.c.

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().

LIBJF_EXPORT int jf_cache_file_get_free_ranges const jf_cache_file_t cf,
const struct jf_cache_file_range_s range,
size_t *  size,
struct jf_cache_file_range_s **  array
 

Retrieve a list of free (non allocated) ranges between a specified range; every range is a set of (cache) file bytes

Parameters:
cf IN cache file object
range IN first and last byte of the (cache) file range must be inspected
size OUT number of free ranges found between "range.first" and "range.last" (cache) file position
array OUT a pointer to an array storing all free ranges; NOTE: the array MUST be released with function "free()" by caller to avoid memory leaks
Returns:
a reason code
Definition at line 646 of file jf_cache_file.c.

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.

jf_offset_t jf_cache_file_get_last_pos const jf_cache_file_t cf  )  [inline, static]
 

Retrieve the last file position traced by this cache file

Parameters:
cf IN cache file object
Returns:
the last file position, -1 if an error occurs
Definition at line 227 of file jf_cache_file.h.

References jf_cache_file_t::array, jf_cache_file_is_empty(), jf_cache_file_is_safe(), jf_offset_t, jf_cache_file_range_s::last, jf_cache_file_elem_s::range, and jf_cache_file_t::size.

Referenced by jf_cache_file_clear(), jf_journal_add_byte_data(), and jf_journal_rollback_int().

jf_offset_t jf_cache_file_get_limit const jf_cache_file_t cf  )  [inline, static]
 

Retrieve the memory limit set for a cache file object

Parameters:
cf IN cache file object
Returns:
the limit in bytes
Definition at line 179 of file jf_cache_file.h.

References jf_offset_t, and jf_cache_file_t::limit.

Referenced by jf_cache_file_clear(), and jf_file_get_cache_limit().

jf_offset_t jf_cache_file_get_size const jf_cache_file_t cf  )  [inline, static]
 

Retrieve the size (number of chunk) actually partitioning cache

Parameters:
cf IN cache file object
Returns:
the number of chunks
Definition at line 167 of file jf_cache_file.h.

References jf_offset_t, and jf_cache_file_t::size.

Referenced by jf_journal_write_records().

LIBJF_EXPORT int jf_cache_file_get_used_ranges const jf_cache_file_t cf,
const struct jf_cache_file_range_s range,
size_t *  size,
struct jf_cache_file_range_s **  array
 

Retrieve a list of used (allocated) ranges between a specified range; every range is a set of (cache) file bytes

Parameters:
cf IN cache file object
range IN first and last byte of the (cache) file range must be inspected
size OUT number of used ranges found between "range.first" and "range.last" (cache) file position
array OUT a pointer to an array storing all used ranges; NOTE: the array MUST be released with function "free()" by caller to avoid memory leaks
Returns:
a reason code
Definition at line 749 of file jf_cache_file.c.

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.

LIBJF_EXPORT int jf_cache_file_init jf_cache_file_t cf,
jf_offset_t  last_pos,
jf_offset_t  limit
 

Initialize a cache file object: this method MUST be invoked after jf_cache_file_create and before every "useful" method

Parameters:
cf IN/OUT cache file object
last_pos IN last valid filepos should be cached
limit IN desired max size amount; see jf_cache_file_set_limit for more details about special values
Returns:
a reason code
Definition at line 64 of file jf_cache_file.c.

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().

int jf_cache_file_is_empty const jf_cache_file_t cf  )  [inline, static]
 

Is the cache object empty?

Parameters:
cf IN cache file object
Returns:
a boolean value: TRUE the object is empty, FALSE the object is NOT empty
Definition at line 156 of file jf_cache_file.h.

References jf_cache_file_t::array, and jf_cache_file_t::size.

Referenced by jf_cache_file_chunk_prepare(), jf_cache_file_clear(), jf_cache_file_get_free_ranges(), jf_cache_file_get_last_pos(), jf_cache_file_get_used_ranges(), jf_cache_file_init(), jf_cache_file_merge(), jf_cache_file_resize(), jf_cache_file_search_hint(), jf_cache_file_set_last_pos(), jf_cache_file_split(), and jf_journal_write_record().

int jf_cache_file_is_safe const jf_cache_file_t cf  )  [inline, static]
 

Is the cache object safe?

Parameters:
cf IN cache file object
Returns:
a boolean value: TRUE the object is "safe", FALSE the object is corrupted
Definition at line 143 of file jf_cache_file.h.

References jf_cache_file_t::array, and jf_cache_file_t::size.

Referenced by jf_cache_file_chunk_prepare(), jf_cache_file_clear(), jf_cache_file_destroy(), jf_cache_file_get_free_ranges(), jf_cache_file_get_last_pos(), jf_cache_file_get_used_ranges(), jf_cache_file_merge(), jf_cache_file_resize(), jf_cache_file_search_hint(), jf_cache_file_set_last_pos(), jf_cache_file_split(), and jf_cache_file_trace().

int jf_cache_file_limit_exceeded const jf_cache_file_t cf  )  [inline, static]
 

Check if the amount of storage used by the cache object has been exceeded

Parameters:
cf IN cache file object
Returns:
a boolean value
Definition at line 212 of file jf_cache_file.h.

References jf_cache_file_t::bytes, FALSE, and jf_cache_file_t::limit.

Referenced by jf_journal_add_byte_data().

LIBJF_EXPORT int jf_cache_file_merge jf_cache_file_t cf,
jf_offset_t  first,
jf_offset_t  last
 

Merge some consecutive chunk in a single one

Parameters:
cf IN/OUT cache file object
first IN first chunk must be merged (NOTE: the chunk value IS not the byte position, see jf_cache_file_search)
last IN last chunk must be merged
Returns:
a reason code
Definition at line 1038 of file jf_cache_file.c.

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().

void jf_cache_file_reset jf_cache_file_t cf  )  [inline, static]
 

Reset a cache file object

Parameters:
cf OUT cache file object
NOTE: this is a PRIVATE method must not be used outside this class Definition at line 267 of file jf_cache_file.h.

References jf_cache_file_t::array, jf_cache_file_t::bytes, jf_offset_t, jf_cache_file_t::limit, and jf_cache_file_t::size.

Referenced by jf_cache_file_create(), jf_cache_file_destroy(), and jf_journal_file_reset().

LIBJF_EXPORT int jf_cache_file_resize jf_cache_file_t cf,
jf_offset_t  new_last_pos
 

Resize an already initialized (see jf_cache_file_init) object

Parameters:
cf IN/OUT cache file object
new_last_pos IN new last valid filepos must be cached
Returns:
a reason code
Definition at line 173 of file jf_cache_file.c.

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().

int jf_cache_file_search const jf_cache_file_t cf,
jf_offset_t  value,
jf_offset_t pos
[inline, static]
 

Search a value in cache array and return the position of the interval containing the value

Parameters:
cf IN cache file object
value IN searched value
pos OUT interval (chunk) containing the searched value
Returns:
a reason code (JF_RC_OBJ_NOT_FOUND if data was not found)
Definition at line 364 of file jf_cache_file.h.

References jf_cache_file_search_hint(), and jf_offset_t.

Referenced by jf_cache_file_chunk_prepare(), jf_cache_file_get_free_ranges(), jf_cache_file_get_used_ranges(), jf_cache_file_resize(), jf_cache_file_set_content(), and jf_journal_get_byte_data().

LIBJF_EXPORT int jf_cache_file_search_hint const jf_cache_file_t cf,
jf_offset_t  value,
jf_offset_t pos,
jf_offset_t  hint
 

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) )

Parameters:
cf IN cache file object
value IN searched value
pos OUT interval (chunk) containing the searched value
hint IN initial search position; a negative value is used for "no available hint" condition
Returns:
a reason code (JF_RC_OBJ_NOT_FOUND if data was not found)
Definition at line 303 of file jf_cache_file.c.

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().

LIBJF_EXPORT int jf_cache_file_set_content jf_cache_file_t cf,
jf_offset_t  pos,
size_t  size,
const byte_t content
 

Set the content of a piece of (cache) file: this is the "high" level method should normally be used to update cache content

Parameters:
cf IN/OUT cache file content
pos IN cache file starting position
size IN number of bytes must be updated in cache file starting at "pos" position (first position is "0")
content IN data should be copied into cache file
Returns:
a reason code
Definition at line 571 of file jf_cache_file.c.

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().

int jf_cache_file_set_last_pos jf_cache_file_t cf,
jf_offset_t  last_pos
[inline, static]
 

Set the last file position traced by this cache file; this is a potential dangerous method, pay attention! It's used after a rollback for consistency reasons

Parameters:
cf IN/OUT cache file object
last_pos IN new value for last pos
Returns:
the last file position, -1 if an error occurs
Definition at line 247 of file jf_cache_file.h.

References jf_cache_file_t::array, jf_cache_file_is_empty(), jf_cache_file_is_safe(), jf_offset_t, JF_RC_INVALID_STATUS, JF_RC_OBJ_CORRUPTED, JF_RC_OK, jf_cache_file_range_s::last, jf_cache_file_elem_s::range, and jf_cache_file_t::size.

Referenced by jf_journal_rollback_int().

void jf_cache_file_set_limit jf_cache_file_t cf,
jf_offset_t  limit
[inline, static]
 

Set new limit for cache file object

Parameters:
cf IN/OUT cache file object
limit IN new cache file limit (bytes)
Note: limit < 0 is like limit = JF_CACHE_FILE_DEFAULT_LIMIT
Note: limit >= 0 && limit < JF_CACHE_FILE_MIN_LIMIT is like limit = JF_CACHE_FILE_MIN_LIMIT
Definition at line 195 of file jf_cache_file.h.

References JF_CACHE_FILE_DEFAULT_LIMIT, JF_CACHE_FILE_MIN_LIMIT, jf_offset_t, and jf_cache_file_t::limit.

Referenced by jf_cache_file_init(), and jf_journal_file_set_options().

LIBJF_EXPORT int jf_cache_file_split jf_cache_file_t cf,
jf_offset_t  pos,
const struct jf_cache_file_range_s range
 

Split a record in cache file object

Parameters:
cf IN/OUT cache file object
pos IN position of the record must be splitted
range IN range (lowest and highest values) for new record
Returns:
a reason code
Definition at line 400 of file jf_cache_file.c.

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().

LIBJF_EXPORT int jf_cache_file_trace const jf_cache_file_t cf,
FILE *  out_stream
 

Trace the content of a cache file object

Parameters:
cf IN cache file object
out_stream IN/OUT output stream used for trace
Returns:
a reason code
Definition at line 1279 of file jf_cache_file.c.

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.


Copyright 2005 © Tiian