Documentation ¶
Index ¶
- Variables
- func NameBaseCost(name, data string) uint64
- func NameCostPerBlock(baseCost uint64) uint64
- type Cache
- func (cache *Cache) Backend() Reader
- func (cache *Cache) Flush(output Writer, backend Reader) error
- func (cache *Cache) GetNameEntry(name string) (*Entry, error)
- func (cache *Cache) RemoveNameEntry(name string) error
- func (cache *Cache) Reset(backend Reader)
- func (cache *Cache) Sync(state Writer) error
- func (cache *Cache) UpdateNameEntry(entry *Entry) error
- type Entry
- type Iterable
- type IterableReader
- type IterableReaderWriter
- type Reader
- type ReaderWriter
- type Writer
Constants ¶
This section is empty.
Variables ¶
var ( MinNameRegistrationPeriod uint64 = 5 // cost for storing a name for a block is // CostPerBlock*CostPerByte*(len(data) + 32) NameByteCostMultiplier uint64 = 1 NameBlockCostMultiplier uint64 = 1 MaxNameLength = 64 MaxDataLength = 1 << 16 )
Functions ¶
func NameBaseCost ¶
base cost is "effective" number of bytes
func NameCostPerBlock ¶
Types ¶
type Cache ¶
The Cache helps prevent unnecessary IAVLTree updates and garbage generation.
func NewCache ¶
Returns a Cache that wraps an underlying NameRegCacheGetter to use on a cache miss, can write to an output Writer via Sync. Not goroutine safe, use syncStateCache if you need concurrent access
func (*Cache) RemoveNameEntry ¶
func (*Cache) Reset ¶
Resets the cache to empty initialising the backing map to the same size as the previous iteration.
func (*Cache) Sync ¶
Writes whatever is in the cache to the output Writer state. Does not flush the cache, to do that call Reset() after Sync or use Flusth if your wish to use the output state as your next backend
func (*Cache) UpdateNameEntry ¶
type Entry ¶
type Entry struct { // registered name for the entry Name string // address that created the entry Owner crypto.Address // data to store under this name Data string // block at which this entry expires Expires uint64 }
NameReg provides a global key value store based on Name, Data pairs that are subject to expiry and ownership by an account.
func DecodeEntry ¶
type IterableReader ¶
type IterableReaderWriter ¶
type IterableReaderWriter interface { Iterable ReaderWriter }