class TritonOps::Snapshot::Catalog

Attributes

namespace[RW]

Public Class Methods

new(**options) click to toggle source
# File lib/triton-ops/snapshot/catalog.rb, line 10
def initialize(**options)
  @namespace = options.fetch(:namespace) { '' }
  self
end

Public Instance Methods

get(headnode, snapshot, property = :all) click to toggle source
# File lib/triton-ops/snapshot/catalog.rb, line 31
def get(headnode, snapshot, property = :all)
  TritonOps::Snapshot.new headnode, snapshot, namespace: @namespace
end
headnodes() click to toggle source
# File lib/triton-ops/snapshot/catalog.rb, line 17
def headnodes
  redis.smembers("#{namespace}/headnodes") || []
end
properties(headnode, snapshot) click to toggle source
# File lib/triton-ops/snapshot/catalog.rb, line 26
def properties(headnode, snapshot)
  return [] unless snapshots(headnode).include? snapshot
  redis.smembers("#{namespace}/headnode/#{headnode}/snapshot/#{snapshot}") || []
end
snapshots(headnode) click to toggle source
# File lib/triton-ops/snapshot/catalog.rb, line 21
def snapshots(headnode)
  return [] unless headnodes.include? headnode
  redis.smembers("#{namespace}/headnode/#{headnode}/snapshots") || []
end

Private Instance Methods

redis() click to toggle source
# File lib/triton-ops/snapshot/catalog.rb, line 37
def redis
  @redis ||= Redis.new
end