Skip to content

Commit

Permalink
Rename type
Browse files Browse the repository at this point in the history
  • Loading branch information
Sicheng Pan committed Dec 10, 2024
1 parent b6d727f commit a140fbd
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions chromadb/db/impl/grpc/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from chromadb.telemetry.opentelemetry.grpc import OtelInterceptor
from chromadb.types import (
Collection,
CollectionSegments,
CollectionAndSegments,
Database,
Metadata,
OptionalArgument,
Expand Down Expand Up @@ -367,11 +367,11 @@ def get_collections(
raise InternalError()

@overrides
def get_collection_with_segments(self, collection_id: UUID) -> CollectionSegments:
def get_collection_with_segments(self, collection_id: UUID) -> CollectionAndSegments:
try:
request = GetCollectionWithSegmentsRequest(id=collection_id.hex)
response: GetCollectionWithSegmentsResponse = self._sys_db_stub.GetCollectionWithSegments(request)
return CollectionSegments(
return CollectionAndSegments(
collection=from_proto_collection(response.collection),
segments=[from_proto_segment(segment) for segment in response.segments]
)
Expand Down
6 changes: 3 additions & 3 deletions chromadb/db/mixins/sysdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
)
from chromadb.ingest import Producer
from chromadb.types import (
CollectionSegments,
CollectionAndSegments,
Database,
OptionalArgument,
Segment,
Expand Down Expand Up @@ -491,13 +491,13 @@ def get_collections(
return collections

@override
def get_collection_with_segments(self, collection_id: UUID) -> CollectionSegments:
def get_collection_with_segments(self, collection_id: UUID) -> CollectionAndSegments:
collections = self.get_collections(id=collection_id)
if len(collections) == 0:
raise InvalidCollectionException(
f"Collection {collection_id} does not exist."
)
return CollectionSegments(
return CollectionAndSegments(
collection=collections[0],
segments=self.get_segments(collection=collection_id),
)
Expand Down
4 changes: 2 additions & 2 deletions chromadb/db/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from chromadb.api.configuration import CollectionConfigurationInternal
from chromadb.types import (
Collection,
CollectionSegments,
CollectionAndSegments,
Database,
Tenant,
Metadata,
Expand Down Expand Up @@ -133,7 +133,7 @@ def get_collections(
def get_collection_with_segments(
self,
collection_id: UUID
) -> CollectionSegments:
) -> CollectionAndSegments:
"""Get a consistent snapshot of a collection by id. This will return a collection with segment
information that matches the collection version and log position.
"""
Expand Down
2 changes: 1 addition & 1 deletion chromadb/segment/impl/manager/distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
OpenTelemetryGranularity,
trace_method,
)
from chromadb.types import Collection, CollectionSegments, Operation, Segment, SegmentScope
from chromadb.types import Collection, CollectionAndSegments, Operation, Segment, SegmentScope


class DistributedSegmentManager(SegmentManager):
Expand Down
2 changes: 1 addition & 1 deletion chromadb/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class Segment(TypedDict):
metadata: Optional[Metadata]
file_paths: Mapping[str, Sequence[str]]

class CollectionSegments(TypedDict):
class CollectionAndSegments(TypedDict):
collection: Collection
segments: Sequence[Segment]

Expand Down

0 comments on commit a140fbd

Please sign in to comment.