hooks

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BeforeReadParams

type BeforeReadParams struct {
	Snapshot *snapshot.Snapshot
	Env      *lmdb.Env
	Txn      *lmdb.Txn
}

type FilterReadDBIParams

type FilterReadDBIParams struct {
	Timestamp header.Timestamp
	TxnID     header.TxnID
	Flags     header.Flags
}

type Hooks

type Hooks struct {
	// AfterSnapshotUnpack is called after a remote snapshot is unpacked into memory
	AfterSnapshotUnpack func(*snapshot.Snapshot) error

	// UpdateSnapshotInfo is called after a snapshot is created but
	// before it is stored.
	UpdateSnapshotInfo func(SnapshotInfo) error

	// UpdateStored is called when an update is written to storage.
	// This is equal to the event with the same name, but with synchronous
	// processing.
	UpdateStored func(info events.UpdateInfo) error

	// SnapshotOverdue is called when we force a snapshot due to a
	// forced snapshot interval.
	// This is equal to the event with the same name, but with synchronous
	// processing.
	SnapshotOverdue func() error

	// BeforeRead is called in SendOnce when the transaction is just opened
	BeforeRead func(params BeforeReadParams) error

	// FilterReadDBI is called in readDBI to perform any filtering
	FilterReadDBI func(p FilterReadDBIParams) bool // included if it returns true

	// Returns a channel that can inject other updates into the sync loop
	OtherUpdateSource func() <-chan snapshot.Update
}

Hooks allow running extra code at specific points of the sync flow (LSE). These hooks are run synchronously, the calling code waits for the response.

func New

func New() *Hooks

type SnapshotInfo

type SnapshotInfo struct {
	Snapshot *snapshot.Snapshot
	NameInfo *snapshot.NameInfo
}

Jump to

Keyboard shortcuts

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