Skip to main content

Deduplicator

Trait Deduplicator 

Source
pub trait Deduplicator: Send + Sync {
    // Required methods
    fn check_duplicate(
        &self,
        content: &str,
        namespace: Namespace,
    ) -> Result<DuplicateCheckResult>;
    fn record_capture(&self, content_hash: &str, memory_id: &MemoryId);
}
Expand description

Trait for deduplication checking.

Allows for different implementations (e.g., mock for testing).

Required Methods§

Source

fn check_duplicate( &self, content: &str, namespace: Namespace, ) -> Result<DuplicateCheckResult>

Checks if content is a duplicate.

§Arguments
  • content - The content to check
  • namespace - The namespace to check within
§Returns

A result indicating whether the content is a duplicate and why.

§Errors

Returns an error if the check fails.

Source

fn record_capture(&self, content_hash: &str, memory_id: &MemoryId)

Records a successful capture for recent-capture tracking.

§Arguments
  • content_hash - The SHA256 hash of the content
  • memory_id - The ID of the captured memory

Implementors§

Source§

impl<E: Embedder + Send + Sync, V: VectorBackend + Send + Sync> Deduplicator for DeduplicationService<E, V>

Implementation of the Deduplicator trait.