MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / temporal_purge

Method temporal_purge

nodedb/src/engine/array/engine.rs:175–204  ·  view source on GitHub ↗

Drop superseded tile-versions older than `cutoff_system_ms` for the array named `array_id`. `tenant_id` is accepted for forward-compatibility. Arrays are currently global (not tenant-scoped), so the catalog lookup uses only `array_id`. Returns the number of tile-versions dropped. Returns `Ok(0)` when the array is not open (idempotent — array may have been dropped between schedule and execution).

(
        &mut self,
        tenant_id: nodedb_types::TenantId,
        array_id: &str,
        cutoff_system_ms: i64,
    )

Source from the content-addressed store, hash-verified

173 /// array is not open (idempotent — array may have been dropped between
174 /// schedule and execution).
175 pub fn temporal_purge(
176 &mut self,
177 tenant_id: nodedb_types::TenantId,
178 array_id: &str,
179 cutoff_system_ms: i64,
180 ) -> ArrayEngineResult<u64> {
181 let aid = ArrayId::new(tenant_id, array_id);
182 // Idempotent: array may not be open on this core.
183 if !self.arrays.contains_key(&aid) {
184 return Ok(0);
185 }
186
187 let schema = {
188 let store = self.store(&aid)?;
189 store.schema().as_ref().clone()
190 };
191
192 let plan = {
193 let store = self.store(&aid)?;
194 super::purge::plan(store, cutoff_system_ms, &schema)?
195 };
196
197 if plan.segment_actions.is_empty() {
198 return Ok(0);
199 }
200
201 let store = self.store_mut(&aid)?;
202 let dropped = super::purge::execute(store, plan)?;
203 Ok(dropped)
204 }
205}
206
207pub(super) fn array_dir(root: &std::path::Path, id: &ArrayId) -> PathBuf {

Calls 8

store_mutMethod · 0.80
planFunction · 0.50
executeFunction · 0.50
storeMethod · 0.45
cloneMethod · 0.45
as_refMethod · 0.45
schemaMethod · 0.45
is_emptyMethod · 0.45