runtime

package
v0.0.1-beta.12 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: Apache-2.0, MIT Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Client

func Client(opt ...Option) fx.Option

Client declares dependencies for a *client.Node.

func Prelude

func Prelude(env Env) fx.Option

Prelude provides the core wetware runtime. It MUST be passed to the top-level call to fx.New.

func Server

func Server(opt ...Option) fx.Option

Types

type Config

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

Config is used to parametrize the Fx runtime. It contains a set of unexported type-constructors that are set by the Option type, and then provided to Fx. This allows callers to override defaults, while keeping interacton with Fx to a minimum.

func (Config) ClientBootstrap

func (c Config) ClientBootstrap() fx.Option

func (*Config) PubSub

func (c *Config) PubSub() fx.Option

func (Config) Routing

func (c Config) Routing() fx.Option

func (Config) ServerBootstrap

func (c Config) ServerBootstrap() fx.Option

func (Config) System

func (c Config) System() fx.Option

func (Config) Vat

func (c Config) Vat() fx.Option

type Env

type Env interface {
	// Context returns the main runtime context.  The returned
	// context MAY expire, in which case callers SHOULD finish
	// any outstanding work and terminate promptly.
	Context() context.Context

	Log() log.Logger
	Metrics() metrics.Client

	Bool(string) bool
	IsSet(string) bool
	Path(string) string
	String(string) string
	StringSlice(string) []string
	Duration(string) time.Duration
	Float64(string) float64
}

Env is a context object that exposes environmental data and effectful operations to the runtime.

type HostConfig

type HostConfig func(...libp2p.Option) casm.HostFactory

HostConfig specifies how to construct a libp2p Host, in a parametrizable way. Implementations MUST pass the options provided to libp2p.New. They MAY prepend default options.

type Option

type Option func(*Config)

Option can modify the state of Config. It is used to set type constructors that will be consumed by Fx.

func HostOpt

func HostOpt(opt ...libp2p.Option) Option

HostOpt declares a set of libp2p options to be passed into the HostConifg. If len(opt) == nil, no options are passed.

func WithHostConfig

func WithHostConfig(f HostConfig) Option

WithHostConfig sets the host configuration for the Fx app. Panics if f == nil.

func WithPeXDisabled

func WithPeXDisabled() Option

WithPeXDisabled disables PeX entirely.

func WithPeXOpt

func WithPeXOpt(opt ...pex.Option) Option

WithPeXOpt sets the options for the boot cache. The PeX cache is disabled by default. Calling without arguments uses the default configuration.

Jump to

Keyboard shortcuts

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