MCPcopy Create free account
hub / github.com/cosdata/cosdata / set_current_version_explicit

Method set_current_version_explicit

src/models/versioning.rs:214–251  ·  view source on GitHub ↗
(
        &self,
        version: VersionNumber,
        transaction_id: ExplicitTransactionID,
        records_upserted: u32,
        records_deleted: u32,
        total_operations: u32,
    )

Source from the content-addressed store, hash-verified

212 }
213
214 pub fn set_current_version_explicit(
215 &self,
216 version: VersionNumber,
217 transaction_id: ExplicitTransactionID,
218 records_upserted: u32,
219 records_deleted: u32,
220 total_operations: u32,
221 ) -> lmdb::Result<()> {
222 let mut txn = self.env.begin_rw_txn()?;
223 let current_version_key = key!(m:current_version);
224 let version_key = key!(v:version);
225
226 let version_info = VersionInfo::new_explicit(
227 version,
228 transaction_id,
229 Utc::now(),
230 records_upserted,
231 records_deleted,
232 total_operations,
233 );
234 let version_info_serialized = version_info.serialize();
235
236 txn.put(
237 self.db,
238 &current_version_key,
239 &version.to_le_bytes(),
240 WriteFlags::empty(),
241 )?;
242 txn.put(
243 self.db,
244 &version_key,
245 &version_info_serialized,
246 WriteFlags::empty(),
247 )?;
248
249 txn.commit()?;
250 Ok(())
251 }
252
253 pub fn set_current_version_implicit(
254 &self,

Callers 1

commit_transactionFunction · 0.80

Calls 1

serializeMethod · 0.45

Tested by

no test coverage detected