wal

package
v1.999.0-test Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package wal provides a write-ahead log.

The WAL keeps track of all changes to a repo, that is, which contributor did change what and when.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(w *WAL)

Options to the write-ahead log

func Logger

func Logger(logger *zap.Logger) Option

Logger sets a logger for this WAL

func MaxConcurrency

func MaxConcurrency(c int) Option

func TokenGeneratorPath

func TokenGeneratorPath(path string) Option

type WAL

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

WAL describes a write-ahead log

func New

func New(mutableStore storage.Store, walStore storage.Store, options ...Option) *WAL

New builds a new write-ahead log on some mutable store, with log entries stored at the walStore

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) ([]model.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.

Directories

Path Synopsis
Package status declares error constants returned by the wak package.
Package status declares error constants returned by the wak package.

Jump to

Keyboard shortcuts

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