Documentation
¶
Index ¶
- type Linear
- func (m Linear) Delete(index uint64)
- func (m Linear) ElemKey(index uint64) []byte
- func (m Linear) Flush(ptr interface{}, fn func() bool)
- func (m Linear) Get(index uint64, ptr interface{}) error
- func (m Linear) IsEmpty() bool
- func (m Linear) Iterate(ptr interface{}, fn func(uint64) bool)
- func (m Linear) Len() (res uint64)
- func (m Linear) LengthKey() []byte
- func (m Linear) Peek(ptr interface{}) error
- func (m Linear) Pop()
- func (m Linear) Push(value interface{})
- func (m Linear) Set(index uint64, value interface{})
- func (m Linear) TopKey() []byte
- type LinearKeys
- type List
- type Queue
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
type LinearKeys ¶
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
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
Click to show internal directories.
Click to hide internal directories.