-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
178 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from uuid import UUID | ||
from overrides import overrides | ||
from chromadb.config import System | ||
from chromadb.ingest import CollectionAssignmentPolicy | ||
from chromadb.ingest.impl.utils import create_topic_name | ||
|
||
|
||
class SimpleAssignmentPolicy(CollectionAssignmentPolicy): | ||
"""Simple assignment policy that assigns a 1 collection to 1 topic based on the | ||
id of the collection.""" | ||
|
||
_tenant_id: str | ||
_topic_ns: str | ||
|
||
def __init__(self, system: System): | ||
self._tenant_id = system.settings.tenant_id | ||
self._topic_ns = system.settings.topic_namespace | ||
super().__init__(system) | ||
|
||
def _topic(self, collection_id: UUID) -> str: | ||
return create_topic_name(self._tenant_id, self._topic_ns, str(collection_id)) | ||
|
||
@overrides | ||
def assign_collection(self, collection_id: UUID) -> str: | ||
return self._topic(collection_id) |
Oops, something went wrong.