libjf API reference guide

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

jf_journal_file_tab.h File Reference

#include <jf/jf_config.h>
#include <jf/jf_journal_file.h>
#include <jf/jf_errors.h>
#include <jf/jf_trace.h>

Go to the source code of this file.

Data Structures

struct  jf_journal_file_tab_t

Defines

#define JF_JOURNAL_FILE_TAB_CTRL   0x4
#define JF_JOURNAL_FILE_TAB_PATH   0x2
#define JF_JOURNAL_FILE_TAB_SIZE   0x1
#define JF_JOURNAL_FILE_TAB_TRACE(j, m, s)
#define JF_JOURNAL_GLOBAL_FILE_ID   0x0
#define JF_TRACE_MODULE   JF_TRACE_MOD_LIB_JOURNAL_FILE_TAB

Functions

int jf_journal_file_tab_add (jf_journal_file_tab_t *jft, const jf_journal_file_t *jf, jf_word_t *id)
void jf_journal_file_tab_create (jf_journal_file_tab_t *jft)
int jf_journal_file_tab_del (jf_journal_file_tab_t *jft, jf_word_t id)
void jf_journal_file_tab_destroy (jf_journal_file_tab_t *jft)
int jf_journal_file_tab_dump (const jf_journal_file_tab_t *jft, FILE *stream, jf_word_t flags, jf_word_t id)
jf_journal_file_tjf_journal_file_tab_get_jfile (const jf_journal_file_tab_t *jft, jf_word_t pos)
jf_word_t jf_journal_file_tab_get_max_files (const jf_journal_file_tab_t *jft)
jf_word_t jf_journal_file_tab_get_number_of_files (const jf_journal_file_tab_t *jft)
int jf_journal_file_tab_init (jf_journal_file_tab_t *jft, jf_word_t max_files)
int jf_journal_file_tab_is_void (const jf_journal_file_tab_t *jft)
int jf_journal_file_tab_restore (jf_journal_file_tab_t *jft, FILE *stream)
int jf_journal_file_tab_search (const jf_journal_file_tab_t *jft, const char *path, jf_word_t *pos)
int jf_journal_file_tab_trace (const jf_journal_file_tab_t *jft, const char *method, FILE *out_stream)


Define Documentation

#define JF_JOURNAL_FILE_TAB_CTRL   0x4
 

Control part of the file table must be considered Definition at line 57 of file jf_journal_file_tab.h.

Referenced by jf_journal_close_detach_file(), jf_journal_cold_recovery(), jf_journal_commit_int(), jf_journal_create(), jf_journal_file_tab_dump(), jf_journal_new_unit_of_work(), and jf_journal_rotate().

#define JF_JOURNAL_FILE_TAB_PATH   0x2
 

Path part of the file table must be considered Definition at line 53 of file jf_journal_file_tab.h.

Referenced by jf_journal_attach_file(), jf_journal_create(), jf_journal_file_tab_dump(), jf_journal_util_leave(), and jf_journal_util_rename().

#define JF_JOURNAL_FILE_TAB_SIZE   0x1
 

Size part of the file table must be considered Definition at line 49 of file jf_journal_file_tab.h.

Referenced by jf_journal_attach_file(), jf_journal_create(), jf_journal_file_tab_dump(), and jf_journal_util_leave().

#define JF_JOURNAL_FILE_TAB_TRACE j,
m,
 ) 
 

Macro wrapper for method jf_journal_file_tab_trace: active if _DEBUG preprocessor label is set Definition at line 271 of file jf_journal_file_tab.h.

#define JF_JOURNAL_GLOBAL_FILE_ID   0x0
 

This special file id value is used for journal records involving ALL the journaled files Definition at line 63 of file jf_journal_file_tab.h.

Referenced by jf_file_reset(), jf_journal_analyze(), jf_journal_close(), jf_journal_cold_recovery(), jf_journal_cold_recovery_prep_pool(), jf_journal_cold_recovery_update_lists(), jf_journal_commit(), jf_journal_commit_int(), jf_journal_create(), jf_journal_file_tab_dump(), jf_journal_is_sync(), jf_journal_rollback(), jf_journal_rollback_int(), and jf_journal_scan_undo().

#define JF_TRACE_MODULE   JF_TRACE_MOD_LIB_JOURNAL_FILE_TAB
 

Definition at line 42 of file jf_journal_file_tab.h.


Function Documentation

int jf_journal_file_tab_add jf_journal_file_tab_t jft,
const jf_journal_file_t jf,
jf_word_t id
 

Add a new file path to journaled file table

Parameters:
jft IN/OUT journaled file table object
jf IN the journaled file must be added to table; NOTE: the journaled file added must NOT be destroyed after this method because it will automatically destroyed by jf_journal_file_tab_destroy
id OUT the identificator of the added file (meaningless if return code is NOT JF_RC_OK )
Returns:
a reason code
Definition at line 111 of file jf_journal_file_tab.c.

References CATCH, jf_journal_file_tab_t::files, JF_RC_CONTAINER_FULL, JF_RC_INTERNAL_ERROR, JF_RC_OK, JF_TRACE, jf_word_t, jf_journal_file_tab_t::max_files, jf_journal_file_tab_t::number_of_files, and THROW.

