xref: /plan9/sys/src/libndb/ndbhf.h (revision 9a747e4fd48b9f4522c70c07e8f882a15030f964)
1 /* a hash file */
2 struct Ndbhf
3 {
4 	Ndbhf	*next;
5 
6 	int	fd;
7 	ulong	dbmtime;	/* mtime of data base */
8 	int	hlen;		/* length (in entries) of hash table */
9 	char	attr[Ndbalen];	/* attribute hashed */
10 
11 	uchar	buf[256];	/* hash file buffer */
12 	long	off;		/* offset of first byte of buffer */
13 	int	len;		/* length of valid data in buffer */
14 };
15 
16 char*		_ndbparsetuple(char*, Ndbtuple**);
17 Ndbtuple*	_ndbparseline(char*);
18 
19 #define ISWHITE(x) ((x) == ' ' || (x) == '\t' || (x) == '\r')
20 #define EATWHITE(x) while(ISWHITE(*(x)))(x)++
21 
22 extern Ndbtuple *_ndbtfree;
23 
24 /* caches */
25 void	_ndbcacheflush(Ndb *db);
26 int	_ndbcachesearch(Ndb *db, Ndbs *s, char *attr, char *val, Ndbtuple **t);
27 Ndbtuple* _ndbcacheadd(Ndb *db, Ndbs *s, char *attr, char *val, Ndbtuple *t);
28