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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c38f7235b815b1f48dd2d61e445b99ca675f974d1dddeba02796bf02e353fdd1
4
- data.tar.gz: 4af6a551675f63cb17ee6f2c80a8ca000ea98ff028eeefa71f9593061ac04969
3
+ metadata.gz: 914040de2cf35a3985d67dbd19de618e00d82262b61220df8bbf517cee40f72f
4
+ data.tar.gz: d88ca74f1a6674cefadd0d790b3a3c828da1f2e585a2cd9b4d3fa9dca492115a
5
5
  SHA512:
6
- metadata.gz: 37d2666740b3e9df096e5f8b024a72fff37b60c53810f8dcbd5f0b14c4a008060d5cad78109664b74d7e2e76d21c8559cbb6c079b046032acd09491c5a3c3109
7
- data.tar.gz: 7c10d887561876c02e6f869807b01c339b2412137e3cefb584ce5451da815eafec06f5c4ea83bbd231862b9742aad08d711566a2660193016b9eb809eca7798b
6
+ metadata.gz: 5092e0ec3696ce6d8e8a7a9d8df199f32f9ef4172f3aa65e0d415312da019c47763beef7df1e4714e3adee53f806f0bfd79f35e99884d8df8abb5745755f73a1
7
+ data.tar.gz: 9580e92290a0a3f132b39629ff4bc25ef759b7b2d608cf744218bd529e9e54ac328194584db757af76b56f03790793468e9e6b6bebadc173301403fb17fc52bc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.10.3] - 2024-10-01
4
+ - Weaviate::Client constructor accepts customer logger: to be passed in
5
+ - Added Alias management
6
+
3
7
  ## [0.10.2] - 2024-07-28
4
8
  - Added Roles management
5
9
  - Added Users management
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- milvus (0.10.2)
4
+ milvus (0.10.3)
5
5
  faraday (>= 2.0.1, < 3)
6
6
 
7
7
  GEM
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 Milvius services and gem's code.
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(url:, api_key: nil)
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 Faraday.default_adapter
62
+ faraday.adapter adapter
48
63
  end
49
64
  end
50
65
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Milvus
4
- VERSION = "0.10.2"
4
+ VERSION = "0.10.3"
5
5
  end
data/lib/milvus.rb CHANGED
@@ -13,4 +13,5 @@ module Milvus
13
13
  autoload :Partitions, "milvus/partitions"
14
14
  autoload :Roles, "milvus/roles"
15
15
  autoload :Users, "milvus/users"
16
+ autoload :Aliases, "milvus/aliases"
16
17
  end
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.2
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-07-28 00:00:00.000000000 Z
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.14
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