MCPcopy Create free account
hub / github.com/Rustixir/darkbird / load_memtable_from_database

Method load_memtable_from_database

src/darkbird/persistent_worker.rs:135–166  ·  view source on GitHub ↗
(
        &self,
        storage: Arc<Storage<K, Doc>>,
        handler: &THandler,
    )

Source from the content-addressed store, hash-verified

133 }
134
135 pub async fn load_memtable_from_database<K, Doc, THandler>(
136 &self,
137 storage: Arc<Storage<K, Doc>>,
138 handler: &THandler,
139 ) -> Result<(), SessionResult>
140 where
141 THandler: Getter<K, Doc>,
142 Doc: Serialize + DeserializeOwned + Clone + Send + 'static + Document,
143 K: Serialize
144 + DeserializeOwned
145 + PartialOrd
146 + Ord
147 + PartialEq
148 + Eq
149 + Hash
150 + Clone
151 + Send
152 + Sync
153 + 'static,
154 {
155 // Call Getter
156 let list = handler.handle_getter(&self.db_session).await;
157
158 // Fill Memtable
159 for (key, document) in list.into_iter() {
160 if let Err(e) = storage.insert(key, document).await {
161 return Err(e);
162 }
163 }
164
165 return Ok(());
166 }
167}

Callers 1

mainFunction · 0.80

Calls 2

handle_getterMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected