Class: Milvus::Aliases

Inherits:
Base
  • Object
show all
Defined in:
lib/milvus/aliases.rb

Constant Summary collapse

PATH =
"aliases"

Instance Attribute Summary

Attributes inherited from Base

#client

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Milvus::Base

Instance Method Details

#alter(alias_name:, collection_name:) ⇒ Hash

Reassigns the alias of one collection to another

Parameters:

  • alias_name (String)

    The alias of the collection

  • collection_name (String)

    The name of the target collection to reassign an alias to

Returns:

  • (Hash)

    The response from the server



37
38
39
40
41
42
43
44
45
46
# File 'lib/milvus/aliases.rb', line 37

def alter(alias_name:, collection_name:)
  response = client.connection.post("#{PATH}/alter") do |req|
    req.body = {
      aliasName: alias_name,
      collectionName: collection_name
    }
  end

  response.body
end

#create(alias_name:, collection_name:) ⇒ Hash

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.

Parameters:

  • alias_name (String)

    The alias of the collection

  • collection_name (String)

    The name of the target collection to reassign an alias to

Returns:

  • (Hash)

    The response from the server



67
68
69
70
71
72
73
74
75
76
# File 'lib/milvus/aliases.rb', line 67

def create(alias_name:, collection_name:)
  response = client.connection.post("#{PATH}/create") do |req|
    req.body = {
      aliasName: alias_name,
      collectionName: collection_name
    }
  end

  response.body
end

#describe(alias_name:) ⇒ Hash

Describes the details of a specific alias

Parameters:

  • alias_name (String)

    The name of the alias to describe

Returns:

  • (Hash)

    The response from the server



22
23
24
25
26
27
28
29
30
# File 'lib/milvus/aliases.rb', line 22

def describe(alias_name:)
  response = client.connection.post("#{PATH}/describe") do |req|
    req.body = {
      aliasName: alias_name
    }
  end

  response.body
end

#drop(alias_name:) ⇒ Hash

This operation drops a specified alias

Parameters:

  • alias_name (String)

    The alias to drop

Returns:

  • (Hash)

    The response from the server



52
53
54
55
56
57
58
59
60
# File 'lib/milvus/aliases.rb', line 52

def drop(alias_name:)
  response = client.connection.post("#{PATH}/drop") do |req|
    req.body = {
      aliasName: alias_name
    }
  end

  response.body
end

#listHash

Lists available roles on the server

Returns:

  • (Hash)

    The response from the server



10
11
12
13
14
15
16
# File 'lib/milvus/aliases.rb', line 10

def list
  response = client.connection.post("#{PATH}/list") do |req|
    req.body = {}
  end

  response.body
end