class Ethereum::DB::OverlayDB

Used for making temporary objects.

Public Class Methods

new(db) click to toggle source
# File lib/ethereum/db/overlay_db.rb, line 10
def initialize(db)
  @db = db
  @overlay = {}
end

Public Instance Methods

==(other) click to toggle source
# File lib/ethereum/db/overlay_db.rb, line 46
def ==(other)
  other.instance_of?(self.class) && db = other.db
end
cleanup(epoch) click to toggle source
# File lib/ethereum/db/overlay_db.rb, line 66
def cleanup(epoch)
  # do nothing
end
commit() click to toggle source
# File lib/ethereum/db/overlay_db.rb, line 37
def commit
  # do nothing
end
commit_refcount_changes(epoch) click to toggle source
# File lib/ethereum/db/overlay_db.rb, line 62
def commit_refcount_changes(epoch)
  # do nothing
end
dec_refcount(k) click to toggle source
# File lib/ethereum/db/overlay_db.rb, line 54
def dec_refcount(k)
  # do nothing
end
delete(k) click to toggle source
# File lib/ethereum/db/overlay_db.rb, line 33
def delete(k)
  @overlay[k] = nil
end
get(k) click to toggle source
# File lib/ethereum/db/overlay_db.rb, line 15
def get(k)
  if @overlay.has_key?(k)
    raise KeyError, k.inspect if @overlay[k].nil?
    return @overlay[k]
  end

  db.get k
end
has_key?(k) click to toggle source
# File lib/ethereum/db/overlay_db.rb, line 41
def has_key?(k)
  @overlay.has_key?(k) ? !@overlay[k].nil? : db.has_key?(k)
end
Also aliased as: include?
inc_refcount(k, v) click to toggle source
# File lib/ethereum/db/overlay_db.rb, line 50
def inc_refcount(k, v)
  put k, v
end
include?(k)
Alias for: has_key?
put(k, v) click to toggle source
# File lib/ethereum/db/overlay_db.rb, line 24
def put(k, v)
  @overlay[k] = v
end
put_temporarily(k, v) click to toggle source
# File lib/ethereum/db/overlay_db.rb, line 28
def put_temporarily(k, v)
  inc_refcount k, v
  dec_refcount k
end
revert_refcount_changes(epoch) click to toggle source
# File lib/ethereum/db/overlay_db.rb, line 58
def revert_refcount_changes(epoch)
  # do nothing
end