memory

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: EPL-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotInStore = errors.New("the requested ID was not found in the store") // Returned when requested ID not found
)

Functions

This section is empty.

Types

type Store

type Store struct {
	// server store - holds packets where the message ID was generated on the server
	sync.Mutex
	// contains filtered or unexported fields
}

Store is an implementation of a Store that stores the data in memory

func New

func New() *Store

New creates a Store

func (*Store) Delete

func (m *Store) Delete(id uint16) error

Delete removes the message with the specified store ID

func (*Store) Get

func (m *Store) Get(packetID uint16) (io.ReadCloser, error)

func (*Store) List

func (m *Store) List() ([]uint16, error)

List returns packet IDs in the order they were Put

func (*Store) Put

func (m *Store) Put(packetID uint16, packetType byte, w io.WriterTo) error

Put stores the packet

func (*Store) Quarantine

func (m *Store) Quarantine(id uint16) error

Quarantine is called if a corrupt packet is detected. There is little we can do other than deleting the packet.

func (*Store) Reset

func (m *Store) Reset() error

Reset clears the store (deleting all messages)

func (*Store) String

func (m *Store) String() string

String is for debugging purposes; it dumps the content of the store in a readable format

Jump to

Keyboard shortcuts

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