MCPcopy Create free account
hub / github.com/carsonpo/haystackdb / add_to_commit_list

Method add_to_commit_list

src/structures/wal.rs:195–220  ·  view source on GitHub ↗
(
        &mut self,
        hash: u64,
        vectors: Vec<[u8; QUANTIZED_VECTOR_SIZE]>,
        kvs: Vec<Vec<KVPair>>,
    )

Source from the content-addressed store, hash-verified

193 }
194
195 pub fn add_to_commit_list(
196 &mut self,
197 hash: u64,
198 vectors: Vec<[u8; QUANTIZED_VECTOR_SIZE]>,
199 kvs: Vec<Vec<KVPair>>,
200 ) -> Result<(), io::Error> {
201 let timestamp = SystemTime::now()
202 .duration_since(UNIX_EPOCH)
203 .unwrap()
204 .as_secs();
205
206 let commit_list_item = CommitListItem {
207 hash,
208 timestamp,
209 vectors,
210 kvs,
211 };
212
213 self.commit_list.insert(hash, commit_list_item)?;
214
215 // self.commit_finish.insert(hash, false)?;
216
217 // self.timestamps.insert(timestamp, hash)?;
218
219 Ok(())
220 }
221
222 pub fn has_been_committed(&mut self, hash: u64) -> Result<bool, io::Error> {
223 match self.commit_list.has_key(hash) {

Callers 2

add_to_walMethod · 0.80
batch_add_to_walMethod · 0.80

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected