Documentation ¶
Index ¶
- Constants
- Variables
- func NameBaseCost(name, data string) uint64
- func NameCostForExpiryIn(name, data string, expiresIn uint64) 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) GetName(name string) (*Entry, error)
- func (cache *Cache) RemoveName(name string) error
- func (cache *Cache) Reset(backend Reader)
- func (cache *Cache) Sync(state Writer) error
- func (cache *Cache) UpdateName(entry *Entry) error
- type Entry
- func (*Entry) Descriptor() ([]byte, []int)
- func (e *Entry) Get(key string) (value interface{}, ok bool)
- func (m *Entry) GetData() string
- func (m *Entry) GetExpires() uint64
- func (m *Entry) GetName() string
- func (m *Entry) Marshal() (dAtA []byte, err error)
- func (m *Entry) MarshalTo(dAtA []byte) (int, error)
- func (m *Entry) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Entry) ProtoMessage()
- func (m *Entry) Reset()
- func (m *Entry) Size() (n int)
- func (e *Entry) String() string
- func (m *Entry) Unmarshal(dAtA []byte) error
- func (m *Entry) XXX_DiscardUnknown()
- func (m *Entry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Entry) XXX_Merge(src proto.Message)
- func (*Entry) XXX_MessageName() string
- func (m *Entry) XXX_Size() int
- func (m *Entry) XXX_Unmarshal(b []byte) error
- type Iterable
- type IterableReader
- type IterableReaderWriter
- type Reader
- type ReaderWriter
- type Writer
Constants ¶
const ( // 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 )
Variables ¶
var ( ErrInvalidLengthNames = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowNames = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupNames = fmt.Errorf("proto: unexpected end of group") )
var MinNameRegistrationPeriod uint64 = 5
Functions ¶
func NameBaseCost ¶
base cost is "effective" number of bytes
func NameCostForExpiryIn ¶ added in v0.20.0
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) RemoveName ¶ added in v0.20.0
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 Flush if your wish to use the output state as your next backend
func (*Cache) UpdateName ¶ added in v0.20.0
type Entry ¶
type Entry struct { // registered name for the entry Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` // address that created the entry Owner github_com_hyperledger_burrow_crypto.Address `protobuf:"bytes,2,opt,name=Owner,proto3,customtype=github.com/hyperledger/burrow/crypto.Address" json:"Owner"` // data to store under this name Data string `protobuf:"bytes,3,opt,name=Data,proto3" json:"Data,omitempty"` // block at which this entry expires Expires uint64 `protobuf:"varint,4,opt,name=Expires,proto3" json:"Expires,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
NameReg provides a global key value store based on Name, Data pairs that are subject to expiry and ownership by an account.
func (*Entry) Descriptor ¶ added in v0.20.0
func (*Entry) GetExpires ¶ added in v0.20.0
func (*Entry) MarshalToSizedBuffer ¶ added in v0.30.0
func (*Entry) ProtoMessage ¶ added in v0.20.0
func (*Entry) ProtoMessage()
func (*Entry) XXX_DiscardUnknown ¶ added in v0.23.0
func (m *Entry) XXX_DiscardUnknown()
func (*Entry) XXX_Marshal ¶ added in v0.23.0
func (*Entry) XXX_MessageName ¶ added in v0.20.0
func (*Entry) XXX_Unmarshal ¶ added in v0.23.0
type IterableReader ¶
type IterableReaderWriter ¶
type IterableReaderWriter interface { Iterable ReaderWriter }