Class: Ethereum::DB::EphemDB
- Includes:
- BaseDB
- Defined in:
- lib/ethereum/db/ephem_db.rb
Instance Attribute Summary
Attributes included 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.
8 9 10 |
# File 'lib/ethereum/db/ephem_db.rb', line 8 def initialize @db = {} end |
Instance Method Details
#==(other) ⇒ Object
37 38 39 |
# File 'lib/ethereum/db/ephem_db.rb', line 37 def ==(other) other.instance_of?(self.class) && db == other.db end |
#cleanup(epoch) ⇒ Object
57 58 59 |
# File 'lib/ethereum/db/ephem_db.rb', line 57 def cleanup(epoch) # do nothing end |
#commit ⇒ Object
28 29 30 |
# File 'lib/ethereum/db/ephem_db.rb', line 28 def commit # do nothing end |
#commit_refcount_changes(epoch) ⇒ Object
53 54 55 |
# File 'lib/ethereum/db/ephem_db.rb', line 53 def commit_refcount_changes(epoch) # do nothing end |
#dec_refcount(k) ⇒ Object
45 46 47 |
# File 'lib/ethereum/db/ephem_db.rb', line 45 def dec_refcount(k) # do nothing end |
#delete(k) ⇒ Object
24 25 26 |
# File 'lib/ethereum/db/ephem_db.rb', line 24 def delete(k) @db.delete(k) end |
#get(k) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/ethereum/db/ephem_db.rb', line 12 def get(k) if has_key?(k) @db[k] else raise KeyError, k.inspect end end |
#has_key?(k) ⇒ Boolean Also known as: include?
32 33 34 |
# File 'lib/ethereum/db/ephem_db.rb', line 32 def has_key?(k) @db.has_key?(k) end |
#inc_refcount(k, v) ⇒ Object
41 42 43 |
# File 'lib/ethereum/db/ephem_db.rb', line 41 def inc_refcount(k, v) put k, v end |
#put(k, v) ⇒ Object
20 21 22 |
# File 'lib/ethereum/db/ephem_db.rb', line 20 def put(k, v) @db[k] = v end |
#put_temporarily(k, v) ⇒ Object
61 62 63 64 |
# File 'lib/ethereum/db/ephem_db.rb', line 61 def put_temporarily(k, v) inc_refcount(k, v) dec_refcount(k) end |
#revert_refcount_changes(epoch) ⇒ Object
49 50 51 |
# File 'lib/ethereum/db/ephem_db.rb', line 49 def revert_refcount_changes(epoch) # do nothing end |