Git fork

feat: finish reftable-table.h and start iter.h

thecoded.prof e3f08e62 59f671fe

verified
+144 -2
+6
src/reftable/basics.rs
··· 62 62 pub fn hash_size(id: HashAlgorithm) -> u32 { 63 63 todo!() 64 64 } 65 + 66 + #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 67 + pub enum ReftableHash { 68 + ReftableHashSha1 = 89, 69 + ReftableHashSha256 = 247, 70 + }
+66
src/reftable/iter.rs
··· 1 + use crate::reftable::{ 2 + basics::ReftableBuf, 3 + block::{BlockIter, ReftableBlock}, 4 + record::ReftableRecord, 5 + reftable_iterator::ReftableIterator, 6 + reftable_table::ReftableTable, 7 + }; 8 + 9 + pub type Void = (); 10 + 11 + pub trait ReftableIteratorVtable { 12 + fn seek(&self, iter_arg: &Void, want: &ReftableRecord) -> i16; 13 + fn next(&self, iter_arg: &Void, rec: &ReftableRecord) -> i16; 14 + fn close(&self, iter_arg: &Void); 15 + } 16 + 17 + pub fn iterator_seek(it: &ReftableIterator, want: &ReftableRecord) -> i16 { 18 + todo!(); 19 + } 20 + 21 + pub fn iterator_next(it: &ReftableIterator, rec: &ReftableRecord) -> i16 { 22 + todo!(); 23 + } 24 + 25 + pub fn iterator_set_empty(it: &ReftableIterator) { 26 + todo!(); 27 + } 28 + 29 + pub struct FilteringRefIterator<'a> { 30 + pub oid: ReftableBuf, 31 + pub it: ReftableIterator<'a, 'a>, 32 + } 33 + 34 + // TODO: #define FILTERING_REF_ITERATOR_INIT directive 35 + 36 + pub fn iterator_from_filtering_ref_iterator(it: &ReftableIterator, fri: &FilteringRefIterator) { 37 + todo!(); 38 + } 39 + 40 + pub struct IndexedTableRefIter<'a> { 41 + pub table: &'a ReftableTable, 42 + pub oid: ReftableBuf, 43 + pub offsets: Vec<u64>, 44 + pub offset_idx: i16, 45 + pub offset_len: i16, 46 + pub block: ReftableBlock, 47 + pub cur: BlockIter, 48 + pub is_finished: i16, 49 + } 50 + 51 + // TODO: #define INDEXED_TABLE_REF_ITER_INIT directive 52 + 53 + pub fn iterator_from_indexed_table_ref_iter(it: &ReftableIterator, itr: &IndexedTableRefIter) { 54 + todo!(); 55 + } 56 + 57 + pub fn indexed_table_ref_iter_new( 58 + dest: &&IndexedTableRefIter, 59 + t: &ReftableTable, 60 + oid: &u8, 61 + oid_len: i16, 62 + offsets: &u64, 63 + offset_len: i16, 64 + ) -> i16 { 65 + todo!(); 66 + }
+1
src/reftable/mod.rs
··· 7 7 pub mod merged; 8 8 pub mod pq; 9 9 pub mod record; 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 + use crate::reftable::iter::{ReftableIteratorVtable, Void}; 2 + 3 + pub struct ReftableIterator<'a, 'b> { 4 + pub ops: &'a dyn ReftableIteratorVtable, 5 + pub iter_arg: &'b Void, 6 + }
+65 -2
src/reftable/reftable_table.rs
··· 1 + use crate::reftable::{ 2 + basics::ReftableHash, block::ReftableBlock, blocksource::ReftableBlockSource, iter::Void, 3 + reftable_iterator::ReftableIterator, 4 + }; 5 + 6 + pub struct ReftableTableOffsets { 7 + pub is_present: i16, 8 + pub offset: u64, 9 + index_offset: u64, 10 + } 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 - pub object_id_len: i32, // TODO: is this the right integer size? (originally was int) 10 - pub version: i32, // TODO: is this the right integer size? (originally was int) 20 + pub object_id_len: i16, 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 + 27 + pub fn reftabe_table_new(out: &&ReftableTable, src: &ReftableBlockSource, name: &str) -> i16 { 28 + todo!(); 29 + } 30 + 31 + pub fn reftable_table_incref(table: &ReftableTable) { 32 + todo!(); 33 + } 34 + 35 + pub fn reftable_table_decref(table: &ReftableTable) { 36 + todo!(); 37 + } 38 + 39 + pub fn reftable_table_init_ref_iterator(t: &ReftableTable, it: &ReftableIterator) -> i16 { 40 + todo!(); 41 + } 42 + 43 + pub fn reftable_table_init_log_iterator(t: &ReftableTable, it: &ReftableIterator) -> i16 { 44 + todo!(); 45 + } 46 + 47 + pub fn reftable_table_hash_id(t: &ReftableTable) -> ReftableHash { 48 + t.hash_id 49 + } 50 + 51 + pub fn reftable_table_refs_for(t: &ReftableTable, it: &ReftableIterator, oid: &u8) -> i16 { 52 + todo!(); 53 + } 54 + 55 + pub fn reftable_table_max_update_index(t: &ReftableTable) -> u64 { 56 + todo!(); 57 + } 58 + 59 + pub fn reftable_table_min_update_index(t: &ReftableTable) -> u64 { 60 + todo!(); 61 + } 62 + 63 + pub struct ReftableTableIterator<'a> { 64 + iter_arg: &'a Void, 65 + } 66 + 67 + pub fn reftable_table_iterator_init(it: &ReftableTableIterator, t: &ReftableTable) -> i16 { 68 + todo!(); 69 + } 70 + 71 + pub fn reftable_table_iterator_release(it: &ReftableTableIterator) { 72 + todo!(); 73 + } 74 + 75 + pub fn reftable_table_iterator_next(it: &ReftableTableIterator, out: &&ReftableBlock) -> i16 { 76 + todo!(); 77 + }