MCPcopy Create free account
hub / github.com/InfinitiBit/graphbit / matches_scope

Function matches_scope

core/src/memory/service.rs:300–317  ·  view source on GitHub ↗

Check if a memory's scope matches the filter scope. `None` fields in the filter are treated as wildcards.

(memory_scope: &MemoryScope, filter: &MemoryScope)

Source from the content-addressed store, hash-verified

298/// Check if a memory's scope matches the filter scope.
299/// `None` fields in the filter are treated as wildcards.
300fn matches_scope(memory_scope: &MemoryScope, filter: &MemoryScope) -> bool {
301 if let Some(ref uid) = filter.user_id {
302 if memory_scope.user_id.as_ref() != Some(uid) {
303 return false;
304 }
305 }
306 if let Some(ref aid) = filter.agent_id {
307 if memory_scope.agent_id.as_ref() != Some(aid) {
308 return false;
309 }
310 }
311 if let Some(ref rid) = filter.run_id {
312 if memory_scope.run_id.as_ref() != Some(rid) {
313 return false;
314 }
315 }
316 true
317}
318
319/// Produce a simple content hash for deduplication.
320fn simple_hash(content: &str) -> String {

Callers 1

searchMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected