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: ? 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 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