class Ccp::Kvs::Kyoto::Base

Public Instance Methods

info() click to toggle source

info

# File lib/ccp/kvs/kyoto/base.rb, line 11
def info
  raise "not implemented yet"
end
path() click to toggle source

kvs

# File lib/ccp/kvs/kyoto/base.rb, line 18
def path
  file = @source.to_s.sub(/#.*$/, '') # parse "foo.tch#mode=r"
  Pathname(file)
end

Private Instance Methods

atomic(&block) click to toggle source

Check ecode and then raise. too boring… The library should implement this as atomic operation!

# File lib/ccp/kvs/kyoto/base.rb, line 25
def atomic(&block)
  raise NotImplementedError, "tc keep ecode until new erros occured"

  if kyoto_error?
    raise "tc already error before atomic: #{@db.ecode}"
  end
  v = block.call
  kyoto_error! if kyoto_error?
  return v
end
error_message() click to toggle source
# File lib/ccp/kvs/kyoto/base.rb, line 48
def error_message
  if @db
    @db.error
  else
    '[Not Initialized]'
  end
rescue Exception => e
  "[BUG] #{e}"
end
kyoto_error!(label = nil) click to toggle source
# File lib/ccp/kvs/kyoto/base.rb, line 36
def kyoto_error!(label = nil)
  raise Ccp::Kvs::Kyoto::Error, "%s%s (%s)" % [label, error_message, @source]
end
kyoto_error?() click to toggle source
# File lib/ccp/kvs/kyoto/base.rb, line 40
def kyoto_error?
  @db.error.is_a?(KyotoCabinet::Error::XSUCCESS)
end
threading_error?() click to toggle source
# File lib/ccp/kvs/kyoto/base.rb, line 44
def threading_error?
  false
end