config

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: AGPL-3.0 Imports: 39 Imported by: 12

Documentation

Overview

Package config defines the structures to configure a robot and its connected parts.

Index

Constants

View Source
const DefaultBindAddress = "localhost:8080"

DefaultBindAddress is the default address that will be listened on. This default may not be used in managed cases when no bind address is explicitly set. In those cases the server will bind to all interfaces.

Variables

View Source
var (
	Version     = ""
	GitRevision = ""
)

RDK versioning variables which are replaced by LD flags.

Functions

func AuthConfigToProto added in v0.0.6

func AuthConfigToProto(auth *AuthConfig) (*pb.AuthConfig, error)

AuthConfigToProto converts AuthConfig to proto equivalent.

func CloudConfigToProto added in v0.0.6

func CloudConfigToProto(cloud *Cloud) (*pb.CloudConfig, error)

CloudConfigToProto converts Cloud to proto equivalent.

func ComponentConfigToProto added in v0.0.6

func ComponentConfigToProto(component *Component) (*pb.ComponentConfig, error)

ComponentConfigToProto converts Component to proto equivalent.

func CreateCloudRequest

func CreateCloudRequest(ctx context.Context, cloudCfg *Cloud) (*http.Request, error)

CreateCloudRequest makes a request to fetch the robot config from a cloud endpoint.

func CreateFramesFromPart

func CreateFramesFromPart(part *FrameSystemPart, logger golog.Logger) (referenceframe.Frame, referenceframe.Frame, error)

CreateFramesFromPart will gather the frame information and build the frames from the given robot part.

func CreateNewGRPCClient added in v0.0.7

func CreateNewGRPCClient(ctx context.Context, cloudCfg *Cloud, logger golog.Logger) (rpc.ClientConn, error)

CreateNewGRPCClient creates a new grpc cloud configured to communicate with the robot service based on the cloud config given.

func FrameConfigToProto added in v0.0.6

func FrameConfigToProto(frame Frame) (*pb.Frame, error)

FrameConfigToProto converts Frame to proto equivalent.

func MergeFrameSystems

func MergeFrameSystems(toFS, fromFS referenceframe.FrameSystem, cfg *Frame) error

MergeFrameSystems will merge fromFS into toFS with an offset frame given by cfg. If cfg is nil, fromFS will be merged to the world frame of toFS with a 0 offset.

func NetworkConfigToProto added in v0.0.6

func NetworkConfigToProto(network *NetworkConfig) (*pb.NetworkConfig, error)

NetworkConfigToProto converts NetworkConfig from proto equivalent.

func NewMissingReferenceFrameError

func NewMissingReferenceFrameError(msg interface{}) error

NewMissingReferenceFrameError returns an error indicating that a particular protobuf message is missing necessary information for its ReferenceFrame key.

func ProcessConfigFromProto added in v0.0.6

func ProcessConfigFromProto(proto *pb.ProcessConfig) (*pexec.ProcessConfig, error)

ProcessConfigFromProto creates ProcessConfig from proto equivalent.

func ProcessConfigToProto added in v0.0.6

func ProcessConfigToProto(process *pexec.ProcessConfig) (*pb.ProcessConfig, error)

ProcessConfigToProto converts ProcessConfig to proto equivalent.

func RegisterComponentAttributeConverter

func RegisterComponentAttributeConverter(subtype resource.SubtypeName, model, attr string, conv AttributeConverter)

RegisterComponentAttributeConverter associates a component type and model with a way to convert a particular attribute name.

func RegisterComponentAttributeMapConverter

func RegisterComponentAttributeMapConverter(subtype resource.SubtypeName, model string, conv AttributeMapConverter, retType interface{})

RegisterComponentAttributeMapConverter associates a component type and model with a way to convert all attributes.

func RegisterServiceAttributeMapConverter

func RegisterServiceAttributeMapConverter(svcType ServiceType, conv AttributeMapConverter, retType interface{})

RegisterServiceAttributeMapConverter associates a service type with a way to convert all attributes.

func RemoteConfigToProto added in v0.0.6

func RemoteConfigToProto(remote *Remote) (*pb.RemoteConfig, error)

RemoteConfigToProto converts Remote to proto equivalent.

func ResourceLevelServiceConfigToProto added in v0.0.6

func ResourceLevelServiceConfigToProto(service ResourceLevelServiceConfig) (*pb.ResourceLevelServiceConfig, error)

ResourceLevelServiceConfigToProto converts ResourceLevelServiceConfig to proto equivalent.

