dbstack

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBStack

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

DBStack allows performing basic stack operations on a stack of meshdb.MiniHeaders stored in the DB backing our meshdb package.

func New

func New(meshDB *meshdb.MeshDB, limit int) *DBStack

New instantiates a new stack with the specified size limit. Once the size limit is reached, adding additional blocks will evict the deepest block.

func (*DBStack) Clear

func (b *DBStack) Clear() error

Clear removes all items from the stack

func (*DBStack) Peek

func (b *DBStack) Peek() (*miniheader.MiniHeader, error)

Peek returns the latest block header from the block stack without removing it. It returns nil if the stack is empty.

func (*DBStack) PeekAll

func (b *DBStack) PeekAll() ([]*miniheader.MiniHeader, error)

PeekAll returns all the block headers currently on the stack

func (*DBStack) Pop

func (b *DBStack) Pop() (*miniheader.MiniHeader, error)

Pop removes and returns the latest block header on the block stack. It returns nil if the stack is empty.

func (*DBStack) Push

func (b *DBStack) Push(block *miniheader.MiniHeader) error

Push pushes a block header onto the block stack. If the stack limit is reached, it will remove the oldest block header.

Jump to

Keyboard shortcuts

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