⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 linear_hash.h

📁 数据库系统实现
💻 H
字号:
#define 	BLOCK_SIZE 				8192
#define 	BUCKET_SIZE 			BLOCK_SIZE
#define 	LONG_IN_BLOCK 			(BLOCK_SIZE/sizeof(long))
#define 	NTH_BLOCK_IN_BLOCK 		(LONG_IN_BLOCK/2)
#define 	HASH_SPACE 				((BUCKET_SIZE-2*sizeof(long))/sizeof(ITEM_IN_BUCKET))
#define 	BUCKET_BUFFER_SIZE 		100
#define 	DATA_BUFFER_SIZE 		100
#define 	NTH_BLOCK_BUFFER_SIZE	10
#define 	SATURATION_DEGREE 		(0.85)

typedef struct {
        long   	hkey_i;        	/*the last hkey_i bits*/
        long   	bucket_no;     	/*number of buckets*/
        long   	rcd_no;        	/*current number of records*/
        }HASH_INFO;           	/*important data items of hash table*/ 

typedef struct {
        long   blk_no;        /*block number*/
        long   offset;        /*offset in block*/
        }ADDR;                /*address structure*/
        
typedef struct {
        long   hkey;          /*h(key)*/
        ADDR   to_rcd;        /*pointer to record whose keynum is key*/ 
        }ITEM_IN_BUCKET;      /*item in buckets*/

typedef struct {
        ITEM_IN_BUCKET        hk_addr[HASH_SPACE];         /*items in a bucket*/
        long                  blk_no;                      /*overflowed bucket block number*/
        long                  rcd_no;                      /*current number of records in bucket*/
        }BUCKET;                                           /*items of bucket*/

typedef struct {
        long   nth_bucket;                                 	/*the nth bucket*/
        long   blk_no;                                     	/*the block number of nth bucket*/
        }BUCKET_BLOCK;                                  	/*relation between bucket and block*/
        
typedef struct {
		long	change_flag;			/* =1 changed =0 unchanged*/
		long 	nth_bucket;									
		long	from_blk_no;
		BUCKET	buk;
		}BUCKET_BUF;
		
typedef struct {
		long	change_flag;
		long	from_blk_no;
		long	key[LONG_IN_BLOCK];
		}DATA_BUF;
		
typedef struct {
		long	change_flag;
		long 	from_blk_no;
		BUCKET_BLOCK	nth_blk[NTH_BLOCK_IN_BLOCK];
		}NTH_BLOCK_BUF;
		

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -