CUBRID Engine
latest
|
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <stddef.h>
#include "utility.h"
#include "error_manager.h"
#include "file_hash.h"
#include "filesys_temp.hpp"
#include "memory_alloc.h"
#include "object_representation.h"
#include "message_catalog.h"
Go to the source code of this file.
Macros | |
#define | ISPOWER2(x) (((x) & (x-1)) == 0) |
#define | NPRIMES 100 |
Functions | |
static int | fh_calculate_htsize (int htsize) |
static FH_PAGE_HDR * | fh_fetch_page (FH_TABLE *ht, int page) |
static FH_PAGE_HDR * | fh_read_page (FH_TABLE *ht, int page) |
static FH_PAGE_HDR * | fh_write_page (FH_TABLE *ht, FH_PAGE_HDR *pg_hdr) |
static void | fh_bitset (FH_TABLE *ht, int page) |
static int | fh_bittest (FH_TABLE *ht, int page) |
FH_TABLE * | fh_create (const char *name, int est_size, int page_size, int cached_pages, const char *hash_filename, FH_KEY_TYPE key_type, int data_size, HASH_FUNC hfun, CMP_FUNC cmpfun) |
void | fh_destroy (FH_TABLE *ht) |
int | fh_get (FH_TABLE *ht, FH_KEY key, FH_DATA *data) |
int | fh_put (FH_TABLE *ht, FH_KEY key, FH_DATA data) |
void | fh_dump (FH_TABLE *ht) |
Variables | |
static OID | null_oid |
static int | null_int |
static int | fh_Primes [NPRIMES] |
#define ISPOWER2 | ( | x | ) | (((x) & (x-1)) == 0) |
Definition at line 48 of file file_hash.c.
Referenced by fh_calculate_htsize().
#define NPRIMES 100 |
Definition at line 66 of file file_hash.c.
Referenced by fh_calculate_htsize().
|
static |
Definition at line 786 of file file_hash.c.
References fh_table::bitmap.
Referenced by fh_write_page().
|
static |
Definition at line 804 of file file_hash.c.
References fh_table::bitmap, fh_table::bitmap_size, and NULL.
Referenced by fh_read_page().
|
static |
Definition at line 101 of file file_hash.c.
References CEIL_PTVDIV, fh_Primes, ISPOWER2, and NPRIMES.
Referenced by fh_create().
FH_TABLE* fh_create | ( | const char * | name, |
int | est_size, | ||
int | page_size, | ||
int | cached_pages, | ||
const char * | hash_filename, | ||
FH_KEY_TYPE | key_type, | ||
int | data_size, | ||
HASH_FUNC | hfun, | ||
CMP_FUNC | cmpfun | ||
) |
Definition at line 164 of file file_hash.c.
References fh_table::bitmap, fh_table::bitmap_size, cached_pages, fh_table::cached_pages, fh_table::cmpfun, fh_table::data_size, DB_SIZEOF, fh_table::entries_per_page, fh_table::entry_size, est_size, fh_table::fd, fh_calculate_htsize(), fh_destroy(), fh_page_hdr::fh_entries, FH_INT_KEY, fh_intk_data, FH_OID_KEY, fh_oidk_data, fh_table::hash_filename, fh_table::hfun, INVALID_FILE_POS, fh_table::key_type, MIGDB_MSG_FH_HASH_FILENAME, MSGCAT_CATALOG_UTILS, msgcat_message(), MSGCAT_UTIL_SET_MIGDB, fh_table::name, fh_table::ncollisions, fh_table::nentries, fh_page_hdr::next, NULL, null_int, filesys::open_temp_filedes(), OR_PUT_NULL_OID, fh_table::overflow, fh_page_hdr::page, page_size, fh_table::page_size, fh_table::pg_hdr, fh_table::pg_hdr_alloc, fh_table::pg_hdr_free, fh_table::pg_hdr_last, fh_page_hdr::prev, fh_table::size, and strdup().
Referenced by extract_objects().
void fh_destroy | ( | FH_TABLE * | ht | ) |
Definition at line 310 of file file_hash.c.
References fh_table::bitmap, fh_table::fd, fh_page_hdr::fh_entries, free_and_init, fh_table::hash_filename, fh_page_hdr::next, fh_table::pg_hdr, and fh_table::pg_hdr_alloc.
Referenced by extractobjects_cleanup(), and fh_create().
void fh_dump | ( | FH_TABLE * | ht | ) |
Definition at line 833 of file file_hash.c.
References fh_table::bitmap, fh_table::bitmap_size, fh_table::cached_pages, fh_table::data_size, fh_table::entries_per_page, fh_table::entry_size, FH_OID_KEY, fh_table::hash_filename, fh_table::key_type, MIGDB_MSG_FH_CACHED_PAGES, MIGDB_MSG_FH_DATA_SIZE, MIGDB_MSG_FH_ENTRIES_PER_PAGE, MIGDB_MSG_FH_ENTRY_SIZE, MIGDB_MSG_FH_FREE_PAGE_HEADER, MIGDB_MSG_FH_HASH_FILENAME2, MIGDB_MSG_FH_KEY_TYPE, MIGDB_MSG_FH_LAST_PAGE_HEADER, MIGDB_MSG_FH_NAME, MIGDB_MSG_FH_NEXT_OVERFLOW_ENTRY, MIGDB_MSG_FH_NUM_COLLISIONS, MIGDB_MSG_FH_NUM_ENTRIES, MIGDB_MSG_FH_PAGE_BITMAP, MIGDB_MSG_FH_PAGE_BITMAP_SIZE, MIGDB_MSG_FH_PAGE_HEADERS, MIGDB_MSG_FH_PAGE_SIZE, MIGDB_MSG_FH_SIZE, MSGCAT_CATALOG_UTILS, msgcat_message(), MSGCAT_UTIL_SET_MIGDB, fh_table::name, fh_table::ncollisions, fh_table::nentries, fh_table::overflow, fh_table::page_size, fh_table::pg_hdr, fh_table::pg_hdr_free, and fh_table::pg_hdr_last.
Referenced by extractobjects_cleanup().
|
static |
Definition at line 576 of file file_hash.c.
References fh_table::cached_pages, fh_page_hdr::next, NULL, fh_page_hdr::page, fh_table::pg_hdr, fh_table::pg_hdr_last, and fh_page_hdr::prev.
Definition at line 353 of file file_hash.c.
References fh_table::cmpfun, fh_table::entries_per_page, fh_table::entry_size, ER_GENERIC_ERROR, fh_page_hdr::fh_entries, FH_INT_KEY, FH_OID_KEY, fh_table::hfun, fh_entry::info, INVALID_FILE_POS, fh_table::key_type, fh_entry::next, NO_ERROR, NULL, null_int, null_oid, and fh_table::size.
Referenced by process_value(), set_referenced_subclasses(), and update_hash().
Definition at line 449 of file file_hash.c.
References fh_table::cmpfun, fh_table::data_size, fh_table::entries_per_page, fh_table::entry_size, ER_GENERIC_ERROR, fh_page_hdr::fh_entries, FH_INT_KEY, FH_OID_KEY, fh_table::hfun, fh_entry::info, INVALID_FILE_POS, fh_table::key_type, fh_table::ncollisions, fh_table::nentries, fh_entry::next, NO_ERROR, NULL, null_int, null_oid, fh_table::overflow, and fh_table::size.
Referenced by extract_objects(), and update_hash().
|
static |
Definition at line 642 of file file_hash.c.
References COPY_OID, fh_table::entry_size, fh_table::fd, fh_bittest(), fh_page_hdr::fh_entries, FH_INT_KEY, FH_OID_KEY, i, fh_entry::info, INVALID_FILE_POS, fh_table::key_type, fh_entry::next, fh_page_hdr::next, NULL, null_int, fh_page_hdr::page, fh_table::page_size, fh_table::pg_hdr_free, and fh_table::pg_hdr_last.
|
static |
Definition at line 738 of file file_hash.c.
References fh_table::fd, fh_bitset(), fh_page_hdr::fh_entries, NULL, fh_page_hdr::page, and fh_table::page_size.
|
static |
Definition at line 68 of file file_hash.c.
Referenced by fh_calculate_htsize().
|
static |
Definition at line 51 of file file_hash.c.
Referenced by fh_create(), fh_get(), fh_put(), and fh_read_page().
|
static |
Definition at line 50 of file file_hash.c.
Referenced by fh_get(), fh_put(), heap_create_internal(), and pt_fold_const_expr().