IDZEBRA  2.2.7
cfile.h
Go to the documentation of this file.
1 /* This file is part of the Zebra server.
2  Copyright (C) Index Data
3 
4 Zebra is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
7 version.
8 
9 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 for more details.
13 
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 
18 */
19 
20 
21 
22 #ifndef CFILE_H
23 #define CFILE_H
24 
25 #include <yaz/yconfig.h>
26 
27 YAZ_BEGIN_CDECL
28 
30 #define HASH_BUCKET 15
31 
38 };
39 
42  struct CFile_ph_bucket ph;
43  int dirty;
46 };
47 
48 #define HASH_BSIZE sizeof(struct CFile_ph_bucket)
49 
51 #define CFILE_STATE_HASH 1
52 
54 #define CFILE_STATE_FLAT 2
55 
57 struct CFile_head {
58  int state;
60  int block_size;
61  int hash_size;
65 };
66 
68 typedef struct CFile_struct
69 {
70  struct CFile_head head;
71 
78  int dirty;
81  char *iobuf;
83  int no_hits;
84  int no_miss;
86 } *CFile;
87 
88 int cf_close (CFile cf);
89 
90 CFile cf_open (MFile mf, MFile_area area, const char *fname, int block_size,
91  int wflag, int *firstp);
92 int cf_read (CFile cf, zint no, int offset, int nbytes, void *buf);
93 int cf_write (CFile cf, zint no, int offset, int nbytes, const void *buf);
94 int cf_commit (CFile cf) ZEBRA_GCC_ATTR((warn_unused_result));
95 
96 YAZ_END_CDECL
97 
98 #endif
99 /*
100  * Local variables:
101  * c-basic-offset: 4
102  * c-file-style: "Stroustrup"
103  * indent-tabs-mode: nil
104  * End:
105  * vim: shiftwidth=4 tabstop=8 expandtab
106  */
107 
CFile cf_open(MFile mf, MFile_area area, const char *fname, int block_size, int wflag, int *firstp)
Definition: cfile.c:82
struct CFile_struct * CFile
All in-memory information per CFile.
int cf_read(CFile cf, zint no, int offset, int nbytes, void *buf)
reads block from commit area
Definition: cfile.c:542
int cf_commit(CFile cf) ZEBRA_GCC_ATTR((warn_unused_result))
Definition: commit.c:257
int cf_write(CFile cf, zint no, int offset, int nbytes, const void *buf)
writes block to commit area
Definition: cfile.c:579
int cf_close(CFile cf)
Definition: cfile.c:616
#define HASH_BUCKET
number of blocks in hash bucket
Definition: cfile.h:30
CFile hash structure info in memory.
Definition: cfile.h:41
struct CFile_hash_bucket * lru_next
Definition: cfile.h:45
struct CFile_ph_bucket ph
Definition: cfile.h:42
struct CFile_hash_bucket * h_next
Definition: cfile.h:44
struct CFile_hash_bucket * lru_prev
Definition: cfile.h:45
struct CFile_hash_bucket ** h_prev
Definition: cfile.h:44
CFile file header.
Definition: cfile.h:57
int state
Definition: cfile.h:58
zint flat_bucket
Definition: cfile.h:64
int block_size
Definition: cfile.h:60
zint next_block
Definition: cfile.h:59
int hash_size
Definition: cfile.h:61
zint first_bucket
Definition: cfile.h:62
zint next_bucket
Definition: cfile.h:63
CFile hash structure on disc.
Definition: cfile.h:33
zint vno[HASH_BUCKET]
Definition: cfile.h:35
zint this_bucket
Definition: cfile.h:36
zint no[HASH_BUCKET]
Definition: cfile.h:34
zint next_bucket
Definition: cfile.h:37
All in-memory information per CFile.
Definition: cfile.h:69
int no_hits
Definition: cfile.h:83
MFile rmf
Definition: cfile.h:82
struct CFile_hash_bucket ** parray
Definition: cfile.h:75
struct CFile_hash_bucket * bucket_lru_back
Definition: cfile.h:77
int no_miss
Definition: cfile.h:84
Zebra_mutex mutex
Definition: cfile.h:85
struct CFile_hash_bucket * bucket_lru_front
Definition: cfile.h:76
zint max_bucket_in_memory
Definition: cfile.h:80
zint * array
Definition: cfile.h:74
MFile block_mf
Definition: cfile.h:72
char * iobuf
Definition: cfile.h:81
zint bucket_in_memory
Definition: cfile.h:79
struct CFile_head head
Definition: cfile.h:70
MFile hash_mf
Definition: cfile.h:73
int dirty
Definition: cfile.h:78
long zint
Zebra integer.
Definition: util.h:66
#define ZEBRA_GCC_ATTR(x)
Definition: util.h:41