wal

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(entry *Entry) ([]byte, error)

Types

type Entry

type Entry struct {
	Token   string `json:"token" yaml:"token"`
	Payload string `json:"payload" yaml:"payload"`
}

func NewEntry

func NewEntry(token string, payload string) *Entry

func Unmarshal

func Unmarshal(b []byte) (*Entry, error)

type Options

type Options func(w *WAL)

func MaxConcurrency

func MaxConcurrency(c int) Options

func TokenGeneratorPath

func TokenGeneratorPath(path string) Options

type WAL

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

func NewWAL

func NewWAL(mutableStore storage.Store, walStore storage.Store, logger *zap.Logger, options ...Options) *WAL

func (*WAL) Add

func (w *WAL) Add(ctx context.Context, p string) (string, error)

Adds a WAL entry to WAL

func (*WAL) GetExpirationDuration

func (w *WAL) GetExpirationDuration() time.Duration

func (*WAL) ListEntries

func (w *WAL) ListEntries(ctx context.Context, fromToken string, max int) ([]Entry, string, error)

func (*WAL) ListTokens

func (w *WAL) ListTokens(ctx context.Context, fromToken string, max int) (tokens []string, next string, err error)

Reads the WAL starting from the tokens passed in. If startFrom is empty it will entry from beginning. Repeated reads can include duplicate tokens. No tokens are missed Returns false if the list has more entries that can be listed. Use the last Entry of the previous call to paginate to the next set of keys.

Jump to

Keyboard shortcuts

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