Referenced by jf_journal_attach_file(), and jf_journal_create().

void jf_journal_file_tab_create jf_journal_file_tab_t jft  ) 
 

Reset a journaled file table

Parameters:
jft OUT journaled file table object
Definition at line 49 of file jf_journal_file_tab.c.

References jf_journal_file_tab_t::files, jf_journal_file_tab_t::max_files, and jf_journal_file_tab_t::number_of_files.

Referenced by jf_journal_create(), and jf_journal_load().

int jf_journal_file_tab_del jf_journal_file_tab_t jft,
jf_word_t  id
 

Remove a journaled file from table

Parameters:
jft IN/OUT journaled file table object
id IN identificator of the journaled file must be removed
Returns:
a reason code
Definition at line 149 of file jf_journal_file_tab.c.

References CATCH, jf_journal_file_tab_t::files, JF_RC_INTERNAL_ERROR, JF_RC_NULL_OBJECT, JF_RC_OK, JF_RC_OUT_OF_RANGE, JF_TRACE, jf_word_t, jf_journal_file_tab_t::number_of_files, and THROW.

Referenced by jf_journal_util_leave().

void jf_journal_file_tab_destroy jf_journal_file_tab_t jft  ) 
 

Release a journaled file table

Parameters:
jft OUT journaled file table object
Definition at line 58 of file jf_journal_file_tab.c.

References jf_journal_file_tab_t::files, jf_journal_file_destroy(), jf_word_t, jf_journal_file_tab_t::max_files, and jf_journal_file_tab_t::number_of_files.

Referenced by jf_journal_close(), jf_journal_create(), and jf_journal_load().

int jf_journal_file_tab_dump const jf_journal_file_tab_t jft,
FILE *  stream,
jf_word_t  flags,
jf_word_t  id
 

Dump the content of a journaled file table to a valid stream

Parameters:
jft IN journaled file table object
stream IN/OUT output file stream
flags IN what must be dumped (bitwise or) of JF_JOURNAL_FILE_TAB_SIZE, JF_JOURNAL_FILE_TAB_PATH, JF_JOURNAL_FILE_TAB_CTRL
id IN the identificator of the journaled file must be dumped, the special value JF_JOURNAL_GLOBAL_FILE_ID should be used for a complete dump (all entries)
Returns:
a reason code
Definition at line 193 of file jf_journal_file_tab.c.

References CATCH, jf_journal_file_t::file_path, jf_journal_file_tab_t::files, fseeko, JF_JOURNAL_FILE_MAX_PATH_SIZE, JF_JOURNAL_FILE_TAB_CTRL, JF_JOURNAL_FILE_TAB_PATH, JF_JOURNAL_FILE_TAB_SIZE, JF_JOURNAL_GLOBAL_FILE_ID, JF_RC_FPUTC_ERROR, JF_RC_FSEEK_ERROR, JF_RC_FWRITE_ERROR, JF_RC_INTERNAL_ERROR, JF_RC_OK, JF_TRACE, jf_word_t, JF_WORD_T_FORMAT, jf_journal_file_t::last_pos, jf_journal_file_t::last_size, jf_journal_file_tab_t::max_files, jf_journal_file_tab_t::number_of_files, jf_journal_file_t::status, and THROW.

Referenced by jf_journal_create(), and jf_journal_update_file_table().

jf_journal_file_t* jf_journal_file_tab_get_jfile const jf_journal_file_tab_t jft,
jf_word_t  pos
[inline, static]
 

Retrieve a reference to a journaled file stored in the table

Parameters:
jft IN journaled file table object
pos IN position of the desired stream in the table (see jf_journal_file_tab_search )
Returns:
a pointer to journaled file or NULL
Definition at line 135 of file jf_journal_file_tab.h.

References jf_journal_file_tab_t::files, JF_RC_OUT_OF_RANGE, JF_TRACE, jf_word_t, and jf_journal_file_tab_t::number_of_files.

Referenced by jf_journal_add_byte_data(), jf_journal_analyze(), jf_journal_apply_changes(), jf_journal_attach_file(), jf_journal_close(), jf_journal_close_detach_file(), jf_journal_cold_recovery(), jf_journal_cold_recovery_analyze(), jf_journal_cold_recovery_patch(), jf_journal_cold_recovery_patch_seq(), jf_journal_commit_int(), jf_journal_create(), jf_journal_get_byte_data(), jf_journal_get_jfile(), jf_journal_get_stream(), jf_journal_is_all_sync(), jf_journal_is_sync(), jf_journal_load(), jf_journal_new_unit_of_work(), jf_journal_open(), jf_journal_open_attach_file(), jf_journal_remove_changes(), jf_journal_reopen_files(), jf_journal_rollback_int(), jf_journal_rotate(), jf_journal_scan_undo(), jf_journal_set_all_sync(), jf_journal_shift_files(), jf_journal_sync(), jf_journal_util_join(), jf_journal_util_rename(), jf_journal_write_record(), and jf_journal_write_records().

