summaryrefslogtreecommitdiffstats
path: root/src/H5ACprivate.h
blob: 9d10f1929a5246ed90fdb8918204e00f5fe9df75 (plain)
1
2
3
4
5
6
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
64
65
66
67
68
69
70
71
72
/*-------------------------------------------------------------------------
 * Copyright (C) 1997	National Center for Supercomputing Applications.
 *                      All rights reserved.
 *
 *-------------------------------------------------------------------------
 *
 * Created:		H5ACprivate.h
 * 			Jul  9 1997
 * 			Robb Matzke <robb@maya.nuance.com>
 *
 * Purpose:		Constants and typedefs available to the rest of the
 *			library.
 *
 * Modifications:	
 *
 *-------------------------------------------------------------------------
 */
#ifndef _H5ACprivate_H
#define _H5ACprivate_H

#include "H5ACproto.h"		/*public prototypes			*/
#include "H5Fprivate.h"		/*for private hdf5_file_t definition 	*/

/*
 * Class methods pertaining to caching.  Each type of cached object will
 * have a constant variable with permanent life-span that describes how
 * to cache the object.  That variable will be of type H5AC_class_t and
 * have the following required fields...
 *
 * LOAD:	Loads an object from disk to memory.  The function
 *		should allocate some data structure and return it.
 *
 * FLUSH:	Writes some data structure back to disk.  It would be
 *		wise for the data structure to include dirty flags to
 *		indicate whether it really needs to be written.  This
 *		function is also responsible for freeing memory allocated
 *		by the LOAD method if the DEST argument is non-zero.
 */
typedef struct H5AC_class_t {
   void		*(*load)(hdf5_file_t*, haddr_t addr, const void *udata);
   herr_t	(*flush)(hdf5_file_t*, hbool_t dest, haddr_t addr,
			 void *thing);
} H5AC_class_t;

/*
 * A cache has a certain number of entries.  Objects are mapped into a
 * cache entry by hashing the object's file address.  Each file has its
 * own cache, an array of slots.
 */
#define H5AC_NSLOTS	1033	/*prime number tend to work best	*/

typedef struct H5AC_cache_t {
   const H5AC_class_t *type;	/*type of object stored here		*/
   haddr_t	addr;		/*file address for object		*/
   void		*thing;		/*the thing which is cached		*/
} H5AC_cache_t;

/*
 * Library prototypes.
 */
herr_t H5AC_dest (hdf5_file_t *f);
void *H5AC_find (hdf5_file_t *f, const H5AC_class_t *type, haddr_t addr,
		 const void *udata);
herr_t H5AC_flush (hdf5_file_t *f, const H5AC_class_t *type, haddr_t addr,
		   hbool_t destroy);
herr_t H5AC_new (hdf5_file_t *f);
herr_t H5AC_rename (hdf5_file_t *f, const H5AC_class_t *type,
		    haddr_t old, haddr_t new);
herr_t H5AC_set (hdf5_file_t *f, const H5AC_class_t *type, haddr_t addr,
		 void *thing);

#endif /* !_H5ACprivate_H */