persistence

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2019 License: Apache-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 JournalPersister

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

JournalPersister saves data in an embedded Journal store

func (*JournalPersister) Finalize

func (lp *JournalPersister) Finalize()

Finalize tells persister that it can finalize and close writes It is an error to send new items to persist once Finalize has been called

func (*JournalPersister) Persist

func (lp *JournalPersister) Persist(enc gob.GobEncoder) error

Persist stores an entry to disk

func (*JournalPersister) PersistStream

func (lp *JournalPersister) PersistStream(encC chan gob.GobEncoder) chan error

PersistStream listens to the input channel and persists entries to disk

func (*JournalPersister) Recover

func (lp *JournalPersister) Recover() (chan []byte, error)

Recover reads back persisted data and emits entries

func (*JournalPersister) ResetDataDir

func (lp *JournalPersister) ResetDataDir() error

ResetDataDir tells persister to *delete* everything in the datadir

type Persister

type Persister interface {
	ResetDataDir() error

	Persist(enc gob.GobEncoder) error
	PersistStream(encC chan gob.GobEncoder) chan error
	Finalize()

	Recover() (chan []byte, error)
}

Persister saves the data given to it to a durable data store like a disk, S3 buckets, durable streams etc

func NewJournalPersister

func NewJournalPersister(dataDir string) Persister

NewJournalPersister initializes a Journal backed persister

Jump to

Keyboard shortcuts

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