lib

package
v0.23.1 Latest Latest
Warning

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

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

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Linear

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

Linear defines a primitive mapper type

func NewLinear

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

NewLinear constructs new Linear

func (Linear) Delete

func (m Linear) Delete(index uint64)

Delete implements List

func (Linear) ElemKey

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

Key for the elements of the list

func (Linear) Flush

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

Flush implements Queue

func (Linear) Get

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

Get implements List

func (Linear) IsEmpty

func (m Linear) IsEmpty() bool

IsEmpty implements Queue

func (Linear) Iterate

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

IterateRead implements List

func (Linear) Len

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

Len implements List

func (Linear) LengthKey

func (m Linear) LengthKey() []byte

Key for the length of the list

func (Linear) Peek

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

Peek implements Queue

func (Linear) Pop

func (m Linear) Pop()

Pop implements Queue

func (Linear) Push

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

Push implements List

func (Linear) Set

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

Set implements List

func (Linear) TopKey

func (m Linear) TopKey() []byte

Key for the top element position in the queue

type LinearKeys

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

LinearKeys defines keysions for the key bytes

func DefaultLinearKeys

func DefaultLinearKeys() *LinearKeys

DefaultLinearKeys returns the default setting of LinearOption

type List

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

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

NewList constructs new List

type Queue

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

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