IDZEBRA  2.1.2
Data Structures | Macros | Typedefs | Enumerations | Functions
recindex.h File Reference
#include <idzebra/util.h>
#include <zebra-lock.h>
#include <idzebra/bfile.h>

Go to the source code of this file.

Data Structures

struct  record_info
 

Macros

#define REC_NO_INFO   8
 
#define REC_COMPRESS_NONE   0
 No compression ("none") More...
 
#define REC_COMPRESS_BZIP2   1
 BZIP2 compression (slow and requires big chunks) More...
 
#define REC_COMPRESS_ZLIB   2
 zlib compression (faster and works off small chunks) More...
 

Typedefs

typedef struct record_infoRecord
 
typedef struct records_infoRecords
 
typedef struct recindexrecindex_t
 

Enumerations

enum  {
  recInfo_fileType, recInfo_filename, recInfo_delKeys, recInfo_databaseName,
  recInfo_storeData, recInfo_attr, recInfo_sortKeys
}
 

Functions

ZEBRA_RES rec_del (Records p, Record *recpp)
 marks record for deletion (on file storage) More...
 
void rec_free (Record *recpp)
 frees record (from memory) More...
 
ZEBRA_RES rec_put (Records p, Record *recpp)
 puts record (writes into file storage) More...
 
Record rec_new (Records p)
 creates new record (to be written to file storage) More...
 
Record rec_get (Records p, zint sysno)
 gets record - with given system number More...
 
Record rec_get_root (Records p)
 gets root record More...
 
Record rec_get_next (Records p, Record rec)
 gets next record - with given records More...
 
ZEBRA_RES rec_close (Records *p)
 
Records rec_open (BFiles bfs, int rw, int compression_method)
 opens records system More...
 
int rec_check_compression_method (int compression_method)
 check whether a compression method is supported More...
 
char * rec_strdup (const char *s, size_t *len)
 
void rec_prstat (Records p, int verbose)
 
zint rec_sysno_to_int (zint sysno)
 
recindex_t recindex_open (BFiles bfs, int rw, int use_isamb)
 opens record index handle More...
 
void recindex_close (recindex_t p)
 closes record index handle More...
 
int recindex_read_head (recindex_t p, void *buf)
 
const char * recindex_get_fname (recindex_t p)
 
ZEBRA_RES recindex_write_head (recindex_t p, const void *buf, size_t len)
 
int recindex_read_indx (recindex_t p, zint sysno, void *buf, int itemsize, int ignoreError)
 
void recindex_write_indx (recindex_t p, zint sysno, void *buf, int itemsize)
 

Macro Definition Documentation

#define REC_COMPRESS_BZIP2   1

BZIP2 compression (slow and requires big chunks)

Definition at line 113 of file recindex.h.

Referenced by rec_check_compression_method(), rec_flush_shared(), rec_get_int(), rec_open(), and zebra_register_open().

#define REC_COMPRESS_NONE   0

No compression ("none")

Definition at line 111 of file recindex.h.

Referenced by rec_check_compression_method(), rec_flush_shared(), rec_get_int(), and zebra_register_open().

#define REC_COMPRESS_ZLIB   2

zlib compression (faster and works off small chunks)

Definition at line 115 of file recindex.h.

Referenced by rec_check_compression_method(), rec_flush_shared(), rec_get_int(), and zebra_register_open().

#define REC_NO_INFO   8

Typedef Documentation

typedef struct recindex* recindex_t

Definition at line 128 of file recindex.h.

typedef struct record_info * Record
typedef struct records_info* Records

Definition at line 41 of file recindex.h.

Enumeration Type Documentation

anonymous enum
Enumerator
recInfo_fileType 
recInfo_filename 
recInfo_delKeys 
recInfo_databaseName 
recInfo_storeData 
recInfo_attr 
recInfo_sortKeys 

Definition at line 118 of file recindex.h.

Function Documentation

int rec_check_compression_method ( int  compression_method)

check whether a compression method is supported

Parameters
compression_method(REC_COMPRESS_..)
Return values
0if method is unsupported
1if method is supported

Definition at line 286 of file records.c.

References REC_COMPRESS_BZIP2, REC_COMPRESS_NONE, and REC_COMPRESS_ZLIB.

Referenced by zebra_register_open().

ZEBRA_RES rec_close ( Records p)
ZEBRA_RES rec_del ( Records  p,
Record recpp 
)

