statestorage

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterStateStorage

func RegisterStateStorage(name config.StateStorageType, provider Provider) bool

RegisterStateStorage registers a config.StateStorageType to a Provider implementation which creates the Storage when requested

Types

type Offset

type Offset struct {
	Timestamp      time.Time   `json:"timestamp"`
	Snapshot       bool        `json:"snapshot"`
	SnapshotName   *string     `json:"snapshot_name,omitempty"`
	SnapshotOffset int         `json:"snapshot_offset"`
	LSN            pgtypes.LSN `json:"lsn"`
}

func (*Offset) Equal

func (o *Offset) Equal(other *Offset) bool

func (*Offset) MarshalBinary

func (o *Offset) MarshalBinary() ([]byte, error)

func (*Offset) UnmarshalBinary

func (o *Offset) UnmarshalBinary(data []byte) error

type Provider

type Provider = func(config *config.Config) (Storage, error)

type StateEncoderFunc

type StateEncoderFunc func() (data []byte, err error)

func (StateEncoderFunc) MarshalBinary

func (sef StateEncoderFunc) MarshalBinary() (data []byte, err error)

type Storage

type Storage interface {
	Start() error
	Stop() error
	Save() error
	Load() error
	Get() (map[string]*Offset, error)
	Set(key string, value *Offset) error
	StateEncoder(name string, encoder encoding.BinaryMarshaler) error
	StateDecoder(name string, decoder encoding.BinaryUnmarshaler) (present bool, err error)
	EncodedState(name string) (encodedState []byte, present bool)
	SetEncodedState(name string, encodedState []byte)
}

func NewStateStorage

func NewStateStorage(name config.StateStorageType, config *config.Config) (Storage, error)

NewStateStorage instantiates a new instance of the requested Storage when available, otherwise returns an error.

Jump to

Keyboard shortcuts

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