names

package
v0.22.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package names is a generated protocol buffer package.

It is generated from these files:

names.proto

It has these top-level messages:

Entry

Index

Constants

View Source
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

View Source
var (
	ErrInvalidLengthNames = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowNames   = fmt.Errorf("proto: integer overflow")
)
View Source
var MinNameRegistrationPeriod uint64 = 5

Functions

func NameBaseCost

func NameBaseCost(name, data string) uint64

base cost is "effective" number of bytes

func NameCostForExpiryIn added in v0.20.0

func NameCostForExpiryIn(name, data string, expiresIn uint64) uint64

func NameCostPerBlock

func NameCostPerBlock(baseCost uint64) uint64

Types

type Cache

type Cache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

The Cache helps prevent unnecessary IAVLTree updates and garbage generation.

func NewCache

func NewCache(backend Reader) *Cache

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) Backend

func (cache *Cache) Backend() Reader

func (*Cache) Flush

func (cache *Cache) Flush(output Writer, backend Reader) error

Syncs the Cache and Resets it to use Writer as the backend Reader

func (*Cache) GetName added in v0.20.0

func (cache *Cache) GetName(name string) (*Entry, error)

func (*Cache) RemoveName added in v0.20.0

func (cache *Cache) RemoveName(name string) error

func (*Cache) Reset

func (cache *Cache) Reset(backend Reader)

Resets the cache to empty initialising the backing map to the same size as the previous iteration.

func (*Cache) Sync

func (cache *Cache) Sync(state Writer) error

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) UpdateName added in v0.20.0

func (cache *Cache) UpdateName(entry *Entry) error

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"`
}

NameReg provides a global key value store based on Name, Data pairs that are subject to expiry and ownership by an account.

func DecodeEntry

func DecodeEntry(entryBytes []byte) (*Entry, error)

func (*Entry) Descriptor added in v0.20.0

func (*Entry) Descriptor() ([]byte, []int)

func (*Entry) Encode

func (e *Entry) Encode() ([]byte, error)

func (*Entry) GetData added in v0.20.0

func (m *Entry) GetData() string

func (*Entry) GetExpires added in v0.20.0

func (m *Entry) GetExpires() uint64

func (*Entry) GetName added in v0.20.0

func (m *Entry) GetName() string

func (*Entry) Marshal added in v0.20.0

func (m *Entry) Marshal() (dAtA []byte, err error)

func (*Entry) MarshalTo added in v0.20.0

func (m *Entry) MarshalTo(dAtA []byte) (int, error)

func (*Entry) ProtoMessage added in v0.20.0

func (*Entry) ProtoMessage()

func (*Entry) Reset added in v0.20.0

func (m *Entry) Reset()

func (*Entry) Size added in v0.20.0

func (m *Entry) Size() (n int)

func (*Entry) String added in v0.20.0

func (e *Entry) String() string

func (*Entry) Tagged added in v0.20.0

func (e *Entry) Tagged() *TaggedEntry

func (*Entry) Unmarshal added in v0.20.0

func (m *Entry) Unmarshal(dAtA []byte) error

func (*Entry) XXX_MessageName added in v0.20.0

func (*Entry) XXX_MessageName() string

type Iterable

type Iterable interface {
	IterateNames(consumer func(*Entry) (stop bool)) (stopped bool, err error)
}

type IterableReader

type IterableReader interface {
	Iterable
	Reader
}

type IterableReaderWriter

type IterableReaderWriter interface {
	Iterable
	ReaderWriter
}

type Reader

type Reader interface {
	GetName(name string) (*Entry, error)
}

type ReaderWriter

type ReaderWriter interface {
	Reader
	Writer
}

type TaggedEntry added in v0.20.0

type TaggedEntry struct {
	*Entry
	query.Tagged
}

type Writer

type Writer interface {
	// Updates the name entry creating it if it does not exist
	UpdateName(entry *Entry) error
	// Remove the name entry
	RemoveName(name string) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL