lib

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Linear added in v0.20.0

type Linear struct {
	// contains filtered or unexported fields
}

Linear defines a primitive mapper type

func NewLinear added in v0.20.0

func NewLinear(cdc *wire.Codec, store sdk.KVStore, keys *LinearKeys) Linear

NewLinear constructs new Linear

func (Linear) Delete added in v0.20.0

func (m Linear) Delete(index uint64)

Delete implements List

func (Linear) ElemKey added in v0.20.0

func (m Linear) ElemKey(index uint64) []byte

Key for the elements of the list

func (Linear) Flush added in v0.20.0

func (m Linear) Flush(ptr interface{}, fn func() bool)

Flush implements Queue

func (Linear) Get added in v0.20.0

func (m Linear) Get(index uint64, ptr interface{}) error

Get implements List

func (Linear) IsEmpty added in v0.20.0

func (m Linear) IsEmpty() bool

IsEmpty implements Queue

func (Linear) Iterate added in v0.20.0

func (m Linear) Iterate(ptr interface{}, fn func(uint64) bool)

IterateRead implements List

func (Linear) Len added in v0.20.0

func (m Linear) Len() (res uint64)

Len implements List

func (Linear) LengthKey added in v0.20.0

func (m Linear) LengthKey() []byte

Key for the length of the list

func (Linear) Peek added in v0.20.0

func (m Linear) Peek(ptr interface{}) error

Peek implements Queue

func (Linear) Pop added in v0.20.0

func (m Linear) Pop()

Pop implements Queue

func (Linear) Push added in v0.20.0

func (m Linear) Push(value interface{})

Push implements List

func (Linear) Set added in v0.20.0

func (m Linear) Set(index uint64, value interface{})

Set implements List

func (Linear) TopKey added in v0.20.0

func (m Linear) TopKey() []byte

Key for the top element position in the queue

type LinearKeys added in v0.20.0

type LinearKeys struct {
	LengthKey []byte
	ElemKey   []byte
	TopKey    []byte
}

LinearKeys defines keysions for the key bytes

func DefaultLinearKeys added in v0.20.0

func DefaultLinearKeys() *LinearKeys

DefaultLinearKeys returns the default setting of LinearOption

type List added in v0.20.0

type List interface {

	// Len() returns the length of the list
	// The length is only increased by Push() and not decreased
	// List dosen't check if an index is in bounds
	// The user should check Len() before doing any actions
	Len() uint64

	// Get() returns the element by its index
	Get(uint64, interface{}) error

	// Set() stores the element to the given position
	// Setting element out of range will break length counting
	// Use Push() instead of Set() to append a new element
	Set(uint64, interface{})

	// Delete() deletes the element in the given position
	// Other elements' indices are preserved after deletion
	// Panics when the index is out of range
	Delete(uint64)

	// Push() inserts the element to the end of the list
	// It will increase the length when it is called
	Push(interface{})

	// CONTRACT: No writes may happen within a domain while iterating over it.
	Iterate(interface{}, func(uint64) bool)
}

List is a Linear interface that provides list-like functions It panics when the element type cannot be (un/)marshalled by the codec

func NewList added in v0.20.0

func NewList(cdc *wire.Codec, store sdk.KVStore, keys *LinearKeys) List

NewList constructs new List

type Queue added in v0.20.0

type Queue interface {
	// Push() inserts the elements to the rear of the queue
	Push(interface{})

	// Peek() returns the element at the front of the queue without removing it
	Peek(interface{}) error

	// Pop() returns the element at the front of the queue and removes it
	Pop()

	// IsEmpty() checks if the queue is empty
	IsEmpty() bool

	// Flush() removes elements it processed
	// Return true in the continuation to break
	// The interface{} is unmarshalled before the continuation is called
	// Starts from the top(head) of the queue
	// CONTRACT: Pop() or Push() should not be performed while flushing
	Flush(interface{}, func() bool)
}

Queue is a Linear interface that provides queue-like functions It panics when the element type cannot be (un/)marshalled by the codec

func NewQueue added in v0.20.0

func NewQueue(cdc *wire.Codec, store sdk.KVStore, keys *LinearKeys) Queue

NewQueue constructs new Queue

Jump to

Keyboard shortcuts

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