runtime

package
v0.5.39 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const Main = "github.com/TiagoMalhadas/xcweaver/Main"

Main is the name of the main component.

View Source
const (
	// WeaveletArgsKey is the environment variable that holds the base64 encoded
	// protos.WeaveletArgs message for a weavelet started by an envelope. For internal
	// use by Service Weaver infrastructure.
	WeaveletArgsKey = "WEAVELET_ARGS"
)

Variables

This section is empty.

Functions

func CheckWeaveletArgs

func CheckWeaveletArgs(w *protos.WeaveletArgs) error

CheckWeaveletArgs checks that WeaveletArgs is well-formed.

func DataDir

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

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 NewTempDir

func NewTempDir() (string, error)

NewTempDir returns a new directory, e.g., to hold Unix domain sockets for internal communication. The new directory is not accessible by other users. Caller is responsible for cleaning up the directory when not needed.

func OnExitSignal

func OnExitSignal(fn func())

OnExitSignal arranges to run fn() when a signal that might cause the process to exit is delivered.

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 {
	Args *protos.WeaveletArgs
}

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) Exists

func (b Bootstrap) Exists() bool

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

Directories

Path Synopsis
Package bin contains code to extract data from a Service Weaver binary.
Package bin contains code to extract data from a Service Weaver binary.
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.
Deployers provides useful utilities for implementing Service Weaver deployers.
Deployers provides useful utilities for implementing Service Weaver deployers.
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