File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed
Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -51,11 +51,12 @@ impl CreateShardKeyBuilder {
5151 ///
5252 /// Use with caution! Setting arbirray replica states here may break your Qdrant cluster.
5353 #[ allow( unused_mut) ]
54- pub fn initial_state ( self , value : i32 ) -> Self {
54+ pub fn initial_state ( self , value : ReplicaState ) -> Self {
5555 let mut new = self ;
56- new. initial_state = Option :: Some ( Option :: Some ( value) ) ;
56+ new. initial_state = Option :: Some ( Option :: Some ( value as i32 ) ) ;
5757 new
5858 }
59+
5960 fn build_inner ( self ) -> Result < CreateShardKey , std:: convert:: Infallible > {
6061 Ok ( CreateShardKey {
6162 shard_key : self . shard_key . unwrap_or_default ( ) ,
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ async fn test_create_shard_key() {
66 // Please, modify the snippet in the `../snippets/create_shard_key.rs` file
77 use qdrant_client:: qdrant:: shard_key:: Key ;
88 use qdrant_client:: qdrant:: { CreateShardKeyBuilder , CreateShardKeyRequestBuilder } ;
9+ use qdrant_client:: qdrant:: ReplicaState ;
910 use qdrant_client:: Qdrant ;
1011
1112 let client = Qdrant :: from_url ( "http://localhost:6334" ) . build ( ) ?;
@@ -14,7 +15,8 @@ async fn test_create_shard_key() {
1415 . create_shard_key (
1516 CreateShardKeyRequestBuilder :: new ( "{collection_name}" ) . request (
1617 CreateShardKeyBuilder :: default ( )
17- . shard_key ( Key :: Keyword ( "{shard_key}" . to_string ( ) ) ) ,
18+ . shard_key ( Key :: Keyword ( "{shard_key}" . to_string ( ) ) )
19+ . initial_state ( ReplicaState :: Active ) ,
1820 ) ,
1921 )
2022 . await ?;
Original file line number Diff line number Diff line change 11use qdrant_client:: qdrant:: shard_key:: Key ;
22use qdrant_client:: qdrant:: { CreateShardKeyBuilder , CreateShardKeyRequestBuilder } ;
3+ use qdrant_client:: qdrant:: ReplicaState ;
34use qdrant_client:: Qdrant ;
45
56let client = Qdrant :: from_url ( "http://localhost:6334" ) . build ( ) ?;
89 . create_shard_key (
910 CreateShardKeyRequestBuilder :: new ( "{collection_name}" ) . request (
1011 CreateShardKeyBuilder :: default ( )
11- . shard_key ( Key :: Keyword ( "{shard_key}" . to_string ( ) ) ) ,
12+ . shard_key ( Key :: Keyword ( "{shard_key}" . to_string ( ) ) )
13+ . initial_state ( ReplicaState :: Active ) ,
1214 ) ,
1315 )
1416 . await ?;
You can’t perform that action at this time.
0 commit comments