cache-database.h 1.25 KB
Newer Older
Pontus Hagland's avatar
Pontus Hagland committed
1
2
3
4
5
/*
 * cache-database - header
 *
 * cache: Database low-level driver
 *
Per Cederqvist's avatar
Per Cederqvist committed
6
 * Copyright (C) Pontus Hagland 1993-10-07
Pontus Hagland's avatar
Pontus Hagland committed
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
 *
 */

#define DEFEATSIZE 32
#define DEFEATSTRING "Lyskom from Lysator - PH 931007"
                   /* 01234567890123456789012345678901 */

struct cachebaseheader
{
   unsigned long blocksize;
   unsigned long highblock;
   unsigned long highnumber;
   unsigned long blockgeneration;
   time_t ts_created;
   time_t ts_written;
   unsigned long hex01234567,hex89abcdef,sizeofint,sizeoflong;
};

struct cachebase /* use only internal in cache-database.c */
{
   FILE *fp;
   FILE *ifp;
   char *filename;
   char *indexname;
   unsigned long writeonblock;
   struct cb_blocklist *freelist;
   struct cb_blocklist *regenlist;
   struct cachebaseheader header;
   unsigned long active_records;
};


/* function definitions */

struct cachebase *
   cb_open(char *filename,char *indexname,unsigned int blocksize);

void
   cb_close(struct cachebase *cb);

void
   cb_writerecord(struct cachebase *cb,
		  unsigned long no,
		  void *buffert,
		  unsigned int size);

void *
   cb_getrecord(struct cachebase *cb,
		unsigned long no);

void 
   cb_eraserecord(struct cachebase *cb,
		  unsigned long no);

unsigned long
   cb_nextnumber(struct cachebase *cb);