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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//! Everything is very preliminary, this crate is not yet at all stable.
pub use Data;
use Hash;
/// Value for Hash Map lookup.
/// Key for Hash Map lookup.
/// [PageSet] - keeps track of changed pages that need saving.
pub use *;
/// [HashMap] - maps keys to values using 64 bit hash.
pub use *;
/*
/// [Table] -- fixed size record storage. Divided into pages, each page stores up to 128 records.
pub mod table;
pub use table::*;
*/
/// [VarValAddr] -- storage of variable length values.
pub use *;
/// ToDo
pub use *;
/// [DataType] -- describes data type
pub use *;
/// [Value] -- generic instance of a data type
pub use *;
// Private modules.
/// [PageTree] - list of pages implemented as tree.
use *;
/// [TreeVec] -- a variable length list of bytes.
use *;
/// Hash Map Bucket - maps keys to values using 64 bit hash.
const PAGE_SIZE: u64 = 3952;
// pub const PAGE_SIZE: u64 = 3952;
// pub const PAGE_SIZE: u64 = 4612;
use Local;
/// `StringA<Local>`
pub type LString = StringA;
/// `VecA<T, Local>`
pub type LVec<T> = VecA;
/// `BoxA<T, Local>`
pub type LBox<T> = BoxA;
pub use Rc;
pub use Arc; // pstd::Arc does not yet have make_mut
/*
Could have multiple VarVarStores (each is a simple TreeVec).
When free space becomes significant (say 20%, or after a long time), garbage collect the store.
When the Store has been emptied, free all pages and add it to free slot list.
Note: large records (>16kb) are stored as TreeVec not in a VarValStore.
Stores should be limited to some reasonable size, say 4MB.
Index into store is then 22 bits. Index into Store TreeVec can be 32 bits.
This means garbage collecting a store is reasonably cheap.
To Access a Store, we first get the Meta info using a TreeVec.
Meta Data for store:
Total Free Bytes, TreeVec root and length, Next free Slot.
Global Info: TreeVec ( root + length ).
Header : First Free Slot, Number of Slots, Current Store (index).
Table module is no longer used.
*/
/* Next step : some kind of global catalog. Each object has
schema
name
An object can be a table, an index (for a table), a datatype, a function.
Schemas are just names, and have a schema = 0.
*/