Documentation ¶
Index ¶
- type SimpleStack
- func (s *SimpleStack) Checkpoint() int
- func (s *SimpleStack) Clear()
- func (s *SimpleStack) GetUpdates() []*Update
- func (s *SimpleStack) Peek() *types.MiniHeader
- func (s *SimpleStack) PeekAll() []*types.MiniHeader
- func (s *SimpleStack) Pop() *types.MiniHeader
- func (s *SimpleStack) Push(miniHeader *types.MiniHeader) error
- func (s *SimpleStack) Reset(checkpointID int) error
- type Update
- type UpdateType
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 []*types.MiniHeader) *SimpleStack
New instantiates a new SimpleStack.
func (*SimpleStack) Checkpoint ¶
func (s *SimpleStack) Checkpoint() int
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()
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() *types.MiniHeader
Peek returns the top of the stack.
func (*SimpleStack) PeekAll ¶
func (s *SimpleStack) PeekAll() []*types.MiniHeader
PeekAll returns all the miniHeaders currently in the stack.
func (*SimpleStack) Pop ¶
func (s *SimpleStack) Pop() *types.MiniHeader
Pop returns the top of the stack and removes it from the stack.
func (*SimpleStack) Push ¶
func (s *SimpleStack) Push(miniHeader *types.MiniHeader) error
Push adds a types.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 *types.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 )