IDZEBRA  2.2.7
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

◆ REC_COMPRESS_BZIP2

#define REC_COMPRESS_BZIP2   1

BZIP2 compression (slow and requires big chunks)

Definition at line 113 of file recindex.h.

◆ REC_COMPRESS_NONE

#define REC_COMPRESS_NONE   0

No compression ("none")

Definition at line 111 of file recindex.h.

◆ REC_COMPRESS_ZLIB

#define REC_COMPRESS_ZLIB   2

zlib compression (faster and works off small chunks)

Definition at line 115 of file recindex.h.

◆ REC_NO_INFO

#define REC_NO_INFO   8

Definition at line 29 of file recindex.h.

Typedef Documentation

◆ recindex_t

typedef struct recindex* recindex_t

Definition at line 128 of file recindex.h.

◆ Record

typedef struct record_info * Record

◆ Records

typedef struct records_info* Records

Definition at line 41 of file recindex.h.

Enumeration Type Documentation

◆ anonymous enum

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

◆ rec_check_compression_method()

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 287 of file records.c.

References REC_COMPRESS_BZIP2, REC_COMPRESS_NONE, and REC_COMPRESS_ZLIB.

Referenced by zebra_register_open().

◆ rec_close()

ZEBRA_RES rec_close ( Records p)

◆ rec_del()

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

◆ rec_free()

void rec_free ( Record recpp)

◆ rec_get()

Record rec_get ( Records  p,
zint  sysno 
)

◆ rec_get_next()

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

◆ rec_get_root()

Record rec_get_root ( Records  p)

gets root record

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

Definition at line 938 of file records.c.

References rec_get(), and rec_sysno_to_ext().

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

◆ rec_new()

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

◆ rec_open()

Records rec_open ( BFiles  bfs,
int  rw,
int  compression_method 
)

◆ rec_prstat()

void rec_prstat ( Records  p,
int  verbose 
)

◆ rec_put()

ZEBRA_RES rec_put ( Records  p,
Record recpp 
)

◆ rec_strdup()

char* rec_strdup ( const char *  s,
size_t *  len 
)

Definition at line 1080 of file records.c.

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

◆ rec_sysno_to_int()

zint rec_sysno_to_int ( zint  sysno)

◆ recindex_close()

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

◆ recindex_get_fname()

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

◆ recindex_read_head()

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

◆ recindex_read_indx()

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

◆ recindex_write_head()

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

◆ recindex_write_indx()

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