versioncontrol

package
v1.19.7 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2021 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// RolloutErr defines the rollout config error class.
	RolloutErr = errs.Class("rollout config error")
	// EmptySeedErr is used when the rollout contains an empty seed value.
	EmptySeedErr = RolloutErr.New("empty seed")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Address  string `user:"true" help:"public address to listen on" default:":8080"`
	Versions OldVersionConfig

	Binary ProcessesConfig
}

Config is all the configuration parameters for a Version Control Server.

type OldVersionConfig added in v0.24.0

type OldVersionConfig struct {
	Satellite   string `user:"true" help:"Allowed Satellite Versions" default:"v0.0.1"`
	Storagenode string `user:"true" help:"Allowed Storagenode Versions" default:"v0.0.1"`
	Uplink      string `user:"true" help:"Allowed Uplink Versions" default:"v0.0.1"`
	Gateway     string `user:"true" help:"Allowed Gateway Versions" default:"v0.0.1"`
	Identity    string `user:"true" help:"Allowed Identity Versions" default:"v0.0.1"`
}

OldVersionConfig provides a list of allowed Versions per process.

NB: use `ProcessesConfig` for newer code instead.

type Peer

type Peer struct {
	// core dependencies
	Log *zap.Logger

	// Web server
	Server struct {
		Endpoint http.Server
		Listener net.Listener
	}
	Versions version.AllowedVersions
	// contains filtered or unexported fields
}

Peer is the representation of a VersionControl Server.

architecture: Peer

func New

func New(log *zap.Logger, config *Config) (peer *Peer, err error)

New creates a new VersionControl Server.

func (*Peer) Addr

func (peer *Peer) Addr() string

Addr returns the public address.

func (*Peer) Close

func (peer *Peer) Close() (err error)

Close closes all the resources.

func (*Peer) HandleGet

func (peer *Peer) HandleGet(w http.ResponseWriter, r *http.Request)

HandleGet contains the request handler for the version control web server.

func (*Peer) Run

func (peer *Peer) Run(ctx context.Context) (err error)

Run runs versioncontrol server until it's either closed or it errors.

type ProcessConfig added in v0.24.0

type ProcessConfig struct {
	Minimum   VersionConfig
	Suggested VersionConfig
	Rollout   RolloutConfig
}

ProcessConfig represents versions configuration for a single process.

type ProcessesConfig added in v0.24.0

type ProcessesConfig struct {
	Satellite          ProcessConfig
	Storagenode        ProcessConfig
	StoragenodeUpdater ProcessConfig
	Uplink             ProcessConfig
	Gateway            ProcessConfig
	Identity           ProcessConfig
}

ProcessesConfig represents versions configuration for all processes.

func (ProcessesConfig) ValidateRollouts added in v0.24.0

func (versions ProcessesConfig) ValidateRollouts(log *zap.Logger) error

ValidateRollouts validates the rollout field of each field in the Versions struct.

type RolloutConfig added in v0.24.0

type RolloutConfig struct {
	Seed   string `user:"true" help:"random 32 byte, hex-encoded string"`
	Cursor int    `user:"true" help:"percentage of nodes which should roll-out to the suggested version" default:"0"`
}

RolloutConfig represents the state of a version rollout configuration of a process.

func (RolloutConfig) Validate added in v0.24.0

func (rollout RolloutConfig) Validate() error

Validate validates the rollout seed and cursor config values.

type VersionConfig added in v0.24.0

type VersionConfig struct {
	Version string `user:"true" help:"peer version" default:"v0.0.1"`
	URL     string `user:"true" help:"URL for specific binary" default:""`
}

VersionConfig single version configuration.

Jump to

Keyboard shortcuts

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