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

Method handle_array_compact

nodedb/src/data/executor/dispatch/array/mutate.rs:115–140  ·  view source on GitHub ↗
(
        &mut self,
        task: &ExecutionTask,
        array_id: &ArrayId,
        audit_retain_ms: Option<i64>,
    )

Source from the content-addressed store, hash-verified

113 }
114
115 pub(in crate::data::executor) fn handle_array_compact(
116 &mut self,
117 task: &ExecutionTask,
118 array_id: &ArrayId,
119 audit_retain_ms: Option<i64>,
120 ) -> Response {
121 let now_ms = std::time::SystemTime::now()
122 .duration_since(std::time::UNIX_EPOCH)
123 .map(|d| d.as_millis() as i64)
124 .unwrap_or(0);
125 let merged = match self
126 .array_engine
127 .maybe_compact(array_id, audit_retain_ms, now_ms)
128 {
129 Ok(m) => m,
130 Err(e) => {
131 return self.response_error(
132 task,
133 ErrorCode::Internal {
134 detail: format!("array compact: {e}"),
135 },
136 );
137 }
138 };
139 encode_count_response(self, task, "compacted", usize::from(merged))
140 }
141}
142
143fn encode_count_response(core: &CoreLoop, task: &ExecutionTask, key: &str, n: usize) -> Response {

Callers 1

dispatch_arrayMethod · 0.80

Calls 6

nowFunction · 0.85
encode_count_responseFunction · 0.85
duration_sinceMethod · 0.80
maybe_compactMethod · 0.80
response_errorMethod · 0.80
as_millisMethod · 0.45

Tested by

no test coverage detected