simplestack

package
v7.1.0-beta+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2020 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 SimpleStack

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

SimpleStack is a simple in-memory stack used in tests

func New

func New(retentionLimit int, miniHeaders []*miniheader.MiniHeader) *SimpleStack

New instantiates a new SimpleStack

func (*SimpleStack) Checkpoint

func (s *SimpleStack) Checkpoint() (int, error)

Checkpoint checkpoints the changes to the stack such that a subsequent call to `Reset(checkpointID)` with the checkpointID returned from this call will reset any subsequent changes back to the state of the stack at the time of this checkpoint

func (*SimpleStack) Clear

func (s *SimpleStack) Clear() error

Clear removes all items from the stack and clears any set checkpoint

func (*SimpleStack) GetUpdates

func (s *SimpleStack) GetUpdates() []*Update

GetUpdates returns the updates applied since the last checkpoint

func (*SimpleStack) Peek

func (s *SimpleStack) Peek() (*miniheader.MiniHeader, error)

Peek returns the top of the stack

func (*SimpleStack) PeekAll

func (s *SimpleStack) PeekAll() ([]*miniheader.MiniHeader, error)

PeekAll returns all the miniHeaders currently in the stack

func (*SimpleStack) Pop

func (s *SimpleStack) Pop() (*miniheader.MiniHeader, error)

Pop returns the top of the stack and removes it from the stack

func (*SimpleStack) Push

func (s *SimpleStack) Push(miniHeader *miniheader.MiniHeader) error

Push adds a miniheader.MiniHeader to the stack

func (*SimpleStack) Reset

func (s *SimpleStack) Reset(checkpointID int) error

Reset resets the in-memory stack with the contents from the latest checkpoint

type Update

type Update struct {
	Type       UpdateType
	MiniHeader *miniheader.MiniHeader
}

Update represents one update to the stack, either a pop or push of a miniHeader.

type UpdateType

type UpdateType int

UpdateType is the type of update applied to the in-memory stack

const (
	Pop UpdateType = iota
	Push
)

UpdateType values

Jump to

Keyboard shortcuts

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