func ServiceConfigToProto added in v0.0.6

func ServiceConfigToProto(service *Service) (*pb.ServiceConfig, error)

ServiceConfigToProto converts Service to proto equivalent.

func TransformAttributeMapToStruct

func TransformAttributeMapToStruct(to interface{}, attributes AttributeMap) (interface{}, error)

TransformAttributeMapToStruct uses an attribute map to transform attributes to the perscribed format.

Types

type AttributeConverter

type AttributeConverter func(val interface{}) (interface{}, error)

An AttributeConverter converts a single attribute into a possibly different representation.

type AttributeMap

type AttributeMap map[string]interface{}

An AttributeMap is a convenience wrapper for pulling out typed information from a map.

func (AttributeMap) Bool

func (am AttributeMap) Bool(name string, def bool) bool

Bool attempts to return a boolean present in the map with the given name; returns the given default otherwise.

func (AttributeMap) BoolSlice

func (am AttributeMap) BoolSlice(name string, def bool) []bool

BoolSlice attempts to return a slice of bools present in the map with the given name; returns an empty slice otherwise.

func (AttributeMap) Float64

func (am AttributeMap) Float64(name string, def float64) float64

Float64 attempts to return a float64 present in the map with the given name; returns the given default otherwise.

func (AttributeMap) Float64Slice

func (am AttributeMap) Float64Slice(name string) []float64

Float64Slice attempts to return a slice of ints present in the map with the given name; returns an empty slice otherwise.

func (AttributeMap) Has

func (am AttributeMap) Has(name string) bool

Has returns whether or not the given name is in the map.

func (AttributeMap) Int

func (am AttributeMap) Int(name string, def int) int

Int attempts to return an integer present in the map with the given name; returns the given default otherwise.

func (AttributeMap) IntSlice

func (am AttributeMap) IntSlice(name string) []int

IntSlice attempts to return a slice of ints present in the map with the given name; returns an empty slice otherwise.

func (AttributeMap) String

func (am AttributeMap) String(name string) string

String attempts to return a string present in the map with the given name; returns an empty string otherwise.

func (AttributeMap) StringSlice

func (am AttributeMap) StringSlice(name string) []string

StringSlice attempts to return a slice of strings present in the map with the given name; returns an empty slice otherwise.

type AttributeMapConverter

type AttributeMapConverter func(attributes AttributeMap) (interface{}, error)

An AttributeMapConverter converts an attribute map into a possibly different representation.

type AuthConfig

type AuthConfig struct {
	Handlers        []AuthHandlerConfig `json:"handlers"`
	TLSAuthEntities []string            `json:"tls_auth_entities"`
}

AuthConfig describes authentication and authorization settings for the web server.

func AuthConfigFromProto added in v0.0.6

func AuthConfigFromProto(proto *pb.AuthConfig) (*AuthConfig, error)

AuthConfigFromProto creates AuthConfig from proto equivalent.

func (*AuthConfig) Validate

func (config *AuthConfig) Validate(path string) error

Validate ensures all parts of the config are valid.

type AuthHandlerConfig

type AuthHandlerConfig struct {
	Type   rpc.CredentialsType `json:"type"`
	Config AttributeMap        `json:"config"`
}

AuthHandlerConfig describes the configuration for a particular auth handler.

func (*AuthHandlerConfig) Validate

func (config *AuthHandlerConfig) Validate(path string) error

Validate ensures all parts of the config are valid.

type Cloud

type Cloud struct {
	ID                string           `json:"id"`
	Secret            string           `json:"secret"`
	LocationSecret    string           `json:"location_secret"` // Deprecated: Use LocationSecrets
	LocationSecrets   []LocationSecret `json:"location_secrets"`
	ManagedBy         string           `json:"managed_by"`
	FQDN              string           `json:"fqdn"`
	LocalFQDN         string           `json:"local_fqdn"`
	SignalingAddress  string           `json:"signaling_address"`
	SignalingInsecure bool             `json:"signaling_insecure,omitempty"`
	Path              string           `json:"path"`
	LogPath           string           `json:"log_path"`
	AppAddress        string           `json:"app_address"`
	RefreshInterval   time.Duration    `json:"refresh_interval,omitempty"`

	// cached by us and fetched from a non-config endpoint.
	TLSCertificate string `json:"tls_certificate"`
	TLSPrivateKey  string `json:"tls_private_key"`
}

