Class: Fog::External::Backend::Bertrpc

Inherits:
Object
  • Object
show all
Defined in:
lib/fog/external/backend/bertrpc.rb

Constant Summary collapse

METHODS =
%w(create_directory list_directories get_directory destroy_directory list_files head_file get_file destroy_file save_file)

Instance Method Summary collapse

Constructor Details

#initialize(host, port) ⇒ Bertrpc

Returns a new instance of Bertrpc.



8
9
10
11
# File 'lib/fog/external/backend/bertrpc.rb', line 8

def initialize(host, port)
  @service = BERTRPC::Service.new(host, port)
  @module = @service.call.fog
end

Instance Method Details

#get_file(key) ⇒ Object



21
22
23
24
25
26
# File 'lib/fog/external/backend/bertrpc.rb', line 21

def get_file(key)
  res = @module.get_file(key)
  return nil if res.nil?
  res[:body] = Base64.decode64(res[:body])
  res
end

#save_file(key, body) ⇒ Object



28
29
30
31
# File 'lib/fog/external/backend/bertrpc.rb', line 28

def save_file(key, body)
  body = Base64.encode64(body)
  @module.save_file(key, body)
end