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 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 ( // The version of the deployer API---aka pipe API---in semantic version // format (Major.Minor.Patch). // // Every time we make a change to deployer API, we assign it a new version. // When an envelope spawns a weavelet, the weavelet reports this version to // the envelope. The envelope then errors out if it is not compatible with // the reported version. // // We could assign the deployer API versions v1, v2, v3, and so on. // However, this makes it hard to understand the relationship between the // deployer API version and the version of the Service Weaver module. (What // version of Service Weaver do I need to install to get version 7 of the // pipe?) // // Instead, we use Service Weaver module versions as deployer API versions. // For example, if we change the deployer API in v0.12.0 of Service Weaver, // then we update the deployer API version to v0.12.0. If we don't change // the deployer API in v0.13.0 of Service Weaver, then we leave the // deployer API at v0.12.0. // // TODO(mwhittaker): Write a doc explaining versioning in detail. Include // Srdjan's comments in PR #219. Major = 0 Minor = 2 Patch = 0 )
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 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). }
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.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. |