file

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: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 // Is this needed?
	// contains filtered or unexported fields
}

Store is an implementation of a Store that stores the data on disk

func New

func New(path string, prefix string, extension string) (*Store, error)

New creates a file Store. Note that a file is written, read and deleted as part of this process to check that the path is usable. NOTE: Order is maintained using file ModTime, so there may be issues if the interval between messages is less than the file system ModTime resolution.

func (*Store) Delete

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

Delete removes the message with the specified store ID

func (*Store) Get

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

Get retrieves the requested packet Note that callers MUST close the returned ReadCloser

func (*Store) List

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

List returns packet IDs in the order they were Put

func (*Store) Put

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

Put stores the packet The store is performed via a temporary file to reduce the chance that a partially written file will cause issues.

func (*Store) Quarantine

func (s *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 (s *Store) Reset() error

Reset clears the store (deleting all messages)

func (*Store) String

func (s *Store) String() string

String is for debugging purposes; it's too expensive to read in the data for this

Jump to

Keyboard shortcuts

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