runtime

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: Apache-2.0 Imports: 11 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 Main = "github.com/ServiceWeaver/weaver/Main"

Main is the name of the main component.

Variables

This section is empty.

Functions

func CheckEnvelopeInfo added in v0.2.0

func CheckEnvelopeInfo(w *protos.EnvelopeInfo) error

CheckEnvelopeInfo checks that EnvelopeInfo is well-formed.

func DataDir added in v0.7.2

func DataDir() (string, error)

DataDir returns the default directory for Service Weaver deployer data. The returned directory is $XDG_DATA_HOME/serviceweaver, or ~/.local/share/serviceweaver if XDG_DATA_HOME is not set.

We recommend that deployers store their data in a directory within this default directory. For example, the "weaver multi" deployer stores its data in "DataDir()/multi".

func LogsDir added in v0.9.0

func LogsDir() string

LogsDir returns the default directory for Service Weaver logs, $DIR/tmp/serviceweaver/logs where $DIR is the default directory used for temporary files (see os.TempDir for details). We recommend that deployers store their logs in a directory within this default directory. For example, on Unix systems, the "weaver multi" deployer stores its data in /tmp/serviceweaver/logs/multi.

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   uintptr  // File descriptor on which to send to weavelet (0 if unset)
	ToEnvelopeFd   uintptr  // File descriptor from which to send to envelope (0 if unset)
	ToWeaveletFile *os.File // Pipe to send to weavelet (weavertest only).
	ToEnvelopeFile *os.File // Pipe to send to envelope (weavertest only).
}

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.Run].

Directories

Path Synopsis
bin
Package bin contains code to extract data from a Service Weaver binary.
Package bin contains code to extract data from a Service Weaver binary.
testprogram
testprogram is used by bin tests.
testprogram is used by bin tests.
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 provides utilities for encoding trace spans in a format that can be read by the Perfetto UI.
Package perfetto provides utilities for encoding trace spans in a format that can be read by 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.
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 version contains the version of the weaver module and its constituent APIs (e.g., the pipe API, the codegen API).
Package version contains the version of the weaver module and its constituent APIs (e.g., the pipe API, the codegen API).

Jump to

Keyboard shortcuts

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