memstream

package
v0.32.2 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	Offset uint64
	Value  any
}

Item to be kept inside stream.

type Stream

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

Stream is a non-thread safe in-memory data structure that maintains a stream of values limited by size and provides methods to access a range of values from provided position.

func New

func New() *Stream

New creates new Stream.

func (*Stream) Add

func (s *Stream) Add(v any, size int) (uint64, error)

Add item to stream.

func (*Stream) Clear

func (s *Stream) Clear()

Clear stream data.

func (*Stream) Epoch

func (s *Stream) Epoch() string

Epoch returns epoch of stream.

func (*Stream) Get

func (s *Stream) Get(offset uint64, useOffset bool, limit int, reverse bool) ([]Item, uint64, error)

Get items since provided position. If seq is zero then elements since current first element in stream will be returned.

func (*Stream) Reset

func (s *Stream) Reset()

Reset stream.

func (*Stream) Top

func (s *Stream) Top() uint64

Top returns top of stream.

Jump to

Keyboard shortcuts

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