types

package
v0.0.46 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stream

type Stream[T any] interface {
	// Write will write a new entry to the log at the given index.
	Write(offset uint64, entry T) error

	// CheckError check the error signal of async writes
	CheckError() error

	// TruncateBefore will remove all entries that are before the provided `offset`
	TruncateBefore(offset uint64) error

	// TruncateAfter will remove all entries that are after the provided `offset`
	TruncateAfter(offset uint64) error

	// ReadAt will read the replay log at the given index
	ReadAt(offset uint64) (*T, error)

	// FirstOffset returns the first written index of the log
	FirstOffset() (offset uint64, err error)

	// LastOffset returns the last written index of the log
	LastOffset() (offset uint64, err error)

	// Replay will read the replay the log and process each entry with the provided function
	Replay(start uint64, end uint64, processFn func(index uint64, entry T) error) error

	Close() error
}

type Subscriber

type Subscriber[T any] interface {
	// Start starts the subscriber processing goroutine
	Start()

	// ProcessEntry will process a new entry either sync or async
	ProcessEntry(entry T) error

	// Close will close the subscriber and stop the goroutine
	Close() error
}

Jump to

Keyboard shortcuts

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