Skip to content

Commit 764f7ea

Browse files
authored
chore: Removed cloud boolean from config (#89)
* chore: Remove cloud bool Signed-off-by: Anush008 <[email protected]> * docs: Updated with new params Signed-off-by: Anush008 <[email protected]> --------- Signed-off-by: Anush008 <[email protected]>
1 parent 214d898 commit 764f7ea

File tree

5 files changed

+15
-36
lines changed

5 files changed

+15
-36
lines changed

README.md

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,30 +61,14 @@ client, err := qdrant.NewClient(&qdrant.Config{
6161
Port: 6334,
6262
APIKey: "<your-api-key>",
6363
UseTLS: true, // uses default config with minimum TLS version set to 1.3
64+
// PoolSize: 3,
65+
// KeepAliveTime: 10,
66+
// KeepAliveTimeout: 2,
6467
// TLSConfig: &tls.Config{...},
6568
// GrpcOptions: []grpc.DialOption{},
6669
})
6770
```
6871

69-
#### Creating a client for the cloud
70-
71-
When connecting to Qdrant Cloud, we recommend setting the `Cloud` boolean to true.
72-
This sets default settings for connection pooling and keep-alive to be more resilient.
73-
74-
```go
75-
import "github.com/qdrant/go-client/qdrant"
76-
77-
client, err := qdrant.NewClient(&qdrant.Config{
78-
Host: "xyz-example.eu-central.aws.cloud.qdrant.io",
79-
Port: 6334,
80-
APIKey: "<your-api-key>",
81-
UseTLS: true,
82-
Cloud: true,
83-
// TLSConfig: &tls.Config{...},
84-
// GrpcOptions: []grpc.DialOption{},
85-
})
86-
```
87-
8872
### Working with collections
8973

9074
Once a client has been created, create a new collection

examples/authentication/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ func main() {
1515
Port: 6334,
1616
APIKey: "<paste-your-api-key-here>",
1717
UseTLS: true,
18-
Cloud: true,
18+
// PoolSize: 3,
19+
// KeepAliveTime: 10,
20+
// KeepAliveTimeout: 2,
1921
// TLSConfig: &tls.Config{...},
2022
// GrpcOptions: []grpc.DialOption{},
2123
})

examples/main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ func run() error {
2727
Port: 6334, // Can be omitted, default is 6334
2828
// APIKey: "<API_KEY>",
2929
// UseTLS: true,
30-
// TLSConfig: &tls.Config{},
30+
// PoolSize: 3,
31+
// KeepAliveTime: 10,
32+
// KeepAliveTimeout: 2,
33+
// TLSConfig: &tls.Config{...},
3134
// GrpcOptions: []grpc.DialOption{},
3235
})
3336
if err != nil {

qdrant/client.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,8 @@ type Client struct {
2222
func NewClient(config *Config) (*Client, error) {
2323
// Ensure config is not modified for the caller by cloning.
2424
cfgCopy := *config
25-
// Set default values, depending of Cloud bool
2625
if cfgCopy.PoolSize == 0 {
27-
if cfgCopy.Cloud {
28-
cfgCopy.PoolSize = 3
29-
} else {
30-
cfgCopy.PoolSize = 1
31-
}
26+
cfgCopy.PoolSize = 3
3227
}
3328
// Create the client, with an inner connection pool of go grpc clients
3429
client := &Client{

qdrant/config.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,14 @@ type Config struct {
4040
GrpcOptions []grpc.DialOption
4141
// Whether to check compatibility between server's version and client's. Defaults to false.
4242
SkipCompatibilityCheck bool
43-
// If set, the client is configured for connection with Qdrant Cloud,
44-
// changing some defaults for optimized resilience and performance.
45-
// If not set, the client behaves as for a local Qdrant installation (default).
46-
Cloud bool
4743
// PoolSize specifies the number of connections to create.
48-
// If 0, the default of 1 will be used for local mode, and 3 for Cloud mode.
44+
// If 0, the default of 3 will be used.
4945
// If 1 a single connection is used (aka no pool).
5046
// If greater than 1, a pool of connections is created and requests are distributed in a round-robin fashion.
5147
PoolSize uint
5248
// KeepAliveTime specifies the duration after which if the client does not see any activity (in seconds),
5349
// it pings the server to check if the transport is still alive.
54-
// If 0, the default is disabled for local mode, and 10 seconds for Cloud mode.
50+
// If 0, the default is 10 seconds.
5551
// If set to -1, keepalive is disabled.
5652
KeepAliveTime int
5753
// KeepAliveTimeout specifies the duration the client waits for a response from the server after
@@ -77,12 +73,11 @@ func (c *Config) getAddr() string {
7773

7874
// Internal method.
7975
func (c *Config) getKeepAliveParams() []grpc.DialOption {
80-
if c.KeepAliveTime == -1 ||
81-
(!c.Cloud && c.KeepAliveTime == 0) {
76+
if c.KeepAliveTime == -1 {
8277
// Disabled
8378
return nil
8479
}
85-
// We run in cloud, or local and have an explicit keep alive time
80+
// Default to 10 seconds
8681
keepAliveTime := 10
8782
if c.KeepAliveTime > 0 {
8883
keepAliveTime = c.KeepAliveTime

0 commit comments

Comments
 (0)