worker

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2025 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAttributeLoadingSetting = false

	ClusterAddressTTL = 30 * time.Minute
)

Variables

View Source
var Counters = []prometheus.CounterDefinition{
	{
		Name: rollCallsSeenMetric,
		Help: "Number of roll calls seen by the node.",
	},
	{
		Name: rollCallsAppliedMetric,
		Help: "Number of roll calls this node applied to.",
	},
	{
		Name: workOrderMetric,
		Help: "Number of work orders.",
	},
}
View Source
var DefaultConfig = Config{
	LoadAttributes:   DefaultAttributeLoadingSetting,
	MetadataProvider: metadata.NewNoopProvider(),
}

DefaultConfig represents the default settings for the node.

Functions

This section is empty.

Types

type Config

type Config struct {
	Workspace        string            // Directory where we can store files needed for execution.
	LoadAttributes   bool              // Node should try to load its attributes from IPFS.
	MetadataProvider metadata.Provider // Metadata provider for the node
}

Config represents the Node configuration.

func (Config) Valid

func (c Config) Valid() error

Validate checks if the given configuration is correct.

type FStore

type FStore interface {
	// Install will install a function based on the address and CID.
	Install(ctx context.Context, address string, cid string) error

	// IsInstalled returns info if the function is installed or not.
	IsInstalled(cid string) (bool, error)

	// TODO: Refactor the sync code - move the logic outside of the package
	// Sync will ensure function installations are correct, redownloading functions if needed.
	Sync(ctx context.Context, haltOnError bool) error
}

FStore provides retrieval of function manifest.

type Option

type Option func(*Config)

Option can be used to set Node configuration options.

func AttributeLoading

func AttributeLoading(b bool) Option

AttributeLoading specifies whether node should try to load its attributes data from IPFS.

func MetadataProvider

func MetadataProvider(p metadata.Provider) Option

MetadataProvider sets the metadata provider for the node.

func Workspace

func Workspace(path string) Option

Workspace specifies the workspace that the node can use for file storage.

type Worker

type Worker struct {
	node.Core
	// contains filtered or unexported fields
}

func New

func New(core node.Core, fstore FStore, executor bls.Executor, options ...Option) (*Worker, error)

func (*Worker) Run

func (w *Worker) Run(ctx context.Context) error

Jump to

Keyboard shortcuts

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