server: Index | Files | Directories

package command

import ""

Package command manages commands/toolchains.


Package Files

configmap.go doc.go fake_storage.go


var (

    // 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.

type ConfigLoader Uses

type ConfigLoader struct {
    StorageClient  stiface.Client
    EnableParallel bool
    // contains filtered or unexported fields

ConfigLoader loads toolchain_config from cloud storage.

func (*ConfigLoader) Load Uses

func (c *ConfigLoader) Load(ctx context.Context, uri string, rc *cmdpb.RuntimeConfig) ([]*cmdpb.Config, error)

Load loads toolchain config from <uri>. It sets rc.ServiceAddr as target addr.

type ConfigMap Uses

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 Uses

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>

         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 Uses

func (c ConfigMapBucket) Bucket(ctx context.Context) (string, error)

func (ConfigMapBucket) RuntimeConfigs Uses

func (c ConfigMapBucket) RuntimeConfigs(ctx context.Context) (map[string]*cmdpb.RuntimeConfig, error)

func (ConfigMapBucket) Seqs Uses

func (c ConfigMapBucket) Seqs(ctx context.Context) (map[string]string, error)

func (ConfigMapBucket) Watcher Uses

func (c ConfigMapBucket) Watcher(ctx context.Context) ConfigMapWatcher

type ConfigMapLoader Uses

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 Uses

func (c *ConfigMapLoader) Load(ctx context.Context) (*cmdpb.ConfigResp, error)

Load loads toolchain config. It will return ErrNoUpdate if there is no seq change.

type ConfigMapWatcher Uses

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 Uses

type ConfigStore struct {
    // contains filtered or unexported fields

ConfigStore holds latest config.

func (*ConfigStore) ConfigResp Uses

func (c *ConfigStore) ConfigResp() *cmdpb.ConfigResp

ConfigResp returns current ConfigResp.

func (*ConfigStore) Delete Uses

func (c *ConfigStore) Delete(name string)

Delete deletes name's config.

func (*ConfigStore) List Uses

func (c *ConfigStore) List() []string

List returns a list of config names.

func (*ConfigStore) Seq Uses

func (c *ConfigStore) Seq(name string) string

Seq returns seq of name's config.

func (*ConfigStore) Set Uses

func (c *ConfigStore) Set(name, seq string, confs []*cmdpb.Config)

Set sets name's confs with seq.


descriptorPackage descriptor provides command descriptor utilities.
descriptor/posixpathPackage posixpath handles posix-path (Unix style; slash separeted path).
descriptor/winpathPackage winpath handles windows-path (backslash separated path).
normalizerPackage normalizer provides functions to normalize target.
pathconvPackage pathconv provides path converter between client and server.

Package command imports 23 packages (graph) and is imported by 1 packages. Updated 2020-10-27. Refresh now. Tools for package owners.