Check if a memory's scope matches the filter scope. `None` fields in the filter are treated as wildcards.
(memory_scope: &MemoryScope, filter: &MemoryScope)
| 298 | /// Check if a memory's scope matches the filter scope. |
| 299 | /// `None` fields in the filter are treated as wildcards. |
| 300 | fn 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. |
| 320 | fn simple_hash(content: &str) -> String { |