Documentation ¶
Overview ¶
Package command manages commands/toolchains.
Index ¶
- Variables
- type ConfigLoader
- type ConfigMap
- type ConfigMapBucket
- func (c ConfigMapBucket) Bucket(ctx context.Context) (string, error)
- func (c ConfigMapBucket) RuntimeConfigs(ctx context.Context) (map[string]*cmdpb.RuntimeConfig, error)
- func (c ConfigMapBucket) Seqs(ctx context.Context) (map[string]string, error)
- func (c ConfigMapBucket) Watcher(ctx context.Context) ConfigMapWatcher
- type ConfigMapLoader
- type ConfigMapWatcher
- type ConfigStore
Constants ¶
This section is empty.
Variables ¶
var ( ErrWatcherClosed = errors.New("watcher closed") // DefaultViews are the default views provided by this package. // You need to register the view for data to actually be collected. DefaultViews = []*view.View{ { Description: "configmap pubsub error", Measure: pubsubErrors, Aggregation: view.Count(), }, } )
var ErrNoUpdate = errors.New("toolchain: configmap no update")
ErrNoUpdate indicates no update in configmap, returned by ConfigMapLoader.Load.
Functions ¶
This section is empty.
Types ¶
type ConfigLoader ¶
type ConfigLoader struct { StorageClient stiface.Client EnableParallel bool // contains filtered or unexported fields }
ConfigLoader loads toolchain_config from cloud storage.
type ConfigMap ¶
type ConfigMap interface { // Watcher returns config map watcher. Watcher(ctx context.Context) ConfigMapWatcher // Seqs returns a map of config name to sequence. Seqs(ctx context.Context) (map[string]string, error) // Bucket returns toolchain-config bucket. Bucket(ctx context.Context) (string, error) // RuntimeConfigs returns a map of RuntimeConfigs. RuntimeConfigs(ctx context.Context) (map[string]*cmdpb.RuntimeConfig, error) }
ConfigMap is an interface to access toolchain config map.
type ConfigMapBucket ¶
type ConfigMapBucket struct { // URI of config data. // gs://<bucket>/ // e.g. gs://$project-toolchain-config/ URI string ConfigMap *cmdpb.ConfigMap ConfigMapFile string PubsubClient *pubsub.Client // StorageClient is an interface for accessing Cloud Storage. It can // be a Cloud Storage client or a fake for testing. StorageClient stiface.Client // SubscriberID should be unique per each server instance // to get notification in every server instance. SubscriberID string // Remoteexec API address, if RBE API is used. // Otherwise, use service_addr in RuntimeConfig proto. RemoteexecAddr string }
ConfigMapBucket access config on cloud storage bucket.
<bucket> is <project>-toolchain-config. in the <bucket>
<runtime>/ seq: text, sequence number. <prebuilt-item>/descriptors/<descriptorHash>: proto CmdDescriptor
Watcher watches */seq files via default notification topic on the bucket. Seqs and RuntimeConfigs will read ConfigMapFile everytime.
func (ConfigMapBucket) Bucket ¶
func (c ConfigMapBucket) Bucket(ctx context.Context) (string, error)
func (ConfigMapBucket) RuntimeConfigs ¶
func (c ConfigMapBucket) RuntimeConfigs(ctx context.Context) (map[string]*cmdpb.RuntimeConfig, error)
func (ConfigMapBucket) Watcher ¶
func (c ConfigMapBucket) Watcher(ctx context.Context) ConfigMapWatcher
type ConfigMapLoader ¶
type ConfigMapLoader struct { ConfigMap ConfigMap ConfigLoader ConfigLoader ConfigStore ConfigStore }
ConfigMapLoader loads toolchain_config config map.
ConfigMap provides Watcher, Seqs, Bucket and RuntimeConfigs.
if seq is updated from last load, it will load CmdDescriptor from <bucket>/<runtime>/<prebuilt_item>/descriptors/<descriptorHash>.
func (*ConfigMapLoader) Load ¶
func (c *ConfigMapLoader) Load(ctx context.Context, force bool) (*cmdpb.ConfigResp, error)
Load loads toolchain config. It will return ErrNoUpdate if there is no seq change when force=false.
type ConfigMapWatcher ¶
type ConfigMapWatcher interface { // Next waits for some updates in config map. Next(ctx context.Context) error // Close closes the watcher. Close() error }
ConfigMapWatcher is an interface to watch config map.
type ConfigStore ¶
type ConfigStore struct {
// contains filtered or unexported fields
}
ConfigStore holds latest config.
func (*ConfigStore) ConfigResp ¶
func (c *ConfigStore) ConfigResp() *cmdpb.ConfigResp
ConfigResp returns current ConfigResp.
func (*ConfigStore) Delete ¶
func (c *ConfigStore) Delete(name string)
Delete deletes name's config.
func (*ConfigStore) List ¶
func (c *ConfigStore) List() []string
List returns a list of config names.
func (*ConfigStore) Seq ¶
func (c *ConfigStore) Seq(name string) string
Seq returns seq of name's config.
Directories ¶
Path | Synopsis |
---|---|
Package descriptor provides command descriptor utilities.
|
Package descriptor provides command descriptor utilities. |
posixpath
Package posixpath handles posix-path (Unix style; slash separeted path).
|
Package posixpath handles posix-path (Unix style; slash separeted path). |
winpath
Package winpath handles windows-path (backslash separated path).
|
Package winpath handles windows-path (backslash separated path). |
Package normalizer provides functions to normalize target.
|
Package normalizer provides functions to normalize target. |
Package pathconv provides path converter between client and server.
|
Package pathconv provides path converter between client and server. |