jf_word_t jf_journal_file_tab_get_max_files const jf_journal_file_tab_t jft  )  [inline, static]
 

Parameters:
jft IN journaled file table object
Returns:
the max number of files can be stored in the table
Definition at line 109 of file jf_journal_file_tab.h.

References jf_word_t, and jf_journal_file_tab_t::max_files.

jf_word_t jf_journal_file_tab_get_number_of_files const jf_journal_file_tab_t jft  )  [inline, static]
 

Parameters:
jft IN journaled file table object
Returns:
the number of files currently stored in the table
Definition at line 99 of file jf_journal_file_tab.h.

References jf_word_t, and jf_journal_file_tab_t::number_of_files.

Referenced by jf_journal_apply_changes(), jf_journal_close(), jf_journal_cold_recovery(), jf_journal_cold_recovery_prep_pool(), jf_journal_cold_recovery_update_lists(), jf_journal_commit_int(), jf_journal_is_all_sync(), jf_journal_is_sync(), jf_journal_remove_changes(), jf_journal_reopen_files(), jf_journal_rollback_int(), jf_journal_rotate(), and jf_journal_set_all_sync().

int jf_journal_file_tab_init jf_journal_file_tab_t jft,
jf_word_t  max_files
 

Initialize a journaled file table for usage

Parameters:
jft OUT journaled file table object
max_files IN max number of files can be stored in the table
Returns:
a reason code
Definition at line 73 of file jf_journal_file_tab.c.

References CATCH, jf_journal_file_tab_t::files, JF_RC_INTERNAL_ERROR, JF_RC_MALLOC_ERROR, JF_RC_OK, JF_TRACE, jf_word_t, jf_journal_file_tab_t::max_files, and THROW.

Referenced by jf_journal_create(), and jf_journal_file_tab_restore().

int jf_journal_file_tab_is_void const jf_journal_file_tab_t jft  )  [inline, static]
 

Is the object void (just created by jf_journal_file_tab_create ?)

Parameters:
jft IN journaled file table object
Returns:
a boolean value
Definition at line 121 of file jf_journal_file_tab.h.

References jf_journal_file_tab_t::files, jf_journal_file_tab_t::max_files, and jf_journal_file_tab_t::number_of_files.

Referenced by jf_journal_file_tab_restore().

int jf_journal_file_tab_restore jf_journal_file_tab_t jft,
FILE *  stream
 

Restore the content of a journaled file table from a valid stream

Parameters:
jft IN/OUT journaled file table object
stream IN input file stream
Returns:
a reason code
Definition at line 339 of file jf_journal_file_tab.c.

References jf_journal_file_t::cache_file, CATCH, jf_journal_file_t::file_path, jf_journal_file_tab_t::files, jf_cache_file_create(), JF_JOURNAL_FILE_MAX_PATH_SIZE, jf_journal_file_set_stream(), jf_journal_file_tab_init(), jf_journal_file_tab_is_void(), JF_JOURNAL_JOURNAL_FILE_ID, JF_RC_FREAD_ERROR, JF_RC_INTERNAL_ERROR, JF_RC_MALLOC_ERROR, JF_RC_OBJ_NOT_VOID, JF_RC_OK, JF_TRACE, jf_word_t, jf_journal_file_t::last_pos, jf_journal_file_t::last_size, jf_journal_file_tab_t::max_files, jf_journal_file_tab_t::number_of_files, jf_journal_file_t::status, and THROW.

Referenced by jf_journal_load().

int jf_journal_file_tab_search const jf_journal_file_tab_t jft,
const char *  path,
jf_word_t pos
 

Look for a path in a file table: if found, the position will be stored in "pos", else a JF_RC_OBJ_NOT_FOUND reason code is returned

Parameters:
jft IN journaled file table object
path IN file name must be searched in the journaled file table
pos OUT file name position in the file table (meaningless if returned reason code is not JF_RC_OK)
Returns:
a reason code ( JF_RC_OBJ_NOT_FOUND if "path" is not in "jft")
Definition at line 453 of file jf_journal_file_tab.c.

References CATCH, jf_journal_file_t::file_path, jf_journal_file_tab_t::files, JF_JOURNAL_FIRST_FILE_ID, JF_RC_INTERNAL_ERROR, JF_RC_OBJ_NOT_FOUND, JF_RC_OK, JF_TRACE, jf_word_t, jf_journal_file_tab_t::number_of_files, and THROW.

Referenced by jf_journal_attach_file(), jf_journal_open_attach_file(), jf_journal_util_leave(), and jf_journal_util_rename().

int jf_journal_file_tab_trace const jf_journal_file_tab_t jft,
const char *  method,
FILE *  out_stream
 

Trace journal file table content to stream

Parameters:
jft IN journal file table object
method IN method name
out_stream IN output stream (i.e. stderr)
Returns:
0
Definition at line 493 of file jf_journal_file_tab.c.

References jf_journal_file_tab_t::files, jf_journal_file_get_path(), JF_OFFSET_T_FORMAT, jf_word_t, jf_journal_file_tab_t::max_files, and jf_journal_file_tab_t::number_of_files.

Referenced by jf_journal_trace().


Copyright 2005 © Tiian