[go: up one dir, main page]

Menu

[94a2b6]: / test / t3_tree.d  Maximize  Restore  History

Download this file

83 lines (63 with data), 2.3 kB

 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
/* VS4/Zrec - (formerly AVLDB) DataBase library/engine,
meta (cheat) file insert.
This file is part of VS4/zrec/avldb.
Copyright ⓒ 2022, 2023 Petr Silhavy <petr.silhavy@yandex.com>
VS4/Zrec is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
VS4/Zrec is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with zrec/avldb. If not, see <http://www.gnu.org/licenses/>.
*/
import std.stdio ;
import std.algorithm;
import std.range ;
import core.lifetime ;
import std.bitmanip ;
import std.random ;
import std.array : array;
import core.stdc.string : memset;
import std.format;
import zc_magic ;
import zc_rand;
import zc_ctypes ;
import tree ;
import block ;
import db ;
import malloc7 ;
int
main()
{
auto db = self_server("/v/db/test");
// auto r = new TavlR!C_STRUCT(db.meta_bh, &db.sb.files_table, TTP_OFFSET.TTP_META);
foreach ( k, v ; db.files )
writeln(k , " === ", v.name );
uint s = cast(uint) __traits(classInstanceSize, C_STRUCT ) ;
void[] ma = Zc_malloc(db.meta_bh, s );
void[] mb = Zc_malloc(db.meta_bh, s );
void[] mc = Zc_malloc(db.meta_bh, s );
void[] md = Zc_malloc(db.meta_bh, s );
C_STRUCT a = emplace!C_STRUCT(ma, "KYBL");
C_STRUCT b = emplace!C_STRUCT(mb, "FILE");
C_STRUCT c = emplace!C_STRUCT(mc, "stat");
C_STRUCT d = emplace!C_STRUCT(md, "PERSON");
db.files.insert( a ) ;
db.files.insert( b ) ;
db.files.insert( c ) ;
db.files.insert( d ) ;
// writeln("--------------------------------------------------------------");
// db.meta_fd.bkc.list();
// writeln("--------------------------------------------------------------");
// r[d.name] = d ;
// auto q = MostDerivedInputRange!(typeof(r.tt));
foreach ( k, v ; db.files )
writeln(k , " = ", v.name );
// if ( auto p = "KYBL" in r )
// writeln("IN: ", p);
db.destroy ;
return 0 ;
}