marks record for deletion (on file storage)

Parameters
precords handle
recpprecord pointer
Returns
ZEBRA_OK / ZEBRA_FAIL

Definition at line 1000 of file records.c.

References records_info::head, records_info::mutex, records_info::records_head::no_records, rec_cache_insert(), rec_cache_lookup(), rec_free(), recordFlagDelete, zebra_mutex_lock(), zebra_mutex_unlock(), and ZEBRA_OK.

Referenced by delete_w_all_handle(), zebra_extract_record_stream(), and zebraExplain_removeDatabase().

void rec_free ( Record recpp)
Record rec_get ( Records  p,
zint  sysno 
)
Record rec_get_next ( Records  p,
Record  rec 
)

gets next record - with given records

Parameters
precords handle
recrecord
Returns
record pointer (or NULL on error)

Definition at line 942 of file records.c.

References records_info::head, records_info::records_head::index_last, record_index_entry::next, rec_get(), rec_sysno_to_ext(), rec_sysno_to_int(), and record_info::sysno.

Referenced by zebra_register_check().

Record rec_get_root ( Records  p)

gets root record

Parameters
precords handle
Returns
record pointer (or NULL on error)

Definition at line 937 of file records.c.

References rec_get(), and rec_sysno_to_ext().

Referenced by zebra_register_check(), zebraExplain_open(), and zebraExplain_writeTarget().

Record rec_new ( Records  p)

creates new record (to be written to file storage)

Parameters
precords handle
Returns
record pointer (or NULL on error)

Definition at line 990 of file records.c.

References records_info::mutex, rec_new_int(), zebra_mutex_lock(), and zebra_mutex_unlock().

Referenced by createRecord(), zebra_extract_record_stream(), and zebraExplain_open().

Records rec_open ( BFiles  bfs,
int  rw,
int  compression_method 
)
void rec_prstat ( Records  p,
int  verbose 
)
ZEBRA_RES rec_put ( Records  p,
Record recpp 
)
char* rec_strdup ( const char *  s,
size_t *  len 
)

Definition at line 1079 of file records.c.

Referenced by createRecord(), zebra_extract_record_stream(), and zebraExplain_open().

zint rec_sysno_to_int ( zint  sysno)
void recindex_close ( recindex_t  p)

closes record index handle

Parameters
precords handle

Definition at line 182 of file recindex.c.

References bf_close(), recindex::index_BFile, recindex::isam_p, recindex::isamb, isamb_close(), isamb_dump(), isamb_set_root_ptr(), and log_pr().

Referenced by rec_close().

const char* recindex_get_fname ( recindex_t  p)

Definition at line 203 of file recindex.c.

References recindex::index_fname.

Referenced by rec_open().

recindex_t recindex_open ( BFiles  bfs,
int  rw,
int  use_isamb 
)

opens record index handle

Parameters
bfsBlock files handle
rw1 for read and write; 0 for read-only
use_isamb1 if ISAMB is to used for record index; 0 for flat (old)

Definition at line 134 of file recindex.c.

References bf_open(), ISAMC_M_s::codec, ISAMC_M_s::compare_item, ISAM_CODEC::decode, ISAM_CODEC::encode, recindex::index_BFile, recindex::index_fname, recindex::isam_p, recindex::isamb, isamb_get_root_ptr(), isamb_open2(), ISAMC_M_s::log_item, rect_code_reset(), rect_code_start(), rect_code_stop(), rect_compare(), rect_decode(), rect_encode(), rect_log_item(), ISAM_CODEC::reset, RIDX_CHUNK, ISAM_CODEC::start, and ISAM_CODEC::stop.

Referenced by rec_open().

int recindex_read_head ( recindex_t  p,
void *  buf 
)

Definition at line 198 of file recindex.c.

References bf_read(), and recindex::index_BFile.

Referenced by rec_open().

int recindex_read_indx ( recindex_t  p,
zint  sysno,
void *  buf,
int  itemsize,
int  ignoreError 
)
ZEBRA_RES recindex_write_head ( recindex_t  p,
const void *  buf,
size_t  len 
)

Definition at line 208 of file recindex.c.

References bf_write(), recindex::index_BFile, recindex::index_fname, ZEBRA_FAIL, and ZEBRA_OK.

Referenced by rec_close(), and rec_open().

void recindex_write_indx ( recindex_t  p,
zint  sysno,
void *  buf,
int  itemsize 
)