A Cloud describes how to configure a robot controlled by the cloud. The cloud source could be anything that supports http. URL is constructed as $Path?id=ID and secret is put in a http header.

func CloudConfigFromProto added in v0.0.6

func CloudConfigFromProto(proto *pb.CloudConfig) (*Cloud, error)

CloudConfigFromProto creates Cloud from proto equivalent.

func (*Cloud) Validate

func (config *Cloud) Validate(path string, fromCloud bool) error

Validate ensures all parts of the config are valid.

type Component

type Component struct {
	Name string `json:"name"`

	Namespace     resource.Namespace           `json:"namespace"`
	Type          resource.SubtypeName         `json:"type"`
	Model         string                       `json:"model"`
	Frame         *Frame                       `json:"frame,omitempty"`
	DependsOn     []string                     `json:"depends_on"`
	ServiceConfig []ResourceLevelServiceConfig `json:"service_config"`

	Attributes          AttributeMap `json:"attributes"`
	ConvertedAttributes interface{}  `json:"-"`
	ImplicitDependsOn   []string     `json:"-"`
}

A Component describes the configuration of a component.

func ComponentConfigFromProto added in v0.0.6

func ComponentConfigFromProto(proto *pb.ComponentConfig) (*Component, error)

ComponentConfigFromProto creates Component from proto equivalent.

func ParseComponentFlag

func ParseComponentFlag(flag string) (Component, error)

ParseComponentFlag parses a component flag from command line arguments.

func (*Component) Dependencies

func (config *Component) Dependencies() []string

Dependencies returns the deduplicated union of user-defined and implicit dependencies.

func (*Component) Get

func (config *Component) Get() interface{}

Get gets the config itself.

func (*Component) ResourceName

func (config *Component) ResourceName() resource.Name

ResourceName returns the ResourceName for the component. TODO(npmemard) Before merge should remove this also the service one.

func (*Component) Set

func (config *Component) Set(val string) error

Set hydrates a config based on a flag like value.

func (*Component) String

func (config *Component) String() string

String returns a verbose representation of the config.

func (*Component) Validate

func (config *Component) Validate(path string) ([]string, error)

Validate ensures all parts of the config are valid and returns dependencies.

type ComponentAttributeConverterRegistration

type ComponentAttributeConverterRegistration struct {
	Subtype resource.SubtypeName
	Model   string
	Attr    string
	Conv    AttributeConverter
}

A ComponentAttributeConverterRegistration describes how to convert a specific attribute for a model of a type of component.

func RegisteredComponentAttributeConverters

func RegisteredComponentAttributeConverters() []ComponentAttributeConverterRegistration

RegisteredComponentAttributeConverters returns a copy of the registered component attribute converters.

type ComponentAttributeMapConverterRegistration

type ComponentAttributeMapConverterRegistration struct {
	Subtype resource.SubtypeName
	Model   string
	Conv    AttributeMapConverter
	RetType interface{} // the shape of what is converted to
}

A ComponentAttributeMapConverterRegistration describes how to convert all attributes for a model of a type of component.

func RegisteredComponentAttributeMapConverters

func RegisteredComponentAttributeMapConverters() []ComponentAttributeMapConverterRegistration

RegisteredComponentAttributeMapConverters returns a copy of the registered component attribute converters.

type ComponentUpdate added in v0.0.9

type ComponentUpdate interface {
	UpdateAction(config *Component) UpdateActionType
}

ComponentUpdate interface that a component can optionally implement. This interface helps the reconfiguration process.

type Config

type Config struct {
	Cloud      *Cloud                `json:"cloud,omitempty"`
	Remotes    []Remote              `json:"remotes,omitempty"`
	Components []Component           `json:"components,omitempty"`
	Processes  []pexec.ProcessConfig `json:"processes,omitempty"`
	Services   []Service             `json:"services,omitempty"`
	Network    NetworkConfig         `json:"network"`
	Auth       AuthConfig            `json:"auth"`

	Debug bool `json:"debug,omitempty"`

	ConfigFilePath string `json:"-"`

	// AllowInsecureCreds is used to have all connections allow insecure
	// downgrades and send credentials over plaintext. This is an option
	// a user must pass via command line arguments.
	AllowInsecureCreds bool `json:"-"`

	// FromCommand indicates if this config was parsed via the web server command.
	// If false, it's for creating a robot via the RDK library. This is helpful for
	// error messages that can indicate flags/config fields to use.
	FromCommand bool `json:"-"`
}

A Config describes the configuration of a robot.

func FromProto added in v0.1.0

