bitcoinleveldb_table/
version_iterator.rs

1crate::ix!();
2
3/**
4  | An internal iterator.  For a given
5  | version/level pair, yields information about
6  | the files in the level.  For a given entry,
7  | key() is the largest key that occurs in the
8  | file, and value() is an 16-byte value
9  | containing the file number and file size, both
10  | encoded using EncodeFixed64.
11  */
12pub struct VersionLevelFileNumIterator {
13    base:      LevelDBIterator,
14
15    icmp:      InternalKeyComparator,
16    flist:     *const Vec<*mut FileMetaData>,
17    index:     u32,
18
19    /**
20      | Backing store for value(). Holds the
21      | file number and size.
22      |
23      */
24    value_buf: [RefCell<u8>; 16],
25}
26
27impl VersionLevelFileNumIterator {
28    
29    pub fn new(
30        icmp:  &InternalKeyComparator,
31        flist: *const Vec<*mut FileMetaData>) -> Self {
32    
33        todo!();
34        /*
35
36
37            : icmp_(icmp), flist_(flist), index_(flist->size()) 
38              // Marks as invalid
39        */
40    }
41    
42    pub fn valid(&self) -> bool {
43        
44        todo!();
45        /*
46            return index_ < flist_->size();
47        */
48    }
49    
50    pub fn seek(&mut self, target: &Slice)  {
51        
52        todo!();
53        /*
54            index_ = FindFile(icmp_, *flist_, target);
55        */
56    }
57    
58    pub fn seek_to_first(&mut self)  {
59        
60        todo!();
61        /*
62            index_ = 0;
63        */
64    }
65    
66    pub fn seek_to_last(&mut self)  {
67        
68        todo!();
69        /*
70            index_ = flist_->empty() ? 0 : flist_->size() - 1;
71        */
72    }
73    
74    pub fn next(&mut self)  {
75        
76        todo!();
77        /*
78            assert(Valid());
79        index_++;
80        */
81    }
82    
83    pub fn prev(&mut self)  {
84        
85        todo!();
86        /*
87            assert(Valid());
88        if (index_ == 0) {
89          index_ = flist_->size();  // Marks as invalid
90        } else {
91          index_--;
92        }
93        */
94    }
95    
96    pub fn key(&self) -> Slice {
97        
98        todo!();
99        /*
100            assert(Valid());
101        return (*flist_)[index_]->largest.Encode();
102        */
103    }
104    
105    pub fn value(&self) -> Slice {
106        
107        todo!();
108        /*
109            assert(Valid());
110        EncodeFixed64(value_buf_, (*flist_)[index_]->number);
111        EncodeFixed64(value_buf_ + 8, (*flist_)[index_]->file_size);
112        return Slice(value_buf_, sizeof(value_buf_));
113        */
114    }
115    
116    pub fn status(&self) -> Status {
117        
118        todo!();
119        /*
120            return Status::OK();
121        */
122    }
123}
124