pub struct DuplicateCheckResult {
pub is_duplicate: bool,
pub reason: Option<DuplicateReason>,
pub similarity_score: Option<f32>,
pub matched_memory_id: Option<MemoryId>,
pub matched_urn: Option<String>,
pub check_duration_ms: u64,
}Expand description
Result of a deduplication check.
Contains information about whether content was found to be a duplicate, the reason for duplication, and any matched memory information.
§Example
use subcog::services::deduplication::{DuplicateCheckResult, DuplicateReason};
use subcog::models::MemoryId;
let result = DuplicateCheckResult {
is_duplicate: true,
reason: Some(DuplicateReason::ExactMatch),
similarity_score: None,
matched_memory_id: Some(MemoryId::new("abc123")),
matched_urn: Some("subcog://project/decisions/abc123".to_string()),
check_duration_ms: 5,
};
assert!(result.is_duplicate);
assert_eq!(result.reason, Some(DuplicateReason::ExactMatch));Fields§
§is_duplicate: boolWhether the content is a duplicate.
reason: Option<DuplicateReason>The reason content was identified as a duplicate.
similarity_score: Option<f32>Similarity score for semantic matches (0.0 to 1.0).
matched_memory_id: Option<MemoryId>The memory ID of the matched duplicate.
matched_urn: Option<String>Full URN of matched memory: subcog://{domain}/{namespace}/{id}.
MUST be populated when is_duplicate == true.
All external outputs (logs, metrics labels, hook responses) MUST reference
memories by URN, not bare ID.
check_duration_ms: u64Duration of the deduplication check in milliseconds.
Implementations§
Source§impl DuplicateCheckResult
impl DuplicateCheckResult
Sourcepub const fn not_duplicate(duration_ms: u64) -> Self
pub const fn not_duplicate(duration_ms: u64) -> Self
Creates a result indicating no duplicate was found.
§Arguments
duration_ms- Time taken for the check in milliseconds
§Example
use subcog::services::deduplication::DuplicateCheckResult;
let result = DuplicateCheckResult::not_duplicate(10);
assert!(!result.is_duplicate);
assert!(result.reason.is_none());Sourcepub const fn exact_match(
memory_id: MemoryId,
urn: String,
duration_ms: u64,
) -> Self
pub const fn exact_match( memory_id: MemoryId, urn: String, duration_ms: u64, ) -> Self
Creates a result indicating an exact match was found.
§Arguments
memory_id- The ID of the matched memoryurn- The full URN of the matched memoryduration_ms- Time taken for the check in milliseconds
§Example
use subcog::services::deduplication::DuplicateCheckResult;
use subcog::models::MemoryId;
let result = DuplicateCheckResult::exact_match(
MemoryId::new("abc123"),
"subcog://project/decisions/abc123".to_string(),
5,
);
assert!(result.is_duplicate);Sourcepub const fn semantic_match(
memory_id: MemoryId,
urn: String,
score: f32,
duration_ms: u64,
) -> Self
pub const fn semantic_match( memory_id: MemoryId, urn: String, score: f32, duration_ms: u64, ) -> Self
Creates a result indicating a semantic similarity match was found.
§Arguments
memory_id- The ID of the matched memoryurn- The full URN of the matched memoryscore- The similarity score (0.0 to 1.0)duration_ms- Time taken for the check in milliseconds
§Example
use subcog::services::deduplication::DuplicateCheckResult;
use subcog::models::MemoryId;
let result = DuplicateCheckResult::semantic_match(
MemoryId::new("abc123"),
"subcog://project/decisions/abc123".to_string(),
0.94,
20,
);
assert!(result.is_duplicate);
assert_eq!(result.similarity_score, Some(0.94));Sourcepub const fn recent_capture(
memory_id: MemoryId,
urn: String,
duration_ms: u64,
) -> Self
pub const fn recent_capture( memory_id: MemoryId, urn: String, duration_ms: u64, ) -> Self
Creates a result indicating the content was recently captured.
§Arguments
memory_id- The ID of the matched memoryurn- The full URN of the matched memoryduration_ms- Time taken for the check in milliseconds
§Example
use subcog::services::deduplication::DuplicateCheckResult;
use subcog::models::MemoryId;
let result = DuplicateCheckResult::recent_capture(
MemoryId::new("abc123"),
"subcog://project/decisions/abc123".to_string(),
1,
);
assert!(result.is_duplicate);Trait Implementations§
Source§impl Clone for DuplicateCheckResult
impl Clone for DuplicateCheckResult
Source§fn clone(&self) -> DuplicateCheckResult
fn clone(&self) -> DuplicateCheckResult
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DuplicateCheckResult
impl Debug for DuplicateCheckResult
Source§impl Default for DuplicateCheckResult
impl Default for DuplicateCheckResult
Source§impl<'de> Deserialize<'de> for DuplicateCheckResult
impl<'de> Deserialize<'de> for DuplicateCheckResult
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for DuplicateCheckResult
impl RefUnwindSafe for DuplicateCheckResult
impl Send for DuplicateCheckResult
impl Sync for DuplicateCheckResult
impl Unpin for DuplicateCheckResult
impl UnwindSafe for DuplicateCheckResult
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].