tangled
alpha
login
or
join now
freshlybakedca.ke
/
git
5
fork
atom
Git fork
5
fork
atom
overview
issues
pulls
2
pipelines
feat: finish reftable-table.h and start iter.h
thecoded.prof
2 months ago
e3f08e62
59f671fe
verified
This commit was signed with the committer's
known signature
.
thecoded.prof
SSH Key Fingerprint:
SHA256:ePn0u8NlJyz3J4Zl9MHOYW3f4XKoi5K1I4j53bwpG0U=
+144
-2
5 changed files
expand all
collapse all
unified
split
src
reftable
basics.rs
iter.rs
mod.rs
reftable_iterator.rs
reftable_table.rs
+6
src/reftable/basics.rs
···
62
62
pub fn hash_size(id: HashAlgorithm) -> u32 {
63
63
todo!()
64
64
}
65
65
+
66
66
+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
67
67
+
pub enum ReftableHash {
68
68
+
ReftableHashSha1 = 89,
69
69
+
ReftableHashSha256 = 247,
70
70
+
}
+66
src/reftable/iter.rs
···
1
1
+
use crate::reftable::{
2
2
+
basics::ReftableBuf,
3
3
+
block::{BlockIter, ReftableBlock},
4
4
+
record::ReftableRecord,
5
5
+
reftable_iterator::ReftableIterator,
6
6
+
reftable_table::ReftableTable,
7
7
+
};
8
8
+
9
9
+
pub type Void = ();
10
10
+
11
11
+
pub trait ReftableIteratorVtable {
12
12
+
fn seek(&self, iter_arg: &Void, want: &ReftableRecord) -> i16;
13
13
+
fn next(&self, iter_arg: &Void, rec: &ReftableRecord) -> i16;
14
14
+
fn close(&self, iter_arg: &Void);
15
15
+
}
16
16
+
17
17
+
pub fn iterator_seek(it: &ReftableIterator, want: &ReftableRecord) -> i16 {
18
18
+
todo!();
19
19
+
}
20
20
+
21
21
+
pub fn iterator_next(it: &ReftableIterator, rec: &ReftableRecord) -> i16 {
22
22
+
todo!();
23
23
+
}
24
24
+
25
25
+
pub fn iterator_set_empty(it: &ReftableIterator) {
26
26
+
todo!();
27
27
+
}
28
28
+
29
29
+
pub struct FilteringRefIterator<'a> {
30
30
+
pub oid: ReftableBuf,
31
31
+
pub it: ReftableIterator<'a, 'a>,
32
32
+
}
33
33
+
34
34
+
// TODO: #define FILTERING_REF_ITERATOR_INIT directive
35
35
+
36
36
+
pub fn iterator_from_filtering_ref_iterator(it: &ReftableIterator, fri: &FilteringRefIterator) {
37
37
+
todo!();
38
38
+
}
39
39
+
40
40
+
pub struct IndexedTableRefIter<'a> {
41
41
+
pub table: &'a ReftableTable,
42
42
+
pub oid: ReftableBuf,
43
43
+
pub offsets: Vec<u64>,
44
44
+
pub offset_idx: i16,
45
45
+
pub offset_len: i16,
46
46
+
pub block: ReftableBlock,
47
47
+
pub cur: BlockIter,
48
48
+
pub is_finished: i16,
49
49
+
}
50
50
+
51
51
+
// TODO: #define INDEXED_TABLE_REF_ITER_INIT directive
52
52
+
53
53
+
pub fn iterator_from_indexed_table_ref_iter(it: &ReftableIterator, itr: &IndexedTableRefIter) {
54
54
+
todo!();
55
55
+
}
56
56
+
57
57
+
pub fn indexed_table_ref_iter_new(
58
58
+
dest: &&IndexedTableRefIter,
59
59
+
t: &ReftableTable,
60
60
+
oid: &u8,
61
61
+
oid_len: i16,
62
62
+
offsets: &u64,
63
63
+
offset_len: i16,
64
64
+
) -> i16 {
65
65
+
todo!();
66
66
+
}
+1
src/reftable/mod.rs
···
7
7
pub mod merged;
8
8
pub mod pq;
9
9
pub mod record;
10
10
+
pub mod reftable_iterator;
10
11
pub mod reftable_table;
11
12
pub mod stack;
12
13
pub mod system;
+6
src/reftable/reftable_iterator.rs
···
1
1
+
use crate::reftable::iter::{ReftableIteratorVtable, Void};
2
2
+
3
3
+
pub struct ReftableIterator<'a, 'b> {
4
4
+
pub ops: &'a dyn ReftableIteratorVtable,
5
5
+
pub iter_arg: &'b Void,
6
6
+
}
+65
-2
src/reftable/reftable_table.rs
···
1
1
+
use crate::reftable::{
2
2
+
basics::ReftableHash, block::ReftableBlock, blocksource::ReftableBlockSource, iter::Void,
3
3
+
reftable_iterator::ReftableIterator,
4
4
+
};
5
5
+
6
6
+
pub struct ReftableTableOffsets {
7
7
+
pub is_present: i16,
8
8
+
pub offset: u64,
9
9
+
index_offset: u64,
10
10
+
}
11
11
+
1
12
pub struct ReftableTable {
2
13
pub name: String,
3
14
pub source: ReftableBlockSource,
···
6
17
pub block_size: u32,
7
18
pub min_update_index: u64,
8
19
pub max_update_index: u64,
9
9
-
pub object_id_len: i32, // TODO: is this the right integer size? (originally was int)
10
10
-
pub version: i32, // TODO: is this the right integer size? (originally was int)
20
20
+
pub object_id_len: i16,
21
21
+
pub version: i16,
11
22
pub ref_offsets: ReftableTableOffsets,
12
23
pub obj_offsets: ReftableTableOffsets,
13
24
pub log_offsets: ReftableTableOffsets,
14
25
}
26
26
+
27
27
+
pub fn reftabe_table_new(out: &&ReftableTable, src: &ReftableBlockSource, name: &str) -> i16 {
28
28
+
todo!();
29
29
+
}
30
30
+
31
31
+
pub fn reftable_table_incref(table: &ReftableTable) {
32
32
+
todo!();
33
33
+
}
34
34
+
35
35
+
pub fn reftable_table_decref(table: &ReftableTable) {
36
36
+
todo!();
37
37
+
}
38
38
+
39
39
+
pub fn reftable_table_init_ref_iterator(t: &ReftableTable, it: &ReftableIterator) -> i16 {
40
40
+
todo!();
41
41
+
}
42
42
+
43
43
+
pub fn reftable_table_init_log_iterator(t: &ReftableTable, it: &ReftableIterator) -> i16 {
44
44
+
todo!();
45
45
+
}
46
46
+
47
47
+
pub fn reftable_table_hash_id(t: &ReftableTable) -> ReftableHash {
48
48
+
t.hash_id
49
49
+
}
50
50
+
51
51
+
pub fn reftable_table_refs_for(t: &ReftableTable, it: &ReftableIterator, oid: &u8) -> i16 {
52
52
+
todo!();
53
53
+
}
54
54
+
55
55
+
pub fn reftable_table_max_update_index(t: &ReftableTable) -> u64 {
56
56
+
todo!();
57
57
+
}
58
58
+
59
59
+
pub fn reftable_table_min_update_index(t: &ReftableTable) -> u64 {
60
60
+
todo!();
61
61
+
}
62
62
+
63
63
+
pub struct ReftableTableIterator<'a> {
64
64
+
iter_arg: &'a Void,
65
65
+
}
66
66
+
67
67
+
pub fn reftable_table_iterator_init(it: &ReftableTableIterator, t: &ReftableTable) -> i16 {
68
68
+
todo!();
69
69
+
}
70
70
+
71
71
+
pub fn reftable_table_iterator_release(it: &ReftableTableIterator) {
72
72
+
todo!();
73
73
+
}
74
74
+
75
75
+
pub fn reftable_table_iterator_next(it: &ReftableTableIterator, out: &&ReftableBlock) -> i16 {
76
76
+
todo!();
77
77
+
}