Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sanketkedia committed Jun 17, 2024
1 parent 6a597ff commit d2fe0ab
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
23 changes: 2 additions & 21 deletions rust/worker/src/segment/types.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::errors::{ChromaError, ErrorCodes};
use crate::execution::data::data_chunk::Chunk;
use crate::types::{
DeletedMetadata, LogRecord, Metadata, MetadataValue, MetadataValueConversionError, Operation,
OperationRecord, UpdateMetadata, UpdateMetadataValue,
DeletedMetadata, LogRecord, Metadata, MetadataDelta, MetadataValue,
MetadataValueConversionError, Operation, OperationRecord, UpdateMetadata, UpdateMetadataValue,
};
use async_trait::async_trait;
use std::collections::{HashMap, HashSet};
Expand Down Expand Up @@ -168,25 +168,6 @@ pub(crate) struct MaterializedLogRecord<'referred_data> {
pub(crate) final_embedding: Option<&'referred_data [f32]>,
}

pub(crate) struct MetadataDelta<'referred_data> {
pub(crate) metadata_to_update: HashMap<
&'referred_data str,
(&'referred_data MetadataValue, &'referred_data MetadataValue),
>,
pub(crate) metadata_to_delete: HashMap<&'referred_data str, &'referred_data MetadataValue>,
pub(crate) metadata_to_insert: HashMap<&'referred_data str, &'referred_data MetadataValue>,
}

impl<'referred_data> MetadataDelta<'referred_data> {
pub(crate) fn new() -> Self {
Self {
metadata_to_update: HashMap::new(),
metadata_to_delete: HashMap::new(),
metadata_to_insert: HashMap::new(),
}
}
}

impl<'referred_data> MaterializedLogRecord<'referred_data> {
// Performs a deep copy of the document so only use it if really
// needed. If you only need a reference then use merged_document_ref
Expand Down
19 changes: 19 additions & 0 deletions rust/worker/src/types/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,25 @@ impl TryFrom<chroma_proto::UpdateMetadata> for Metadata {
}
}

pub(crate) struct MetadataDelta<'referred_data> {
pub(crate) metadata_to_update: HashMap<
&'referred_data str,
(&'referred_data MetadataValue, &'referred_data MetadataValue),
>,
pub(crate) metadata_to_delete: HashMap<&'referred_data str, &'referred_data MetadataValue>,
pub(crate) metadata_to_insert: HashMap<&'referred_data str, &'referred_data MetadataValue>,
}

impl<'referred_data> MetadataDelta<'referred_data> {
pub(crate) fn new() -> Self {
Self {
metadata_to_update: HashMap::new(),
metadata_to_delete: HashMap::new(),
metadata_to_insert: HashMap::new(),
}
}
}

/*
===========================================
Metadata queries
Expand Down

0 comments on commit d2fe0ab

Please sign in to comment.