runtime

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Overview

Package runtime contains code suitable for deployer implementers but not Service Weaver application developers.

Index

Constants

View Source
const (
	// ToWeaveletKey is the environment variable under which the file descriptor
	// for messages sent from envelope to weavelet is stored. For internal use by
	// Service Weaver infrastructure.
	ToWeaveletKey = "ENVELOPE_TO_WEAVELET_FD"

	// ToEnvelopeKey is the environment variable under which the file descriptor
	// for messages sent from weavelet to envelope is stored. For internal use by
	// Service Weaver infrastructure.
	ToEnvelopeKey = "WEAVELET_TO_ENVELOPE_FD"
)
View Source
const LoadReportInterval = 5 * time.Minute

Interval at which weavelets report their load.

TODO(mwhittaker): Have this be an option that is sent to the weavelet over the pipe? Or maybe switch the assigner to poll for load?

Variables

This section is empty.

Functions

func CheckDeployment

func CheckDeployment(d *protos.Deployment) error

CheckDeployment checks that a deployment is well-formed.

func CheckWeaveletInfo added in v0.1.2

func CheckWeaveletInfo(w *protos.WeaveletInfo) error

CheckWeaveletInfo checks that weavelet information is well-formed.

func DeploymentID

func DeploymentID(d *protos.Deployment) uuid.UUID

DeploymentID returns the identifier that uniquely identifies a particular deployment.

func ParseConfig

func ParseConfig(file string, input string, sectionValidator func(string, string) error) (*protos.AppConfig, error)

ParseConfig parses the specified configuration input, which should hold a set of sections in TOML format from the specified file. The section corresponding to the common Service Weaver application configuration is parsed and returned as a *AppConfig.

sectionValidator(key, val) is used to validate every section config entry.

func ParseConfigSection

func ParseConfigSection(key, shortKey string, sections map[string]string, dst any) error

ParseConfigSection parses the config section for key into dst. If shortKey is not empty, either key or shortKey is accepted. If the named section is not found, returns nil without changing dst.

Types

type Bootstrap

type Bootstrap struct {
	ToWeaveletFd int    // File descriptor on which to send to weavelet (0 if unset)
	ToEnvelopeFd int    // File descriptor from which to send to envelope (0 if unset)
	TestConfig   string // Configuration passed by user test code to weavertest
}

Bootstrap holds configuration information used to start a process execution.

func GetBootstrap

func GetBootstrap(ctx context.Context) (Bootstrap, error)

GetBootstrap returns information needed to configure process execution. For normal execution, this comes from the environment. For weavertest, it comes from a context value.

func (Bootstrap) HasPipes

func (b Bootstrap) HasPipes() bool

HasPipes returns true if pipe information has been supplied. This is true except in the case of singleprocess.

func (Bootstrap) MakePipes

func (b Bootstrap) MakePipes() (io.ReadCloser, io.WriteCloser, error)

MakePipes creates pipe reader and writer. It returns an error if pipes are not configured.

type BootstrapKey

type BootstrapKey struct{}

BootstrapKey is the Context key used by weavertest to pass Bootstrap to [weaver.Init].

Directories

Path Synopsis
Package codegen contains functions and types used by the weaver_gen.go files generated by "weaver generate".
Package codegen contains functions and types used by the weaver_gen.go files generated by "weaver generate".
Package colors contains color-related utilities.
Package colors contains color-related utilities.
Package envelope implements a sidecar-like process that connects a weavelet to its environment.
Package envelope implements a sidecar-like process that connects a weavelet to its environment.
Package logging contains logging related utilities.
Package logging contains logging related utilities.
Package metrics implements Service Weaver metrics.
Package metrics implements Service Weaver metrics.
Package perfetto contains libraries for displaying trace information in the Perfetto UI.
Package perfetto contains libraries for displaying trace information in the Perfetto UI.
Package protomsg contains protobuf-related utilities.
Package protomsg contains protobuf-related utilities.
Package retry contains code to perform retries with exponential backoff.
Package retry contains code to perform retries with exponential backoff.
Package tool contains utilities for creating Service Weaver tools similar to weaver-multi, weaver-gke, and weaver-gke-local.
Package tool contains utilities for creating Service Weaver tools similar to weaver-multi, weaver-gke, and weaver-gke-local.

Jump to

Keyboard shortcuts

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