khive_runtime/
node_pins.rs1use crate::error::RuntimeResult;
8use crate::KhiveRuntime;
9use khive_db::stores::note::node_pins::NodePinStore;
10pub use khive_db::stores::note::node_pins::{NodePinKey, NodePinRecord};
11
12impl KhiveRuntime {
13 fn node_pin_store(&self) -> NodePinStore {
14 NodePinStore::new(self.backend().pool_arc())
15 }
16
17 pub async fn retain_confirmed_node_pins(&self, pins: Vec<NodePinRecord>) -> RuntimeResult<()> {
20 self.node_pin_store().retain(pins).await?;
21 Ok(())
22 }
23
24 pub async fn confirmed_node_pin(
26 &self,
27 key: NodePinKey,
28 ) -> RuntimeResult<Option<NodePinRecord>> {
29 Ok(self.node_pin_store().get(key).await?)
30 }
31}
32
33#[cfg(test)]
34#[path = "node_pins_tests.rs"]
35mod tests;