func FromProto(proto *pb.RobotConfig) (*Config, error)

FromProto converts the RobotConfig to the internal rdk equivalent.

func FromReader

func FromReader(
	ctx context.Context,
	originalPath string,
	r io.Reader,
	logger golog.Logger,
) (*Config, error)

FromReader reads a config from the given reader and specifies where, if applicable, the file the reader originated from.

func ProcessConfig

func ProcessConfig(in *Config, tlsCfg *TLSConfig) (*Config, error)

ProcessConfig processes robot configs.

func Read

func Read(
	ctx context.Context,
	filePath string,
	logger golog.Logger,
) (*Config, error)

Read reads a config from the given file.

func ReadLocalConfig added in v0.1.0

func ReadLocalConfig(
	ctx context.Context,
	filePath string,
	logger golog.Logger,
) (*Config, error)

ReadLocalConfig reads a config from the given file but does not fetch any config from the remote servers.

func (*Config) CopyOnlyPublicFields added in v0.0.6

func (c *Config) CopyOnlyPublicFields() (*Config, error)

CopyOnlyPublicFields returns a deep-copy of the current config only preserving JSON exported fields.

func (*Config) Ensure

func (c *Config) Ensure(fromCloud bool) error

Ensure ensures all parts of the config are valid.

func (Config) FindComponent

func (c Config) FindComponent(name string) *Component

FindComponent finds a particular component by name.

type Diff

type Diff struct {
	Left, Right    *Config
	Added          *Config
	Modified       *ModifiedConfigDiff
	Removed        *Config
	ResourcesEqual bool
	NetworkEqual   bool
	PrettyDiff     string
}

A Diff is the difference between two configs, left and right where left is usually old and right is new. So the diff is the changes from left to right.

func DiffConfigs

func DiffConfigs(left, right Config, revealSensitiveConfigDiffs bool) (_ *Diff, err error)

DiffConfigs returns the difference between the two given configs from left to right.

func (*Diff) String

func (diff *Diff) String() string

String returns a pretty version of the diff.

type Frame

type Frame struct {
	Parent      string                  `json:"parent"`
	Translation r3.Vector               `json:"translation"`
	Orientation spatial.Orientation     `json:"orientation"`
	Geometry    spatial.GeometryCreator `json:"geometry"`
}

Frame contains the information of the pose and parent of the frame that will be created. When using the pose as a transformation, the rotation is applied first, and then the translation. The Orientation field is an interface. When writing a config file, the orientation field should be of the form

{
	"orientation" : {
		"type": "orientation_type"
		"value" : {
			"param0" : ...,
			"param1" : ...,
			etc.
		}
	}
}.

func FrameConfigFromProto added in v0.0.6

func FrameConfigFromProto(proto *pb.Frame) (*Frame, error)

FrameConfigFromProto creates Frame from proto equivalent.

func (*Frame) MarshalJSON added in v0.0.6

func (f *Frame) MarshalJSON() ([]byte, error)

MarshalJSON will encode the Orientation field into a spatial.OrientationConfig object instead of spatial.Orientation.

func (*Frame) Pose

func (f *Frame) Pose() spatial.Pose

Pose combines Translation and Orientation in a Pose.

func (*Frame) StaticFrame

func (f *Frame) StaticFrame(name string) (referenceframe.Frame, error)

StaticFrame creates a new static frame from a config.

func (*Frame) UnmarshalJSON

func (f *Frame) UnmarshalJSON(b []byte) error

UnmarshalJSON will parse unmarshall json corresponding to a frame config.

type FrameSystemPart

type FrameSystemPart struct {
	Name        string
	FrameConfig *Frame
	ModelFrame  referenceframe.Model
}

FrameSystemPart is used to collect all the info need from a named robot part to build the frame node in a frame system. Name is the robot part name, FrameConfig gives the general structure of the frame system, and ModelFrameConfig is an optional ModelJSON that describes the internal kinematics of the robot part.

func ConvertTransformProtobufToFrameSystemPart

func ConvertTransformProtobufToFrameSystemPart(transformMsg *commonpb.Transform) (*FrameSystemPart, error)

ConvertTransformProtobufToFrameSystemPart creates a FrameSystem part out of a transform protobuf message.

func ProtobufToFrameSystemPart

func ProtobufToFrameSystemPart(fsc *pb.FrameSystemConfig) (*FrameSystemPart, error)

ProtobufToFrameSystemPart takes a protobuf object and transforms it into a FrameSystemPart.

