@@ -21,17 +21,17 @@ use chroma_types::{
21
21
CreateTenantError , CreateTenantRequest , CreateTenantResponse , DeleteCollectionError ,
22
22
DeleteCollectionRecordsError , DeleteCollectionRecordsRequest , DeleteCollectionRecordsResponse ,
23
23
DeleteCollectionRequest , DeleteDatabaseError , DeleteDatabaseRequest , DeleteDatabaseResponse ,
24
- GetCollectionError , GetCollectionRequest , GetCollectionResponse , GetCollectionsError ,
25
- GetDatabaseError , GetDatabaseRequest , GetDatabaseResponse , GetRequest , GetResponse ,
26
- GetTenantError , GetTenantRequest , GetTenantResponse , HealthCheckResponse , HeartbeatError ,
27
- HeartbeatResponse , Include , InternalCollectionConfiguration , ListCollectionsRequest ,
28
- ListCollectionsResponse , ListDatabasesError , ListDatabasesRequest , ListDatabasesResponse ,
29
- Operation , OperationRecord , QueryError , QueryRequest , QueryResponse , ResetError , ResetResponse ,
30
- Segment , SegmentScope , SegmentType , SegmentUuid , UpdateCollectionError ,
31
- UpdateCollectionRecordsError , UpdateCollectionRecordsRequest , UpdateCollectionRecordsResponse ,
32
- UpdateCollectionRequest , UpdateCollectionResponse , UpsertCollectionRecordsError ,
33
- UpsertCollectionRecordsRequest , UpsertCollectionRecordsResponse , VectorIndexConfiguration ,
34
- Where ,
24
+ ForkCollectionError , ForkCollectionRequest , ForkCollectionResponse , GetCollectionError ,
25
+ GetCollectionRequest , GetCollectionResponse , GetCollectionsError , GetDatabaseError ,
26
+ GetDatabaseRequest , GetDatabaseResponse , GetRequest , GetResponse , GetTenantError ,
27
+ GetTenantRequest , GetTenantResponse , HealthCheckResponse , HeartbeatError , HeartbeatResponse ,
28
+ Include , InternalCollectionConfiguration , ListCollectionsRequest , ListCollectionsResponse ,
29
+ ListDatabasesError , ListDatabasesRequest , ListDatabasesResponse , Operation , OperationRecord ,
30
+ QueryError , QueryRequest , QueryResponse , ResetError , ResetResponse , Segment , SegmentScope ,
31
+ SegmentType , SegmentUuid , UpdateCollectionError , UpdateCollectionRecordsError ,
32
+ UpdateCollectionRecordsRequest , UpdateCollectionRecordsResponse , UpdateCollectionRequest ,
33
+ UpdateCollectionResponse , UpsertCollectionRecordsError , UpsertCollectionRecordsRequest ,
34
+ UpsertCollectionRecordsResponse , VectorIndexConfiguration , Where ,
35
35
} ;
36
36
use opentelemetry:: global;
37
37
use opentelemetry:: metrics:: Counter ;
@@ -495,6 +495,33 @@ impl ServiceBasedFrontend {
495
495
Ok ( DeleteCollectionRecordsResponse { } )
496
496
}
497
497
498
+ pub async fn fork_collection (
499
+ & mut self ,
500
+ ForkCollectionRequest {
501
+ source_collection_id,
502
+ target_collection_name,
503
+ ..
504
+ } : ForkCollectionRequest ,
505
+ ) -> Result < ForkCollectionResponse , ForkCollectionError > {
506
+ let target_collection_id = CollectionUuid :: new ( ) ;
507
+ let collection_and_segments = self
508
+ . sysdb_client
509
+ . fork_collection (
510
+ source_collection_id,
511
+ target_collection_id,
512
+ target_collection_name,
513
+ )
514
+ . await ?;
515
+ let collection = collection_and_segments. collection . clone ( ) ;
516
+
517
+ // Update the cache.
518
+ self . collections_with_segments_provider
519
+ . set_collection_with_segments ( collection_and_segments)
520
+ . await ;
521
+
522
+ Ok ( collection)
523
+ }
524
+
498
525
pub async fn add (
499
526
& mut self ,
500
527
AddCollectionRecordsRequest {
0 commit comments