~vkolesnikov/pbxt/pbxt-preload-test-bug

« back to all changes in this revision

Viewing changes to pbxt/src/cache_xt.h

  • Committer: paul-mccullagh
  • Date: 2008-03-10 11:36:34 UTC
  • Revision ID: paul-mccullagh-417ebf175a9c8ee6e5b3777d9e2398e1fb197391
Implemented full durability

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2005 SNAP Innovation GmbH
 
1
/* Copyright (c) 2005 PrimeBase Technologies GmbH
2
2
 *
3
3
 * PrimeBase XT
4
4
 *
33
33
//#define XT_USE_CACHE_DEBUG_SIZES
34
34
#endif
35
35
 
36
 
#define XT_DC_BLOCK_SHIFTS                      XT_PAGE_SIZE_SHIFTS
37
 
 
38
36
#ifdef XT_USE_CACHE_DEBUG_SIZES
39
37
 
40
 
#define XT_DC_FILE_SLOTS                        5
41
 
#define XT_DC_SEGMENT_SHIFTS            1
42
 
#define XT_DC_MAX_FLUSH_SEG_COUNT       10
43
 
#define XT_DC_MAX_FREE_COUNT            10
44
 
 
45
 
#define XT_RC_FILE_SLOTS                        5
46
 
#define XT_RC_SEGMENT_SHIFTS            1
 
38
#define XT_INDEX_CACHE_FILE_SLOTS                       5
 
39
#define XT_INDEX_CACHE_SEGMENT_SHIFTS           1
 
40
#define XT_INDEX_CACHE_MAX_FLUSH_SEG_CNT        10
 
41
#define XT_INDEX_CACHE_MAX_FREE_COUNT           10
47
42
 
48
43
#else
49
44
 
50
 
#define XT_DC_FILE_SLOTS                        71
51
 
#define XT_DC_SEGMENT_SHIFTS            3
52
 
#define XT_DC_MAX_FLUSH_SEG_COUNT       250
53
 
#define XT_DC_MAX_FREE_COUNT            100
54
 
 
55
 
#define XT_RC_FILE_SLOTS                        71
56
 
#define XT_RC_SEGMENT_SHIFTS            3
 
45
#define XT_INDEX_CACHE_FILE_SLOTS                       71
 
46
#define XT_INDEX_CACHE_SEGMENT_SHIFTS           3
 
47
#define XT_INDEX_CACHE_MAX_FLUSH_SEG_CNT        250
 
48
#define XT_INDEX_CACHE_MAX_FREE_COUNT           100
57
49
 
58
50
#endif
59
51
 
60
 
#define XT_DC_BLOCK_SIZE                        (1 << XT_DC_BLOCK_SHIFTS)
61
 
#define XT_DC_BLOCK_MASK                        (XT_DC_BLOCK_SIZE - 1)
62
 
 
63
 
void    xt_dc_init(XTThreadPtr self, size_t cache_size);
64
 
void    xt_dc_exit(XTThreadPtr self);
65
 
xtBool  xt_dc_flush(XTOpenFilePtr file);
66
 
xtBool  xt_dc_write(XTOpenFilePtr file, off_t offset, size_t size, xtWord1 *data);
67
 
xtBool  xt_dc_write_thru(XTOpenFilePtr file, off_t offset, size_t size, xtWord1 *data);
68
 
xtBool  xt_dc_read(XTOpenFilePtr file, off_t offset, size_t size, xtWord1 *data);
69
 
xtBool  xt_dc_read_8(XTOpenFilePtr file, off_t offset, xtWord8 *data);
70
 
xtBool  xt_dc_read_block(XTOpenFilePtr file, off_t offset, xtWord1 *data);
71
 
void    xt_dc_check_cache(void);
 
52
void    xt_ind_init(XTThreadPtr self, size_t cache_size);
 
53
void    xt_ind_exit(XTThreadPtr self);
 
54
xtInt8  xt_ind_get_usage();
 
55
xtInt8  xt_ind_get_size();
 
56
xtBool  xt_ind_flush(XTOpenFilePtr file, xtBool *something_written);
 
57
xtBool  xt_ind_write(XTOpenFilePtr file, off_t offset, size_t size, xtWord1 *data);
 
58
xtBool  xt_ind_write_thru(XTOpenFilePtr file, off_t offset, size_t size, xtWord1 *data);
 
59
xtBool  xt_ind_read(XTOpenFilePtr file, off_t offset, size_t size, xtWord1 *data);
 
60
xtBool  xt_ind_read_8(XTOpenFilePtr file, off_t offset, xtWord8 *data);
 
61
xtBool  xt_ind_read_block(XTOpenFilePtr file, off_t offset, xtWord1 *data);
 
62
void    xt_ind_check_cache(void);
72
63
 
73
64
#ifdef DEBUG
74
65
#define DEBUG_CHECK_CACHE
75
66
#endif
76
67
 
77
 
void xt_rc_init(XTThreadPtr self, size_t cache_size);
78
 
void xt_rc_exit(XTThreadPtr self);
79
 
 
80
 
xtBool xt_rc_write(struct XTOpenTable *ot, off_t address, size_t size, xtWord1 *data);
81
 
xtBool xt_rc_read(struct XTOpenTable *ot, off_t address, size_t size, xtWord1 *data);
82
 
xtBool xt_rc_read_record(register struct XTOpenTable *ot, off_t address, size_t size, xtWord1 *data);
83
 
 
84
68
#endif