func (*FrameSystemPart) ToProtobuf

func (part *FrameSystemPart) ToProtobuf() (*pb.FrameSystemConfig, error)

ToProtobuf turns all the interfaces into serializable types.

type LocationSecret added in v0.1.7

type LocationSecret struct {
	ID string
	// Payload of the secret
	Secret string
}

LocationSecret describes a location secret that can be used to authenticate to the rdk.

type ModifiedConfigDiff

type ModifiedConfigDiff struct {
	Remotes    []Remote
	Components []Component
	Processes  []pexec.ProcessConfig
	Services   []Service
}

ModifiedConfigDiff is the modificative different between two configs.

type NetworkConfig

type NetworkConfig struct {
	NetworkConfigData
}

NetworkConfig describes networking settings for the web server.

func NetworkConfigFromProto added in v0.0.6

func NetworkConfigFromProto(proto *pb.NetworkConfig) (*NetworkConfig, error)

NetworkConfigFromProto creates NetworkConfig from proto equivalent.

func (*NetworkConfig) MarshalJSON

func (nc *NetworkConfig) MarshalJSON() ([]byte, error)

MarshalJSON marshals out this config.

func (*NetworkConfig) Validate

func (nc *NetworkConfig) Validate(path string) error

Validate ensures all parts of the config are valid.

type NetworkConfigData

type NetworkConfigData struct {
	// FQDN is the unique name of this server.
	FQDN string `json:"fqdn"`

	// Listener is the listener that the web server will use. This is mutually
	// exclusive with BindAddress.
	Listener net.Listener `json:"-"`

	// BindAddress is the address that the web server will bind to.
	// The default behavior is to bind to localhost:8080. This is mutually
	// exclusive with Listener.
	BindAddress string `json:"bind_address"`

	BindAddressDefaultSet bool `json:"-"`

	// TLSCertFile is used to enable secure communications on the hosted HTTP server.
	// This is mutually exclusive with TLSCertPEM and TLSKeyPEM.
	TLSCertFile string `json:"tls_cert_file"`

	// TLSKeyFile is used to enable secure communications on the hosted HTTP server.
	// This is mutually exclusive with TLSCertPEM and TLSKeyPEM.
	TLSKeyFile string `json:"tls_key_file"`

	// TLSConfig is used to enable secure communications on the hosted HTTP server.
	// This is mutually exclusive with TLSCertFile and TLSKeyFile.
	TLSConfig *tls.Config `json:"-"`
}

NetworkConfigData is the network config data that gets marshaled/unmarshaled.

type Remote

type Remote struct {
	Name                    string                       `json:"name"`
	Address                 string                       `json:"address"`
	Frame                   *Frame                       `json:"frame,omitempty"`
	Auth                    RemoteAuth                   `json:"auth"`
	ManagedBy               string                       `json:"managed_by"`
	Insecure                bool                         `json:"insecure"`
	ConnectionCheckInterval time.Duration                `json:"connection_check_interval,omitempty"`
	ReconnectInterval       time.Duration                `json:"reconnect_interval,omitempty"`
	ServiceConfig           []ResourceLevelServiceConfig `json:"service_config"`

	// Secret is a helper for a robot location secret.
	Secret string `json:"secret"`
}

A Remote describes a remote robot that should be integrated. The Frame field defines how the "world" node of the remote robot should be reconciled with the "world" node of the the current robot. All components of the remote robot who have Parent as "world" will be attached to the parent defined in Frame, and with the given offset as well.

func RemoteConfigFromProto added in v0.0.6

func RemoteConfigFromProto(proto *pb.RemoteConfig) (*Remote, error)

RemoteConfigFromProto creates Remote from proto equivalent.

func (*Remote) Validate

func (config *Remote) Validate(path string) error

Validate ensures all parts of the config are valid.

type RemoteAuth

type RemoteAuth struct {
	Credentials *rpc.Credentials `json:"credentials"`
	Entity      string           `json:"entity"`

	// only used internally right now
	ExternalAuthAddress    string           `json:"-"`
	ExternalAuthInsecure   bool             `json:"-"`
	ExternalAuthToEntity   string           `json:"-"`
	Managed                bool             `json:""`
	SignalingServerAddress string           `json:""`
	SignalingAuthEntity    string           `json:""`
	SignalingCreds         *rpc.Credentials `json:""`
}

RemoteAuth specifies how to authenticate against a remote. If no credentials are specified, authentication does not happen. If an entity is specified, the authentication request will specify it.

