|
IDZEBRA 2.2.8
|
#include <stdio.h>#include <stdlib.h>#include <assert.h>#include <string.h>#include <yaz/yaz-util.h>#include <yaz/snprintf.h>#include <idzebra/bfile.h>#include "recindex.h"Go to the source code of this file.
Data Structures | |
| struct | records_info |
| struct | records_info::records_head |
| struct | record_cache_entry |
| struct | record_index_entry |
Macros | |
| #define | REC_BLOCK_TYPES 2 |
| #define | REC_HEAD_MAGIC "recindex" |
| #define | REC_VERSION 5 |
| #define | FAKE_OFFSET 0 |
| #define | USUAL_RANGE 6000000000LL |
Enumerations | |
| enum | recordCacheFlag { recordFlagNop , recordFlagWrite , recordFlagNew , recordFlagDelete } |
Functions | |
| Record | rec_cp (Record rec) |
| static zint | rec_sysno_to_ext (zint sysno) |
| zint | rec_sysno_to_int (zint sysno) |
| static void | rec_tmp_expand (Records p, int size) |
| static ZEBRA_RES | rec_release_blocks (Records p, zint sysno) |
| static ZEBRA_RES | rec_delete_single (Records p, Record rec) |
| static ZEBRA_RES | rec_write_tmp_buf (Records p, int size, zint *sysnos) |
| int | rec_check_compression_method (int compression_method) |
| check whether a compression method is supported | |
| Records | rec_open (BFiles bfs, int rw, int compression_method) |
| opens records system | |
| static void | rec_encode_unsigned (unsigned n, unsigned char *buf, int *len) |
| static void | rec_decode_unsigned (unsigned *np, unsigned char *buf, int *len) |
| static void | rec_encode_zint (zint n, unsigned char *buf, int *len) |
| static void | rec_decode_zint (zint *np, unsigned char *buf, int *len) |
| static void | rec_cache_flush_block1 (Records p, Record rec, Record last_rec, char **out_buf, int *out_size, int *out_offset) |
| static ZEBRA_RES | rec_flush_shared (Records p, short ref_count, zint *sysnos, char *out_buf, int out_offset) |
| static ZEBRA_RES | rec_write_multiple (Records p, int saveCount) |
| static ZEBRA_RES | rec_cache_flush (Records p, int saveCount) |
| static Record * | rec_cache_lookup (Records p, zint sysno, enum recordCacheFlag flag) |
| static ZEBRA_RES | rec_cache_insert (Records p, Record rec, enum recordCacheFlag flag) |
| ZEBRA_RES | rec_close (Records *pp) |
| static Record | rec_get_int (Records p, zint sysno) |
| Record | rec_get (Records p, zint sysno) |
| gets record - with given system number | |
| Record | rec_get_root (Records p) |
| gets root record | |
| Record | rec_get_next (Records p, Record rec) |
| gets next record - with given records | |
| static Record | rec_new_int (Records p) |
| Record | rec_new (Records p) |
| creates new record (to be written to file storage) | |
| ZEBRA_RES | rec_del (Records p, Record *recpp) |
| marks record for deletion (on file storage) | |
| ZEBRA_RES | rec_put (Records p, Record *recpp) |
| puts record (writes into file storage) | |
| void | rec_free (Record *recpp) |
| frees record (from memory) | |
| char * | rec_strdup (const char *s, size_t *len) |
| void | rec_prstat (Records records, int verbose) |
| enum recordCacheFlag |
Definition at line 653 of file records.c.
References records_info::cache_cur, record_cache_entry::rec, rec_free(), rec_write_multiple(), and records_info::record_cache.
Referenced by rec_cache_insert(), and rec_close().
|
static |
Definition at line 463 of file records.c.
References CAST_ZINT_TO_INT, record_info::info, record_cache_entry::rec, rec_encode_unsigned(), rec_encode_zint(), REC_NO_INFO, rec_sysno_to_int(), record_info::size, and record_info::sysno.
Referenced by rec_write_multiple().
|
static |
Definition at line 693 of file records.c.
References records_info::cache_cur, records_info::cache_max, records_info::compression_chunk_size, record_cache_entry::flag, record_cache_entry::rec, rec_cache_flush(), rec_cp(), REC_NO_INFO, records_info::record_cache, record_info::size, and ZEBRA_OK.
Referenced by rec_del(), rec_get_int(), rec_new_int(), and rec_put().
|
static |
Definition at line 676 of file records.c.
References records_info::cache_cur, record_cache_entry::flag, record_cache_entry::rec, records_info::record_cache, recordFlagNop, and record_info::sysno.
Referenced by rec_del(), rec_get_int(), and rec_put().
| int rec_check_compression_method | ( | int | compression_method | ) |
check whether a compression method is supported
| compression_method | (REC_COMPRESS_..) |
| 0 | if method is unsupported |
| 1 | if 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().
Definition at line 721 of file records.c.
References bf_close(), records_info::data_BFile, records_info::data_fname, records_info::head, records_info::mutex, REC_BLOCK_TYPES, rec_cache_flush(), records_info::recindex, recindex_close(), recindex_write_head(), records_info::record_cache, records_info::rw, records_info::tmp_buf, ZEBRA_FAIL, zebra_mutex_destroy(), and ZEBRA_OK.
Referenced by rec_open(), and zebra_register_close().
Definition at line 1056 of file records.c.
References record_info::info, REC_NO_INFO, record_info::size, and record_info::sysno.
Referenced by rec_cache_insert(), and rec_get_int().
|
static |
Definition at line 416 of file records.c.
Referenced by rec_get_int().
|
static |
Definition at line 446 of file records.c.
Referenced by rec_get_int().
marks record for deletion (on file storage)
| p | records handle |
| recpp | record pointer |
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().
Definition at line 209 of file records.c.
References records_info::head, records_info::records_head::index_free, record_index_entry::next, rec_release_blocks(), rec_sysno_to_int(), records_info::recindex, recindex_write_indx(), record_index_entry::size, record_info::sysno, ZEBRA_FAIL, and ZEBRA_OK.
Referenced by rec_write_multiple().
|
static |
Definition at line 403 of file records.c.
Referenced by rec_cache_flush_block1().
|
static |
Definition at line 433 of file records.c.
Referenced by rec_cache_flush_block1().
|
static |
Definition at line 513 of file records.c.
References records_info::compression_method, REC_COMPRESS_BZIP2, REC_COMPRESS_NONE, REC_COMPRESS_ZLIB, rec_tmp_expand(), rec_write_tmp_buf(), records_info::tmp_buf, ZEBRA_FAIL, and ZEBRA_OK.
Referenced by rec_write_multiple().
| void rec_free | ( | Record * | recpp | ) |
frees record (from memory)
| recpp | record pointer |
Definition at line 1044 of file records.c.
References REC_NO_INFO.
Referenced by perform_facet_index(), rec_cache_flush(), rec_del(), rec_put(), rpn_search_APT_local(), zebra_create_record_stream(), zebra_extract_record_stream(), zebra_get_rec_snippets(), zebra_record_fetch(), zebra_register_check(), zebra_special_fetch(), zebraExplain_open(), zebraExplain_readAttributeDetails(), and zebraExplain_readDatabase().
gets record - with given system number
| p | records handle |
| sysno | system ID (external number) |
Definition at line 928 of file records.c.
References records_info::mutex, rec_get_int(), zebra_mutex_lock(), and zebra_mutex_unlock().
Referenced by createRecord(), delete_w_all_handle(), perform_facet_index(), rec_get_next(), rec_get_root(), rpn_search_APT_local(), zebra_extract_record_stream(), zebra_get_rec_snippets(), zebra_record_fetch(), zebra_special_fetch(), zebraExplain_readAttributeDetails(), zebraExplain_readDatabase(), and zebraExplain_removeDatabase().
Definition at line 756 of file records.c.
References bf_read(), records_info::records_head::block_size, records_info::data_BFile, records_info::head, record_info::info, record_index_entry::next, record_cache_entry::rec, REC_BLOCK_TYPES, rec_cache_insert(), rec_cache_lookup(), REC_COMPRESS_BZIP2, REC_COMPRESS_NONE, REC_COMPRESS_ZLIB, rec_cp(), rec_decode_unsigned(), rec_decode_zint(), REC_NO_INFO, rec_sysno_to_int(), rec_tmp_expand(), records_info::recindex, recindex_read_indx(), recordFlagNop, record_index_entry::size, record_info::size, record_info::sysno, records_info::tmp_buf, and ZEBRA_OK.
Referenced by rec_get().
gets next record - with given records
| p | records handle |
| rec | record |
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().
gets root record
| p | records handle |
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().
creates new record (to be written to file storage)
| p | records handle |
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().
Definition at line 958 of file records.c.
References records_info::head, records_info::records_head::index_free, records_info::records_head::index_last, record_info::info, record_index_entry::next, records_info::records_head::no_records, rec_cache_insert(), REC_NO_INFO, rec_sysno_to_ext(), records_info::recindex, recindex_read_indx(), recordFlagNew, record_info::size, and record_info::sysno.
Referenced by rec_new().
opens records system
| bfs | block file storage |
| rw | read-write flag(0=read only, 1=write) |
| compression_method | REC_COMPRESS_ type |
Definition at line 309 of file records.c.
References bf_open(), records_info::records_head::block_free, records_info::records_head::block_last, records_info::records_head::block_move, records_info::records_head::block_size, records_info::records_head::block_used, records_info::cache_cur, records_info::cache_max, CAST_ZINT_TO_INT, records_info::compression_chunk_size, records_info::compression_method, records_info::data_BFile, records_info::data_fname, records_info::head, records_info::records_head::index_free, records_info::records_head::index_last, records_info::records_head::magic, records_info::mutex, records_info::records_head::no_records, REC_BLOCK_TYPES, rec_close(), REC_COMPRESS_BZIP2, REC_HEAD_MAGIC, REC_VERSION, records_info::recindex, recindex_get_fname(), recindex_open(), recindex_read_head(), recindex_write_head(), records_info::record_cache, records_info::rw, records_info::tmp_buf, records_info::tmp_size, records_info::records_head::total_bytes, records_info::records_head::version, ZEBRA_FAIL, zebra_mutex_init(), and ZEBRA_OK.
Referenced by zebra_register_open().
| void rec_prstat | ( | Records | records, |
| int | verbose | ||
| ) |
Definition at line 1095 of file records.c.
References bf_read(), records_info::records_head::block_free, records_info::records_head::block_last, records_info::records_head::block_size, records_info::records_head::block_used, records_info::data_BFile, records_info::data_fname, records_info::head, records_info::records_head::no_records, REC_BLOCK_TYPES, records_info::records_head::total_bytes, ZINT_FORMAT, and ZINT_FORMAT0.
Referenced by zebra_register_statistics().
puts record (writes into file storage)
| p | records handle |
| recpp | record pointer |
Definition at line 1023 of file records.c.
References records_info::mutex, rec_cache_insert(), rec_cache_lookup(), rec_free(), recordFlagWrite, zebra_mutex_lock(), zebra_mutex_unlock(), and ZEBRA_OK.
Referenced by zebra_extract_record_stream(), zebraExplain_open(), zebraExplain_writeAttributeDetails(), zebraExplain_writeAttributeSet(), zebraExplain_writeCategoryList(), zebraExplain_writeDatabase(), and zebraExplain_writeTarget().
Definition at line 148 of file records.c.
References bf_read(), bf_write(), records_info::records_head::block_free, records_info::records_head::block_used, CAST_ZINT_TO_INT, records_info::data_BFile, records_info::head, record_index_entry::next, REC_BLOCK_TYPES, records_info::recindex, recindex_read_indx(), record_index_entry::size, records_info::records_head::total_bytes, ZEBRA_FAIL, and ZEBRA_OK.
Referenced by rec_delete_single(), and rec_write_multiple().
| 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().
Definition at line 124 of file records.c.
References FAKE_OFFSET, and USUAL_RANGE.
Referenced by rec_get_next(), rec_get_root(), and rec_new_int().
Definition at line 130 of file records.c.
References FAKE_OFFSET, and USUAL_RANGE.
Referenced by rec_cache_flush_block1(), rec_delete_single(), rec_get_int(), rec_get_next(), rec_write_multiple(), and zebra_sort_sysno().
|
static |
Definition at line 136 of file records.c.
References records_info::records_head::block_size, records_info::head, REC_BLOCK_TYPES, records_info::tmp_buf, and records_info::tmp_size.
Referenced by rec_flush_shared(), and rec_get_int().
Definition at line 596 of file records.c.
References records_info::cache_cur, record_cache_entry::flag, record_cache_entry::rec, rec_cache_flush_block1(), rec_delete_single(), rec_flush_shared(), rec_release_blocks(), rec_sysno_to_int(), records_info::record_cache, recordFlagDelete, recordFlagNew, recordFlagNop, recordFlagWrite, record_info::sysno, ZEBRA_FAIL, and ZEBRA_OK.
Referenced by rec_cache_flush().
Definition at line 225 of file records.c.
References bf_read(), bf_write(), records_info::records_head::block_free, records_info::records_head::block_last, records_info::records_head::block_move, records_info::records_head::block_size, records_info::records_head::block_used, CAST_ZINT_TO_INT, records_info::data_BFile, records_info::data_fname, records_info::head, record_index_entry::next, REC_BLOCK_TYPES, records_info::recindex, recindex_write_indx(), record_index_entry::size, records_info::tmp_buf, records_info::records_head::total_bytes, ZEBRA_FAIL, ZEBRA_OK, and ZINT_FORMAT.
Referenced by rec_flush_shared().