@@ -24,13 +24,13 @@ const DEFAULT_URL: &str = "http://localhost:6334/";
2424
2525#[ derive( Debug , Deserialize , Clone ) ]
2626pub struct ConnectionSpec {
27- url : String ,
27+ grpc_url : String ,
2828 api_key : Option < String > ,
2929}
3030
3131#[ derive( Debug , Deserialize , Clone ) ]
3232struct Spec {
33- connection : spec:: AuthEntryReference < ConnectionSpec > ,
33+ connection : Option < spec:: AuthEntryReference < ConnectionSpec > > ,
3434 collection_name : String ,
3535}
3636
@@ -150,10 +150,14 @@ impl setup::ResourceSetupStatus for SetupStatus {
150150}
151151
152152impl SetupStatus {
153- async fn apply ( & self , collection_name : & String , qdrant_client : & Qdrant ) -> Result < ( ) > {
153+ async fn apply_delete ( & self , collection_name : & String , qdrant_client : & Qdrant ) -> Result < ( ) > {
154154 if self . delete_collection {
155155 qdrant_client. delete_collection ( collection_name) . await ?;
156156 }
157+ Ok ( ( ) )
158+ }
159+
160+ async fn apply_create ( & self , collection_name : & String , qdrant_client : & Qdrant ) -> Result < ( ) > {
157161 if let Some ( add_collection) = & self . add_collection {
158162 let mut builder = CreateCollectionBuilder :: new ( collection_name) ;
159163 if !add_collection. vectors . is_empty ( ) {
@@ -382,10 +386,9 @@ impl StorageFactoryBase for Factory {
382386 }
383387 }
384388
385- let connection = Some ( d. spec . connection ) ;
386389 let export_context = Arc :: new ( ExportContext {
387390 qdrant_client : self
388- . get_qdrant_client ( & connection, & context. auth_registry ) ?,
391+ . get_qdrant_client ( & d . spec . connection , & context. auth_registry ) ?,
389392 collection_name : d. spec . collection_name . clone ( ) ,
390393 fields_info,
391394 } ) ;
@@ -398,7 +401,7 @@ impl StorageFactoryBase for Factory {
398401 Ok ( TypedExportDataCollectionBuildOutput {
399402 executors : executors. boxed ( ) ,
400403 setup_key : CollectionKey {
401- connection,
404+ connection : d . spec . connection ,
402405 collection_name : d. spec . collection_name ,
403406 } ,
404407 desired_setup_state : SetupState {
@@ -489,12 +492,20 @@ impl StorageFactoryBase for Factory {
489492 setup_status : Vec < TypedResourceSetupChangeItem < ' async_trait , Self > > ,
490493 auth_registry : & Arc < AuthRegistry > ,
491494 ) -> Result < ( ) > {
492- for setup_change in setup_status. into_iter ( ) {
495+ for setup_change in setup_status. iter ( ) {
496+ let qdrant_client =
497+ self . get_qdrant_client ( & setup_change. key . connection , auth_registry) ?;
498+ setup_change
499+ . setup_status
500+ . apply_delete ( & setup_change. key . collection_name , & qdrant_client)
501+ . await ?;
502+ }
503+ for setup_change in setup_status. iter ( ) {
493504 let qdrant_client =
494505 self . get_qdrant_client ( & setup_change. key . connection , auth_registry) ?;
495506 setup_change
496507 . setup_status
497- . apply ( & setup_change. key . collection_name , & qdrant_client)
508+ . apply_create ( & setup_change. key . collection_name , & qdrant_client)
498509 . await ?;
499510 }
500511 Ok ( ( ) )
@@ -521,14 +532,14 @@ impl Factory {
521532 let spec = auth_entry. as_ref ( ) . map_or_else (
522533 || {
523534 Ok ( ConnectionSpec {
524- url : DEFAULT_URL . to_string ( ) ,
535+ grpc_url : DEFAULT_URL . to_string ( ) ,
525536 api_key : None ,
526537 } )
527538 } ,
528539 |auth_entry| auth_registry. get ( auth_entry) ,
529540 ) ?;
530541 let client = Arc :: new (
531- Qdrant :: from_url ( & spec. url )
542+ Qdrant :: from_url ( & spec. grpc_url )
532543 . api_key ( spec. api_key )
533544 . skip_compatibility_check ( )
534545 . build ( ) ?,
0 commit comments