library

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: BSD-3-Clause Imports: 23 Imported by: 4

Documentation

Overview

Package library implements a RuntimeFactory suitable for building a Vanadium library that is linked into other applications. It is configured via a set of exported variables as well as optionally via the v.io/x/ref/lib/flags package which allows for both internal configuration as well as via the command line or environment. Client packages (factories) that wish to be configured via the command line must call EnableCommadLineFlags, all other users should use the flags package's 'SetDefault...' methods. This scheme allows this package to be broadly used to create 'factories' and other initialization mechanisms whilst reducing code duplication.

The pubsub.Publisher mechanism is used for communicating networking settings to the rpc.Server implementation of the runtime and publishes the Settings it expects.

Index

Constants

This section is empty.

Variables

View Source
var (
	// LogToStderr is the equivalent of --logtostderr
	LogToStderr vlog.LogToStderr
	// AlsoLogToStderr is the equivalent of --alsologtostderr
	AlsoLogToStderr vlog.AlsoLogToStderr
	// LogDir is the equivalent of --log_dir
	LogDir vlog.LogDir
	// Level is the equivalent of --v
	Level vlog.Level
	// StderrThreshold is the equivalent of --stderrthreshold
	StderrThreshold = vlog.StderrThreshold(vlog.ErrorLog)
	// ModuleSpec is the equivalent of --vmodule
	ModuleSpec vlog.ModuleSpec
	// FilepathSpec is the equivalent of --vpath
	FilepathSpec vlog.FilepathSpec
	// TraceLocation is the equivalent of --log_backtrace_at
	TraceLocation vlog.TraceLocation
	// MaxStackBufSize is the equivalent of --max_stack_buf_size
	MaxStackBufSize vlog.MaxStackBufSize

	// LoggingOpts are passed to the logging initialization functions.
	LoggingOpts = []vlog.LoggingOpts{}

	// Roam controls whether roaming is enabled.
	Roam = false

	// CloudVM controls whether virtualization/cloud configuration is enabled.
	CloudVM = false

	// ReservedNameDispatcher controls whether a dispatcher is created
	// for the reserved names on an RPC dispatcher. If it is set then
	// its authorization will be determined by the PermissionsFlags and
	// in particular the 'runtime' file therein.
	ReservedNameDispatcher = false

	// ConfigureLoggingFromFlags controls whether the logging related variables
	// above are used for configuring logging, or if command line flags
	// are used instead.
	ConfigureLoggingFromFlags = false

	// PermissionsSpec specifies the permissions to be stored in the context
	// and thus used by default.
	PermissionsSpec access.PermissionsSpec

	// ConfigurePermissionsFromFlags controls whether the permissions
	// related variable above is used for configuring permissions, or if
	// command line flags are used instead.
	ConfigurePermissionsFromFlags = false

	// AllowMultipleInitializations controls whether the runtime can
	// be initialized multiple times. The shutdown callback must be called
	// between multiple initializations.
	AllowMultipleInitializations = false

	// ConnectionExpiryDuration sets the rate at which cached connections
	// will be considered for eviction from the cache.
	ConnectionExpiryDuration = 10 * time.Minute
)

Functions

func EnableCommandlineFlags

func EnableCommandlineFlags()

EnableCommandlineFlags enables use of command line flags.

func EnableFlags

func EnableFlags(fs *flag.FlagSet, parse bool) error

EnableFlags enables the use of flags on the specified flag set and returns the newly created v.io/x/ref/lib/flags.Flags to allow for external parsing by the caller if need be. It will optionally parse the newly created and registered flags.

func Init

func Init(ctx *context.T) (v23.Runtime, *context.T, v23.Shutdown, error)

Init creates a new v23.Runtime.

func VirtualizedFlags added in v0.1.10

func VirtualizedFlags() (flags.VirtualizedFlags, bool)

VirtualizedFlags flags returns a copy of flags.VirtualizedFlags as obtained from the command line and/or environment via the flags package and an indication of whether the flag group was enabled.

Types

This section is empty.

Directories

Path Synopsis
internal
noflags
An example using the 'library' factory which is configured via exported variables rather than by command line flags.
An example using the 'library' factory which is configured via exported variables rather than by command line flags.
notpreparsed
An example using the 'library' factory which is configured via exported variables rather than by command line flags.
An example using the 'library' factory which is configured via exported variables rather than by command line flags.
preparsed
An example using the 'library' factory which is configured via exported variables rather than by command line flags.
An example using the 'library' factory which is configured via exported variables rather than by command line flags.
withflags
An example using the 'library' factory which is configured via exported variables rather than by command line flags.
An example using the 'library' factory which is configured via exported variables rather than by command line flags.

Jump to

Keyboard shortcuts

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