Documentation
¶
Index ¶
- Constants
- Variables
- type ApplyResourceRequest
- type BaseOperator
- func (b *BaseOperator) ApplyNodes(place []*proto.Instance, cluster []*proto.Instance) ([]*proto.Instance, error)
- func (b *BaseOperator) ApplyResource(req *ApplyResourceRequest) error
- func (b *BaseOperator) Client(node *proto.Instance) (interface{}, error)
- func (b *BaseOperator) Evaluate(comp *proto.Component) (*proto.Component, error)
- func (b *BaseOperator) GetSchemas() GetSchemasResponse
- func (b *BaseOperator) SetHandler(h Handler2)
- func (b *BaseOperator) Setup(cplane ControlPlane)
- type CallbackRequest
- type Config
- type ControlPlane
- type GetSchemasResponse
- type Handler
- type Handler2
- type HandlerFactory
- type Harness
- func (h *Harness) AddComponent(c *proto.Component)
- func (h *Harness) ApplyDep(plan *proto.Plan, callback func(i *proto.Instance)) *proto.Deployment
- func (h *Harness) Eval() *proto.Plan
- func (h *Harness) Expect(plan *proto.Plan, expect *HarnessExpect)
- func (h *Harness) GetComponentByID(dep, id string, sequence int64) (*proto.Component, error)
- func (h *Harness) GetHandler(id string) (Handler, error)
- func (h *Harness) LoadDeployment(id string) (*proto.Deployment, error)
- type HarnessExpect
- type HarnessExpectInstance
- type InmemControlPlane
- type InstanceUpdate
- type Nodetype
- type Port
- type Provider
- type ProviderFactory
- type ProviderResources
- type Resource
- type Resource2
- type ResourceScheduler
- type Scheduler
- type Server
- func (s *Server) Config() *Config
- func (s *Server) Exec(n *proto.Instance, path string, cmd ...string) (string, error)
- func (s *Server) GetComponentByID(deployment, compID string, sequence int64) (*proto.Component, error)
- func (s *Server) GetHandler(id string) (Handler, error)
- func (s *Server) GetInstance(instanceID string) (*proto.Instance, error)
- func (s *Server) LoadDeployment(id string) (*proto.Deployment, error)
- func (s *Server) Stop()
- func (s *Server) SubmitPlan(eval *proto.Evaluation, p *proto.Plan) error
- func (s *Server) SubscribeInstanceUpdates() <-chan *InstanceUpdate
- func (s *Server) UpsertInstance(n *proto.Instance) error
- type Spec
- type Volume
Constants ¶
View Source
const ( ApplyResourceRequestDelete = "delete" ApplyResourceRequestReconcile = "reconcile" )
Variables ¶
View Source
var ( ErrInstanceAlreadyRunning = fmt.Errorf("instance already running") ErrProviderNameAlreadyUsed = fmt.Errorf("name already used") )
View Source
var ErrResourceNotFound = fmt.Errorf("resource not found")
Functions ¶
This section is empty.
Types ¶
type ApplyResourceRequest ¶ added in v0.1.3
type ApplyResourceRequest struct {
Deployment *proto.Deployment
Resource *proto.ResourceSpec
Action string
}
type BaseOperator ¶ added in v0.1.3
type BaseOperator struct {
// contains filtered or unexported fields
}
func (*BaseOperator) ApplyNodes ¶ added in v0.1.3
func (*BaseOperator) ApplyResource ¶ added in v0.1.3
func (b *BaseOperator) ApplyResource(req *ApplyResourceRequest) error
func (*BaseOperator) Client ¶ added in v0.1.3
func (b *BaseOperator) Client(node *proto.Instance) (interface{}, error)
func (*BaseOperator) GetSchemas ¶ added in v0.1.3
func (b *BaseOperator) GetSchemas() GetSchemasResponse
func (*BaseOperator) SetHandler ¶ added in v0.1.3
func (b *BaseOperator) SetHandler(h Handler2)
func (*BaseOperator) Setup ¶ added in v0.1.3
func (b *BaseOperator) Setup(cplane ControlPlane)
type CallbackRequest ¶ added in v0.1.3
type CallbackRequest struct {
Client interface{}
Data *schema.ResourceData
}
func (*CallbackRequest) Get ¶ added in v0.1.3
func (c *CallbackRequest) Get(s string) interface{}
type Config ¶
type Config struct {
// Provider is the provider used by the operator
Provider Provider
// State is the state access
State *boltdb.BoltDB
// Backends are the list of backends handled by the operator
HandlerFactories []HandlerFactory
// GRPCAddr is the address of the grpc server
GRPCAddr *net.TCPAddr
}
Config is the parametrization of the operator server
type ControlPlane ¶ added in v0.1.3
type GetSchemasResponse ¶ added in v0.1.3
type Handler ¶
type Handler interface {
// Name returns the name of the handler (TODO. it can be removed later)
Name() string
// Setup starts the backend and passes the control plane reference
Setup(cplane ControlPlane)
// Evaluate evaluates a component schema
Evaluate(comp *proto.Component) (*proto.Component, error)
// GetSchemas returns the schemas for the backend
GetSchemas() GetSchemasResponse
// ApplyNodes applies to the spec the changes required
ApplyNodes(n []*proto.Instance, cluster []*proto.Instance) ([]*proto.Instance, error)
// ApplyResource applies a resource change
ApplyResource(req *ApplyResourceRequest) error
}
Handler is the interface that needs to be implemented by the backend
type Harness ¶ added in v0.1.3
type Harness struct {
Deployment *proto.Deployment
Handler Handler
Scheduler Scheduler
Component *proto.Component
// contains filtered or unexported fields
}
func NewHarness ¶ added in v0.1.3
func (*Harness) AddComponent ¶ added in v0.1.3
func (*Harness) Expect ¶ added in v0.1.3
func (h *Harness) Expect(plan *proto.Plan, expect *HarnessExpect)
func (*Harness) GetComponentByID ¶ added in v0.1.3
func (*Harness) GetHandler ¶ added in v0.1.3
func (*Harness) LoadDeployment ¶ added in v0.1.3
func (h *Harness) LoadDeployment(id string) (*proto.Deployment, error)
type HarnessExpect ¶ added in v0.1.3
type HarnessExpect struct {
Status string
Nodes []*HarnessExpectInstance
}
type HarnessExpectInstance ¶ added in v0.1.3
type InmemControlPlane ¶ added in v0.1.3
type InmemControlPlane struct {
// contains filtered or unexported fields
}
func (*InmemControlPlane) GetInstance ¶ added in v0.1.3
func (i *InmemControlPlane) GetInstance(InstanceID string) (*proto.Instance, error)
func (*InmemControlPlane) SubscribeInstanceUpdates ¶ added in v0.1.3
func (i *InmemControlPlane) SubscribeInstanceUpdates() <-chan *InstanceUpdate
func (*InmemControlPlane) UpsertInstance ¶ added in v0.1.3
func (i *InmemControlPlane) UpsertInstance(ii *proto.Instance) error
type InstanceUpdate ¶ added in v0.1.3
type InstanceUpdate struct {
InstanceID string
}
type Nodetype ¶
type Nodetype struct {
// Image is the default docker image for the node
Image string
// Config is the configuration fields for this node type
Config interface{} // out
Schema schema.Schema2
// Version is the default docker image for the node
DefaultVersion string
// Volume is a list volumes for this node type
Volumes []*Volume
// Ports is a list of ports for this node type
Ports []*Port
}
Nodetype is a type of node for the Backend
type Provider ¶
type Provider interface {
// Setup setups the provider (Maybe do this on the factory)
Setup(ControlPlane) error
// Start starts the provider
Start() error
Stop() error
// Exec executes a shell script
Exec(handler string, path string, args ...string) (string, error)
// Resources returns a struct that defines the node resources
// that can be configured for this provider
Resources() ProviderResources
Name() string
}
Provider is the entity that holds the state of the infrastructure. Both for the computing resources and the general resources.
type ProviderFactory ¶
ProviderFactory is a factory method to create factories
type ProviderResources ¶ added in v0.1.3
type Resource ¶
type Resource interface {
GetName() string
Delete(conn interface{}) error
Reconcile(conn interface{}) error
Init(spec map[string]interface{}) error
}
Resource is a resource in the cluster
type Resource2 ¶ added in v0.1.3
type Resource2 struct {
Name string
Schema schema.Schema2
DeleteFn func(req *CallbackRequest) error
ApplyFn func(req *CallbackRequest) error
}
type ResourceScheduler ¶ added in v0.1.3
type ResourceScheduler struct {
// contains filtered or unexported fields
}
func (*ResourceScheduler) Process ¶ added in v0.1.3
func (r *ResourceScheduler) Process(eval *proto.Evaluation) (*proto.Plan, error)
type Scheduler ¶ added in v0.1.3
type Scheduler interface {
Process(eval *proto.Evaluation) (*proto.Plan, error)
}
func NewScheduler ¶ added in v0.1.3
func NewScheduler(state schedState) Scheduler
type Server ¶
type Server struct {
Provider Provider
State *boltdb.BoltDB
// contains filtered or unexported fields
}
Server is the operator server
func (*Server) GetComponentByID ¶ added in v0.1.3
func (*Server) GetInstance ¶ added in v0.1.3
func (*Server) LoadDeployment ¶ added in v0.1.3
func (s *Server) LoadDeployment(id string) (*proto.Deployment, error)
func (*Server) SubmitPlan ¶ added in v0.1.3
func (*Server) SubscribeInstanceUpdates ¶ added in v0.1.3
func (s *Server) SubscribeInstanceUpdates() <-chan *InstanceUpdate
type Spec ¶
type Spec struct {
Name string // out
Nodetypes map[string]Nodetype
Resources []*Resource2
Validate func(comp *proto.Component) (*proto.Component, error)
Handlers map[string]func(spec *proto.NodeSpec, grp *proto.ClusterSpec_Group, data *schema.ResourceData)
Startup func(i *proto.Instance) error
}
Spec returns the backend specification
Source Files
¶
Click to show internal directories.
Click to hide internal directories.