instance

package
v0.3.0-prep Latest Latest
Warning

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

Go to latest
Published: May 4, 2017 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LabelMethod  = "method"
	LabelSuccess = "success"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Services map[flux.ServiceID]ServiceConfig `json:"services"`
	Settings flux.UnsafeInstanceConfig        `json:"settings"`
}

func MakeConfig

func MakeConfig() Config

type Configurer

type Configurer interface {
	Get() (Config, error)
	Update(UpdateFunc) error
}

type DB

type DB interface {
	UpdateConfig(instance flux.InstanceID, update UpdateFunc) error
	GetConfig(instance flux.InstanceID) (Config, error)
	All() ([]NamedConfig, error)
}

func InstrumentedDB

func InstrumentedDB(db DB) DB

type EventReadWriter

type EventReadWriter struct {
	// contains filtered or unexported fields
}

func (EventReadWriter) AllEvents

func (rw EventReadWriter) AllEvents(before time.Time, limit int64) ([]flux.Event, error)

func (EventReadWriter) EventsForService

func (rw EventReadWriter) EventsForService(service flux.ServiceID, before time.Time, limit int64) ([]flux.Event, error)

func (EventReadWriter) GetEvent

func (rw EventReadWriter) GetEvent(id flux.EventID) (flux.Event, error)

func (EventReadWriter) LogEvent

func (rw EventReadWriter) LogEvent(e flux.Event) error

type ImageMap

type ImageMap map[string][]flux.ImageDescription

func (ImageMap) LatestImage

func (m ImageMap) LatestImage(repo string) *flux.ImageDescription

LatestImage returns the latest releasable image for a repository. A releasable image is one that is not tagged "latest". (Assumes the available images are in descending order of latestness.) If no such image exists, returns nil, and the caller can decide whether that's an error or not.

type Instance

type Instance struct {
	Platform platform.Platform
	Registry registry.Registry
	Config   Configurer
	Repo     git.Repo

	log.Logger
	history.EventReader
	history.EventWriter
}

func New

func New(
	platform platform.Platform,
	registry registry.Registry,
	config Configurer,
	gitrepo git.Repo,
	logger log.Logger,
	events history.EventReader,
	eventlog history.EventWriter,
) *Instance

func (*Instance) CollectAvailableImages

func (h *Instance) CollectAvailableImages(services []platform.Service) (ImageMap, error)

Get the images available for the services given. An image may be mentioned more than once in the services, but will only be fetched once.

func (*Instance) ConfigRepo

func (h *Instance) ConfigRepo() git.Repo

func (*Instance) ExactImages

func (h *Instance) ExactImages(images []flux.ImageID) (ImageMap, error)

Create a map of images. It will check that each image exists.

func (*Instance) Export

func (h *Instance) Export() ([]byte, error)

func (*Instance) GetAllServices

func (h *Instance) GetAllServices(maybeNamespace string) ([]platform.Service, error)

Get the services in `namespace` along with their containers (if there are any) from the platform; if namespace is blank, just get all the services, in any namespace.

func (*Instance) GetAllServicesExcept

func (h *Instance) GetAllServicesExcept(maybeNamespace string, ignored flux.ServiceIDSet) (res []platform.Service, err error)

Get all services except those with an ID in the set given

func (*Instance) GetConfig

func (h *Instance) GetConfig() (Config, error)

func (*Instance) GetRepository

func (h *Instance) GetRepository(repo string) (res []flux.ImageDescription, err error)

GetRepository exposes this instance's registry's GetRepository method directly.

func (*Instance) GetServices

func (h *Instance) GetServices(ids []flux.ServiceID) ([]platform.Service, error)

Get the services mentioned, along with their containers.

func (*Instance) Ping

func (h *Instance) Ping() error

func (*Instance) PlatformApply

func (h *Instance) PlatformApply(defs []platform.ServiceDefinition) (err error)

func (*Instance) UpdateConfig

func (h *Instance) UpdateConfig(update UpdateFunc) error

func (*Instance) Version

func (h *Instance) Version() (string, error)

type Instancer

type Instancer interface {
	Get(inst flux.InstanceID) (*Instance, error)
}

type MockConfigurer

type MockConfigurer struct {
	Config Config
	Error  error
}

func (*MockConfigurer) Get

func (c *MockConfigurer) Get() (Config, error)

func (*MockConfigurer) Update

func (c *MockConfigurer) Update(up UpdateFunc) error

type MockInstancer

type MockInstancer struct {
	Instance *Instance
	Error    error
}

func (*MockInstancer) Get

func (m *MockInstancer) Get(_ flux.InstanceID) (*Instance, error)

type MultitenantInstancer

type MultitenantInstancer struct {
	DB                  DB
	Connecter           platform.Connecter
	Logger              log.Logger
	History             history.DB
	MemcacheClient      registry.MemcacheClient
	RegistryCacheExpiry time.Duration
}

func (*MultitenantInstancer) Get

func (m *MultitenantInstancer) Get(instanceID flux.InstanceID) (*Instance, error)

type NamedConfig

type NamedConfig struct {
	ID     flux.InstanceID
	Config Config
}

type ServiceConfig

type ServiceConfig struct {
	Automated bool `json:"automation"`
	Locked    bool `json:"locked"`
}

func (ServiceConfig) Policy

func (c ServiceConfig) Policy() flux.Policy

type StandaloneInstancer

type StandaloneInstancer struct {
	Instance    flux.InstanceID
	Connecter   platform.Connecter
	Registry    registry.Registry
	Config      Configurer
	GitRepo     git.Repo
	EventReader history.EventReader
	EventWriter history.EventWriter
	BaseLogger  log.Logger
}

StandaloneInstancer is the instancer for standalone mode

func (StandaloneInstancer) Get

type UpdateFunc

type UpdateFunc func(config Config) (Config, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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