engine

package
v0.0.0-...-4427c07 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: AGPL-3.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNetworkNotConfigured = errors.New("network has no configured node")

Functions

func ActivationCursor

func ActivationCursor(tip int64, n chains.Network) int64

The normal start is the next observed block. An explicit lookback opts in to a bounded historical window on activation for clients doing recovery.

func ConfigureNetworks

func ConfigureNetworks(s *Store, networks map[string]chains.Network, resolve func(context.Context, string) (int64, error))

func ConsumerHandler

func ConsumerHandler(s *Store, consumers map[string]string) (http.Handler, error)

func Database

func Database(s *Store) *sql.DB

Database returns the shared SQLite connection for the node registry.

func RunWithSource

func RunWithSource(ctx context.Context, s *Store, n chains.Network, open func(context.Context, chains.Network) (chains.Source, error), wakeups func(chains.Source) <-chan struct{})

func SetTransactionHandler

func SetTransactionHandler(s *Store, h http.Handler)

Types

type ScanProgress

type ScanProgress struct {
	Network string `json:"network"`
	Status  string `json:"status"`
	Target  *int64 `json:"target_height"`
	Cursor  *int64 `json:"cursor_height"`
	LagMS   *int64 `json:"lag_ms"`
	// ScanSuccessCount counts committed scan ranges in the current watch period.
	ScanSuccessCount uint64 `json:"scan_success_count"`
	// ScanFailureCount counts terminal range failures after provider failover.
	ScanFailureCount uint64 `json:"scan_failure_count"`
}

type Store

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

func Open

func Open(path string) (*Store, error)

func (*Store) Ack

func (s *Store) Ack(ctx context.Context, consumer string, id int64) error

func (*Store) Close

func (s *Store) Close() error

func (*Store) Draining

func (s *Store) Draining(n string) bool

Draining reports whether only retiring subscriptions keep the worker active.

func (*Store) Height

func (s *Store) Height(ctx context.Context, network string) (int64, error)

Height returns the last fully committed height or -1 before first use.

func (*Store) LastFailedHeight

func (s *Store) LastFailedHeight(ctx context.Context, network string) (int64, error)

LastFailedHeight bounds repairs when regular providers cannot report a head.

func (*Store) PendingNetwork

func (s *Store) PendingNetwork(ctx context.Context, consumer, network string, wait time.Duration) (*feed.Delivery, error)

func (*Store) Pump

func (s *Store) Pump(ctx context.Context, n chains.Network, source chains.Source) (bool, error)

Pump fills free provider lanes while earlier reads remain in flight. Run it serially inside WhileWatched with one pool owned by that watch period.

func (*Store) Reconcile

func (s *Store) Reconcile(ctx context.Context, consumer string, watches []feed.Watch) (feed.Reconciliation, error)

Reconcile commits each network independently. A failed or slow boundary lookup cannot prevent other networks from closing their old coverage intervals.

func (*Store) RecordScanHead

func (s *Store) RecordScanHead(ctx context.Context, network string, target int64, at time.Time)

RecordScanHead consumes an observation already made by the active scanner.

func (*Store) Run

func (s *Store) Run(ctx context.Context, n chains.Network)

func (*Store) ScanProgress

func (s *Store) ScanProgress(ctx context.Context) ([]ScanProgress, error)

func (*Store) SeedCursor

func (s *Store) SeedCursor(ctx context.Context, network string, height int64) error

SeedCursor imports a last processed height only on the first start.

func (*Store) Step

func (s *Store) Step(ctx context.Context, n chains.Network, source chains.Source) (bool, error)

Step reserves confirmed work and atomically queues deliveries as each read completes.

func (*Store) Subscribe

func (s *Store) Subscribe(ctx context.Context, consumer string, watches []feed.Watch) (feed.SubscriptionReceipt, error)

Subscribe replaces one consumer's watch set. Serialize replacements for that consumer while allowing scans and other consumers to proceed during RPC.

func (*Store) Watching

func (s *Store) Watching(network string) bool

func (*Store) WhileWatched

func (s *Store) WhileWatched(ctx context.Context, network string, run func(context.Context))

WhileWatched owns a separate lifetime for each activation of one named chain. The callback must return when its context is canceled and close its source.

Jump to

Keyboard shortcuts

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