class Universa::ChainStore
Work iun progress, not to use as for now.
The storage interface capable to store contracts in chains, providing search and attributes. This class is not a store itself but the base class for it, having common boilerplate and sort of interface to implement. _Under development, we might change it_
Public Instance Methods
Same as {#store_contract} but returns store @param [Contract] contract to add @return [ChainStore] self
# File lib/universa/chain_store.rb, line 24 def <<(contract) store_contract(contract) self end
Count contracts in the store. This operation could be slow.
# File lib/universa/chain_store.rb, line 36 def count raise NotImplementedError end
@return [Contract] with the corresponding id or nil @param [HashId] hash_id instance to look for
# File lib/universa/chain_store.rb, line 31 def find_by_id(hash_id) raise NotImplementedError end
@return [Contract] with the corresponding id or raise. @param [HashId] hash_id instance to look for @raise [NotFoundError]
# File lib/universa/chain_store.rb, line 43 def find_by_id! hash_id find_by_id(hash_id) or raise NotFoundError end
Find all contracts with this parent id. @param [HashId] hash_id of the parent contract @return [Array] all the contracts that match this criterion
# File lib/universa/chain_store.rb, line 50 def find_by_parent(hash_id) raise NotImplementedError end
Save contract to the store. When this method returns, the contract must me already stored. If the contract with such hasId is already stored, just returns it.
@param [Object] contract to store @return [StoredContract] for this contract
# File lib/universa/chain_store.rb, line 17 def store_contract(contract) raise NotImplementedError end