milvus 0.10.2 → 0.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +22 -6
- data/lib/milvus/aliases.rb +78 -0
- data/lib/milvus/client.rb +18 -3
- data/lib/milvus/version.rb +1 -1
- data/lib/milvus.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 914040de2cf35a3985d67dbd19de618e00d82262b61220df8bbf517cee40f72f
|
4
|
+
data.tar.gz: d88ca74f1a6674cefadd0d790b3a3c828da1f2e585a2cd9b4d3fa9dca492115a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5092e0ec3696ce6d8e8a7a9d8df199f32f9ef4172f3aa65e0d415312da019c47763beef7df1e4714e3adee53f806f0bfd79f35e99884d8df8abb5745755f73a1
|
7
|
+
data.tar.gz: 9580e92290a0a3f132b39629ff4bc25ef759b7b2d608cf744218bd529e9e54ac328194584db757af76b56f03790793468e9e6b6bebadc173301403fb17fc52bc
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -22,11 +22,6 @@ Available for paid consulting engagements! [Email me](mailto:andrei@sourcelabs.i
|
|
22
22
|
## API Docs
|
23
23
|
https://docs.zilliz.com/reference/restful/data-plane-v2
|
24
24
|
|
25
|
-
## TODOs
|
26
|
-
- [X] Support for [User endpoints](https://docs.zilliz.com/reference/restful/user-operations-v2)
|
27
|
-
- [X] Support for [Role endpoints](https://docs.zilliz.com/reference/restful/role-operations-v2)
|
28
|
-
- [ ] Support for [Alias endpoints](https://docs.zilliz.com/reference/restful/alias-operations-v2)
|
29
|
-
|
30
25
|
## Installation
|
31
26
|
|
32
27
|
Install the gem and add to the application's Gemfile by executing:
|
@@ -311,6 +306,27 @@ client.users.grant_role(user_name: 'user_name', role_name: 'admin')
|
|
311
306
|
# Revoke role from the user
|
312
307
|
client.users.revoke_role(user_name: 'user_name', role_name: 'admin')
|
313
308
|
```
|
309
|
+
### Aliases
|
310
|
+
```ruby
|
311
|
+
# Lists all existing collection aliases in the specified database
|
312
|
+
client.aliases.list
|
313
|
+
```
|
314
|
+
```ruby
|
315
|
+
# Describes the details of a specific alias
|
316
|
+
client.aliases.describe
|
317
|
+
```
|
318
|
+
```ruby
|
319
|
+
# Reassigns the alias of one collection to another.
|
320
|
+
client.aliases.alter
|
321
|
+
```
|
322
|
+
```ruby
|
323
|
+
# Drops a specified alias
|
324
|
+
client.aliases.drop
|
325
|
+
```
|
326
|
+
```ruby
|
327
|
+
# Creates an alias for an existing collection
|
328
|
+
client.aliases.create
|
329
|
+
```
|
314
330
|
|
315
331
|
## Development
|
316
332
|
|
@@ -320,7 +336,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
320
336
|
|
321
337
|
## Development with Docker
|
322
338
|
|
323
|
-
Run `docker compose run --rm ruby_app bash` and install required gems (`bundle install`). It will give you a fully working development environment with
|
339
|
+
Run `docker compose run --rm ruby_app bash` and install required gems (`bundle install`). It will give you a fully working development environment with Milvus services and gem's code.
|
324
340
|
|
325
341
|
For example inside docker container run `bin/console` and inside the ruby console:
|
326
342
|
```ruby
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# https://docs.zilliz.com/reference/restful/alias-operations-v2
|
2
|
+
|
3
|
+
module Milvus
|
4
|
+
class Aliases < Base
|
5
|
+
PATH = "aliases"
|
6
|
+
|
7
|
+
# Lists available roles on the server
|
8
|
+
#
|
9
|
+
# @return [Hash] The response from the server
|
10
|
+
def list
|
11
|
+
response = client.connection.post("#{PATH}/list") do |req|
|
12
|
+
req.body = {}
|
13
|
+
end
|
14
|
+
|
15
|
+
response.body
|
16
|
+
end
|
17
|
+
|
18
|
+
# Describes the details of a specific alias
|
19
|
+
#
|
20
|
+
# @param alias_name [String] The name of the alias to describe
|
21
|
+
# @return [Hash] The response from the server
|
22
|
+
def describe(alias_name:)
|
23
|
+
response = client.connection.post("#{PATH}/describe") do |req|
|
24
|
+
req.body = {
|
25
|
+
aliasName: alias_name
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
response.body
|
30
|
+
end
|
31
|
+
|
32
|
+
# Reassigns the alias of one collection to another
|
33
|
+
#
|
34
|
+
# @param alias_name [String] The alias of the collection
|
35
|
+
# @param collection_name [String] The name of the target collection to reassign an alias to
|
36
|
+
# @return [Hash] The response from the server
|
37
|
+
def alter(alias_name:, collection_name:)
|
38
|
+
response = client.connection.post("#{PATH}/alter") do |req|
|
39
|
+
req.body = {
|
40
|
+
aliasName: alias_name,
|
41
|
+
collectionName: collection_name
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
response.body
|
46
|
+
end
|
47
|
+
|
48
|
+
# This operation drops a specified alias
|
49
|
+
#
|
50
|
+
# @param alias_name [String] The alias to drop
|
51
|
+
# @return [Hash] The response from the server
|
52
|
+
def drop(alias_name:)
|
53
|
+
response = client.connection.post("#{PATH}/drop") do |req|
|
54
|
+
req.body = {
|
55
|
+
aliasName: alias_name
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
59
|
+
response.body
|
60
|
+
end
|
61
|
+
|
62
|
+
# This operation creates an alias for an existing collection. A collection can have multiple aliases, while an alias can be associated with only one collection.
|
63
|
+
#
|
64
|
+
# @param alias_name [String] The alias of the collection
|
65
|
+
# @param collection_name [String] The name of the target collection to reassign an alias to
|
66
|
+
# @return [Hash] The response from the server
|
67
|
+
def create(alias_name:, collection_name:)
|
68
|
+
response = client.connection.post("#{PATH}/create") do |req|
|
69
|
+
req.body = {
|
70
|
+
aliasName: alias_name,
|
71
|
+
collectionName: collection_name
|
72
|
+
}
|
73
|
+
end
|
74
|
+
|
75
|
+
response.body
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
data/lib/milvus/client.rb
CHANGED
@@ -4,13 +4,22 @@ require "faraday"
|
|
4
4
|
|
5
5
|
module Milvus
|
6
6
|
class Client
|
7
|
-
attr_reader :url, :api_key
|
7
|
+
attr_reader :url, :api_key, :adapter, :raise_error, :logger
|
8
8
|
|
9
9
|
API_VERSION = "v2/vectordb"
|
10
10
|
|
11
|
-
def initialize(
|
11
|
+
def initialize(
|
12
|
+
url:,
|
13
|
+
api_key: nil,
|
14
|
+
adapter: Faraday.default_adapter,
|
15
|
+
raise_error: false,
|
16
|
+
logger: nil
|
17
|
+
)
|
12
18
|
@url = url
|
13
19
|
@api_key = api_key
|
20
|
+
@adapter = adapter
|
21
|
+
@raise_error = raise_error
|
22
|
+
@logger = logger || Logger.new($stdout)
|
14
23
|
end
|
15
24
|
|
16
25
|
def collections
|
@@ -37,14 +46,20 @@ module Milvus
|
|
37
46
|
@users ||= Milvus::Users.new(client: self)
|
38
47
|
end
|
39
48
|
|
49
|
+
def aliases
|
50
|
+
@aliases ||= Milvus::Aliases.new(client: self)
|
51
|
+
end
|
52
|
+
|
40
53
|
def connection
|
41
54
|
@connection ||= Faraday.new(url: "#{url}/#{API_VERSION}/") do |faraday|
|
42
55
|
if api_key
|
43
56
|
faraday.request :authorization, :Bearer, api_key
|
44
57
|
end
|
45
58
|
faraday.request :json
|
59
|
+
faraday.response :logger, logger, {headers: true, bodies: true, errors: true}
|
60
|
+
faraday.response :raise_error if raise_error
|
46
61
|
faraday.response :json, content_type: /\bjson$/
|
47
|
-
faraday.adapter
|
62
|
+
faraday.adapter adapter
|
48
63
|
end
|
49
64
|
end
|
50
65
|
end
|
data/lib/milvus/version.rb
CHANGED
data/lib/milvus.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: milvus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrei Bondarev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry-byebug
|
@@ -62,6 +62,7 @@ files:
|
|
62
62
|
- Rakefile
|
63
63
|
- docker-compose.yml
|
64
64
|
- lib/milvus.rb
|
65
|
+
- lib/milvus/aliases.rb
|
65
66
|
- lib/milvus/base.rb
|
66
67
|
- lib/milvus/client.rb
|
67
68
|
- lib/milvus/collections.rb
|
@@ -96,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
97
|
- !ruby/object:Gem::Version
|
97
98
|
version: '0'
|
98
99
|
requirements: []
|
99
|
-
rubygems_version: 3.5.
|
100
|
+
rubygems_version: 3.5.20
|
100
101
|
signing_key:
|
101
102
|
specification_version: 4
|
102
103
|
summary: Ruby wrapper for the Milvus vector search database API
|