Class: Qdrant::Snapshots

Inherits:
Base
  • Object
show all
Defined in:
lib/qdrant/snapshots.rb

Constant Summary collapse

PATH =
"snapshots"

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 Qdrant::Base

Instance Method Details

#createObject

Create new snapshot of the whole storage



14
15
16
17
# File 'lib/qdrant/snapshots.rb', line 14

def create
  response = client.connection.post(PATH)
  response.body
end

#delete(snapshot_name:) ⇒ Object

Delete snapshot of the whole storage



20
21
22
23
24
25
# File 'lib/qdrant/snapshots.rb', line 20

def delete(
  snapshot_name:
)
  response = client.connection.delete("#{PATH}/#{snapshot_name}")
  response.body
end

#download(snapshot_name:, filepath:) ⇒ Object

Download specified snapshot of the whole storage as a file



28
29
30
31
32
33
34
# File 'lib/qdrant/snapshots.rb', line 28

def download(
  snapshot_name:,
  filepath:
)
  response = client.connection.get("#{PATH}/#{snapshot_name}")
  File.open(File.expand_path(filepath), "wb+") { |fp| fp.write(response.body) }
end

#listObject

Get list of snapshots of the whole storage



8
9
10
11
# File 'lib/qdrant/snapshots.rb', line 8

def list
  response = client.connection.get(PATH)
  response.body
end