Class: Milvus::Partitions
Constant Summary collapse
- PATH =
"partitions"
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#create(collection_name:, partition_name:) ⇒ Object
This operation creates a partition in a collection.
-
#drop(collection_name:, partition_name:) ⇒ Hash
This operation drops the current partition.
-
#get_stats(collection_name:, partition_name:) ⇒ Hash
This operations gets the number of entities in a partition.
-
#has(collection_name:, partition_name:) ⇒ Hash
This operation checks whether a partition exists.
-
#list(collection_name:) ⇒ Hash
This operation lists all partitions in the database used in the current connection.
-
#load(collection_name:, partition_names:) ⇒ Hash
This operation loads the data of the current partition into memory.
-
#release(collection_name:, partition_names:) ⇒ Hash
This operation releases the data of the current partition from memory.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Milvus::Base
Instance Method Details
#create(collection_name:, partition_name:) ⇒ Object
This operation creates a partition in a collection.
22 23 24 25 26 27 28 29 30 |
# File 'lib/milvus/partitions.rb', line 22 def create(collection_name:, partition_name:) response = client.connection.post("#{PATH}/create") do |req| req.body = { collectionName: collection_name, partitionName: partition_name } end response.body.empty? ? true : response.body end |
#drop(collection_name:, partition_name:) ⇒ Hash
This operation drops the current partition. To successfully drop a partition, ensure that the partition is already released.
37 38 39 40 41 42 43 44 45 |
# File 'lib/milvus/partitions.rb', line 37 def drop(collection_name:, partition_name:) response = client.connection.post("#{PATH}/drop") do |req| req.body = { collectionName: collection_name, partitionName: partition_name } end response.body.empty? ? true : response.body end |
#get_stats(collection_name:, partition_name:) ⇒ Hash
This operations gets the number of entities in a partition.
97 98 99 100 101 102 103 104 105 |
# File 'lib/milvus/partitions.rb', line 97 def get_stats(collection_name:, partition_name:) response = client.connection.post("#{PATH}/get_stats") do |req| req.body = { collectionName: collection_name, partitionName: partition_name } end response.body.empty? ? true : response.body end |
#has(collection_name:, partition_name:) ⇒ Hash
This operation checks whether a partition exists.
52 53 54 55 56 57 58 59 60 |
# File 'lib/milvus/partitions.rb', line 52 def has(collection_name:, partition_name:) response = client.connection.post("#{PATH}/has") do |req| req.body = { collectionName: collection_name, partitionName: partition_name } end response.body.empty? ? true : response.body end |
#list(collection_name:) ⇒ Hash
This operation lists all partitions in the database used in the current connection.
11 12 13 14 15 16 |
# File 'lib/milvus/partitions.rb', line 11 def list(collection_name:) response = client.connection.post("#{PATH}/list") do |req| req.body = {collectionName: collection_name} end response.body.empty? ? true : response.body end |
#load(collection_name:, partition_names:) ⇒ Hash
This operation loads the data of the current partition into memory.
67 68 69 70 71 72 73 74 75 |
# File 'lib/milvus/partitions.rb', line 67 def load(collection_name:, partition_names:) response = client.connection.post("#{PATH}/load") do |req| req.body = { collectionName: collection_name, partitionNames: partition_names } end response.body.empty? ? true : response.body end |
#release(collection_name:, partition_names:) ⇒ Hash
This operation releases the data of the current partition from memory.
82 83 84 85 86 87 88 89 90 |
# File 'lib/milvus/partitions.rb', line 82 def release(collection_name:, partition_names:) response = client.connection.post("#{PATH}/release") do |req| req.body = { collectionName: collection_name, partitionNames: partition_names } end response.body.empty? ? true : response.body end |