type ResourceConfig

type ResourceConfig interface {
	String() string
	ResourceName() resource.Name
	Get() interface{}
	Set(val string) error
	// contains filtered or unexported methods
}

A ResourceConfig represents an implmentation of a config for any type of resource.

type ResourceLevelServiceConfig

type ResourceLevelServiceConfig struct {
	Type                resource.SubtypeName `json:"type"`
	Attributes          AttributeMap         `json:"attributes"`
	ConvertedAttributes interface{}          `json:"-"`
}

A ResourceLevelServiceConfig describes component or remote configuration for a service.

func ResourceLevelServiceConfigFromProto added in v0.0.6

func ResourceLevelServiceConfigFromProto(proto *pb.ResourceLevelServiceConfig) (ResourceLevelServiceConfig, error)

ResourceLevelServiceConfigFromProto creates ResourceLevelServiceConfig from proto equivalent.

func (*ResourceLevelServiceConfig) ResourceName

func (config *ResourceLevelServiceConfig) ResourceName() resource.Name

ResourceName returns the ResourceName for the component within a service_config.

type Service

type Service struct {
	Name                string             `json:"name"`
	Model               string             `json:"model"`
	Namespace           resource.Namespace `json:"namespace"`
	Type                ServiceType        `json:"type"`
	Attributes          AttributeMap       `json:"attributes"`
	ConvertedAttributes interface{}        `json:"-"`
}

A Service describes the configuration of a service.

func ParseServiceFlag

func ParseServiceFlag(flag string) (Service, error)

ParseServiceFlag parses a service flag from command line arguments.

func ServiceConfigFromProto added in v0.0.6

func ServiceConfigFromProto(proto *pb.ServiceConfig) (*Service, error)

ServiceConfigFromProto creates Service from proto equivalent.

func (*Service) Get

func (config *Service) Get() interface{}

Get gets the config itself.

func (*Service) ResourceName

func (config *Service) ResourceName() resource.Name

ResourceName returns the ResourceName for the component.

func (*Service) Set

func (config *Service) Set(val string) error

Set hydrates a config based on a flag like value.

func (*Service) String

func (config *Service) String() string

String returns a verbose representation of the config.

func (*Service) Validate

func (config *Service) Validate(path string) error

Validate ensures all parts of the config are valid.

type ServiceAttributeMapConverterRegistration

type ServiceAttributeMapConverterRegistration struct {
	SvcType ServiceType
	Conv    AttributeMapConverter
	RetType interface{} // the shape of what is converted to
}

A ServiceAttributeMapConverterRegistration describes how to convert all attributes for a model of a type of service.

func RegisteredServiceAttributeMapConverters

func RegisteredServiceAttributeMapConverters() []ServiceAttributeMapConverterRegistration

RegisteredServiceAttributeMapConverters returns a copy of the registered component attribute converters.

type ServiceType

type ServiceType string

A ServiceType defines a type of service.

type TLSConfig

type TLSConfig struct {
	*tls.Config
	// contains filtered or unexported fields
}

TLSConfig stores the TLS config for the robot.

func NewTLSConfig

func NewTLSConfig(cfg *Config) *TLSConfig

NewTLSConfig creates a new tls config.

func (*TLSConfig) UpdateCert

func (t *TLSConfig) UpdateCert(cfg *Config) error

UpdateCert updates the TLS certificate to be returned.

type UpdateActionType

type UpdateActionType int

UpdateActionType help hint the reconfigure process on whether one should reconfigure a resource or rebuild it.

const (
	// None is returned when the new configuration doesn't change the the resource.
	None UpdateActionType = iota
	// Reconfigure is returned when the resource should be updated without recreating its proxies.
	// Note that two instances (old&new) will coexist, all dependencies will be destroyed and recreated.
	Reconfigure
	// Rebuild is returned when the resource and it's proxies should be destroyed and recreated,
	// all dependencies will be destroyed and recreated.
	Rebuild
)

type Updateable

type Updateable interface {
	// Update updates the resource
	Update(context.Context, *Config) error
}

Updateable is implemented when component/service of a robot should be updated with the config.

type Watcher

type Watcher interface {
	Config() <-chan *Config
}

A Watcher is responsible for watching for changes to a config from some source and delivering those changes to some destination.

func NewWatcher

func NewWatcher(ctx context.Context, config *Config, logger golog.Logger) (Watcher, error)

NewWatcher returns an optimally selected Watcher based on the given config.

Jump to

Keyboard shortcuts

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