Class: Ethereum::DB::EphemDB
- Defined in:
- lib/ethereum/db/ephem_db.rb
Instance Attribute Summary
Attributes inherited from BaseDB
Instance Method Summary collapse
- #==(other) ⇒ Object
- #cleanup(epoch) ⇒ Object
- #commit ⇒ Object
- #commit_refcount_changes(epoch) ⇒ Object
- #dec_refcount(k) ⇒ Object
- #delete(k) ⇒ Object
- #get(k) ⇒ Object
- #has_key?(k) ⇒ Boolean (also: #include?)
- #inc_refcount(k, v) ⇒ Object
-
#initialize ⇒ EphemDB
constructor
A new instance of EphemDB.
- #put(k, v) ⇒ Object
- #put_temporarily(k, v) ⇒ Object
- #revert_refcount_changes(epoch) ⇒ Object
Constructor Details
#initialize ⇒ EphemDB
Returns a new instance of EphemDB.
7 8 9 |
# File 'lib/ethereum/db/ephem_db.rb', line 7 def initialize @db = {} end |
Instance Method Details
#==(other) ⇒ Object
32 33 34 |
# File 'lib/ethereum/db/ephem_db.rb', line 32 def ==(other) other.instance_of?(self.class) && db == other.db end |
#cleanup(epoch) ⇒ Object
52 53 54 |
# File 'lib/ethereum/db/ephem_db.rb', line 52 def cleanup(epoch) # do nothing end |
#commit ⇒ Object
23 24 25 |
# File 'lib/ethereum/db/ephem_db.rb', line 23 def commit # do nothing end |
#commit_refcount_changes(epoch) ⇒ Object
48 49 50 |
# File 'lib/ethereum/db/ephem_db.rb', line 48 def commit_refcount_changes(epoch) # do nothing end |
#dec_refcount(k) ⇒ Object
40 41 42 |
# File 'lib/ethereum/db/ephem_db.rb', line 40 def dec_refcount(k) # do nothing end |
#delete(k) ⇒ Object
19 20 21 |
# File 'lib/ethereum/db/ephem_db.rb', line 19 def delete(k) @db.delete(k) end |
#get(k) ⇒ Object
11 12 13 |
# File 'lib/ethereum/db/ephem_db.rb', line 11 def get(k) @db[k] or raise KeyError, k.inspect end |
#has_key?(k) ⇒ Boolean Also known as: include?
27 28 29 |
# File 'lib/ethereum/db/ephem_db.rb', line 27 def has_key?(k) @db.has_key?(k) end |
#inc_refcount(k, v) ⇒ Object
36 37 38 |
# File 'lib/ethereum/db/ephem_db.rb', line 36 def inc_refcount(k, v) put k, v end |
#put(k, v) ⇒ Object
15 16 17 |
# File 'lib/ethereum/db/ephem_db.rb', line 15 def put(k, v) @db[k] = v end |
#put_temporarily(k, v) ⇒ Object
56 57 58 59 |
# File 'lib/ethereum/db/ephem_db.rb', line 56 def put_temporarily(k, v) inc_refcount(k, v) dec_refcount(k) end |
#revert_refcount_changes(epoch) ⇒ Object
44 45 46 |
# File 'lib/ethereum/db/ephem_db.rb', line 44 def revert_refcount_changes(epoch) # do nothing end |