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

Method put_cf

org/src/persist.rs:47–58  ·  view source on GitHub ↗

Put a key-value pair into a column family

(&self, cf_name: &str, key: &[u8], value: &[u8])

Source from the content-addressed store, hash-verified

45
46 // Put a key-value pair into a column family
47 pub fn put_cf(&self, cf_name: &str, key: &[u8], value: &[u8]) -> Result<(), WaCustomError> {
48 match self.db.cf_handle(cf_name) {
49 Some(cf_handle) => {
50 let result = self.db.put_cf(cf_handle, key, value);
51 match result {
52 Ok(_) => return Ok(()),
53 Err(e) => Err(WaCustomError::CFReadWriteFailed(e.into_string())),
54 }
55 }
56 None => Err(WaCustomError::CFNotFound),
57 }
58 }
59
60 // Get a value from a column family by key
61 pub fn get_cf(&self, cf_name: &str, key: &[u8]) -> Result<Option<Vec<u8>>, WaCustomError> {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected