Documentation ¶
Overview ¶
Package runtime contains code suitable for deployer implementers but not Service Weaver application developers.
Index ¶
- Constants
- func CheckEnvelopeInfo(w *protos.EnvelopeInfo) error
- func DataDir() (string, error)
- func LogsDir() string
- func ParseConfig(file string, input string, sectionValidator func(string, string) error) (*protos.AppConfig, error)
- func ParseConfigSection(key, shortKey string, sections map[string]string, dst any) error
- type Bootstrap
- type BootstrapKey
Constants ¶
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" )
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
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 ¶
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). TestConfig string // Config file contents (weavertest only). Quiet bool // Don't log or print anything. }
Bootstrap holds configuration information used to start a process execution.
func GetBootstrap ¶
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 ¶
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 |
---|---|
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 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. |
Package version contains code related to deployer API versioning.
|
Package version contains code related to deployer API versioning. |
testprogram
testprogram is used by version tests.
|
testprogram is used by version tests. |