services

package
v0.0.84 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: MIT Imports: 20 Imported by: 6

Documentation

Index

Constants

Variables

This section is empty.

Functions

func NetworkMappingForRoute added in v0.0.28

func NetworkMappingForRoute(ctx context.Context, route *configurations.RestRoute, mappings []*runtimev1.NetworkMapping) (*runtimev1.NetworkMapping, error)

NetworkMappingForRoute finds the proper network mapping for a given route

func NewFactoryAgent added in v0.0.26

func NewFactoryAgent(conf *configurations.Agent, factory Factory) agents.AgentImplementation

func NewRuntimeAgent added in v0.0.26

func NewRuntimeAgent(conf *configurations.Agent, runtime Runtime) agents.AgentImplementation

func NewServiceAgent added in v0.0.51

func NewServiceAgent(conf *configurations.Agent, service Agent) agents.AgentImplementation

NewServiceAgent binds the agent implementation to the agent

func UpdateAgent added in v0.0.59

func UpdateAgent(ctx context.Context, service *configurations.Service) error

Types

type Agent added in v0.0.51

type Agent interface {
	GetAgentInformation(ctx context.Context, req *agentv1.AgentInformationRequest) (*agentv1.AgentInformation, error)
}

type Base added in v0.0.26

type Base struct {
	// Agent
	Agent     *configurations.Agent
	WoolAgent *wool.Provider
	Wool      *wool.Wool

	// Underlying service
	WoolService *wool.Provider

	// State
	Identity *configurations.ServiceIdentity
	Location string

	// codefly configuration
	ConfigurationLocation string

	Configuration *configurations.Service

	// Information convenience
	Information *Information

	// Endpoints
	Endpoints       []*basev1.Endpoint
	NetworkMappings []*runtimev1.NetworkMapping

	// Wrappers
	Runtime *RuntimeWrapper
	Factory *FactoryWrapper

	// Runtime
	State        InformationStatus
	DesiredState InformationStateDesired

	// Communication
	Communication *communicate.Server

	// Code Watcher
	Watcher *code.Watcher
	Events  chan code.Change
}

func NewServiceBase added in v0.0.26

func NewServiceBase(ctx context.Context, agent *configurations.Agent) *Base

func (*Base) Communicate added in v0.0.26

func (s *Base) Communicate(ctx context.Context, eng *agentv1.Engage) (*agentv1.InformationRequest, error)

func (*Base) Debug added in v0.0.69

func (s *Base) Debug(msg string, fields ...*wool.LogField)

func (*Base) DockerImage added in v0.0.31

func (s *Base) DockerImage() *configurations.DockerImage

func (*Base) EndpointsFromConfiguration added in v0.0.26

func (s *Base) EndpointsFromConfiguration(ctx context.Context) ([]*basev1.Endpoint, error)

EndpointsFromConfiguration from Configuration and data from the service

func (*Base) Errorf added in v0.0.28

func (s *Base) Errorf(format string, args ...any) error

func (*Base) Focus added in v0.0.69

func (s *Base) Focus(msg string, fields ...*wool.LogField)

func (*Base) Info added in v0.0.75

func (s *Base) Info(msg string, fields ...*wool.LogField)

func (*Base) Load added in v0.0.72

func (s *Base) Load(ctx context.Context, identity *basev1.ServiceIdentity, settings any) error

func (*Base) Local added in v0.0.26

func (s *Base) Local(f string) string

func (*Base) Ready added in v0.0.72

func (s *Base) Ready()

func (*Base) SetupWatcher added in v0.0.26

func (s *Base) SetupWatcher(ctx context.Context, conf *WatchConfiguration, handler func(event code.Change) error) error

func (*Base) Stop added in v0.0.26

func (s *Base) Stop() error

func (*Base) Templates added in v0.0.26

func (s *Base) Templates(ctx context.Context, obj any, ws ...TemplateWrapper) error

func (*Base) Version added in v0.0.26

func (s *Base) Version() *basev1.Version

func (*Base) WantRestart added in v0.0.26

func (s *Base) WantRestart()

func (*Base) WantSync added in v0.0.26

func (s *Base) WantSync()

type Factory added in v0.0.51

type Factory interface {
	Load(ctx context.Context, req *factoryv1.LoadRequest) (*factoryv1.LoadResponse, error)

	Create(ctx context.Context, req *factoryv1.CreateRequest) (*factoryv1.CreateResponse, error)
	Update(ctx context.Context, req *factoryv1.UpdateRequest) (*factoryv1.UpdateResponse, error)

	Sync(ctx context.Context, req *factoryv1.SyncRequest) (*factoryv1.SyncResponse, error)

	Build(ctx context.Context, req *factoryv1.BuildRequest) (*factoryv1.BuildResponse, error)
	Deploy(ctx context.Context, req *factoryv1.DeploymentRequest) (*factoryv1.DeploymentResponse, error)

	// Communicate is a special method that is used to communicate with the agent
	communicate.Communicate
}

type FactoryAgent added in v0.0.51

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

func LoadFactory added in v0.0.26

func LoadFactory(ctx context.Context, conf *configurations.Service) (*FactoryAgent, error)

func (FactoryAgent) Build added in v0.0.51

func (FactoryAgent) Communicate added in v0.0.51

func (FactoryAgent) Create added in v0.0.51

func (FactoryAgent) Deploy added in v0.0.51

func (FactoryAgent) Load added in v0.0.72

func (FactoryAgent) Sync added in v0.0.51

func (FactoryAgent) Update added in v0.0.51

type FactoryAgentGRPC added in v0.0.51

type FactoryAgentGRPC struct {
	// GRPCAgent must still implement the ServiceAgent interface
	plugin.Plugin
	Factory Factory
}

func (*FactoryAgentGRPC) GRPCClient added in v0.0.51

func (p *FactoryAgentGRPC) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

func (*FactoryAgentGRPC) GRPCServer added in v0.0.51

func (p *FactoryAgentGRPC) GRPCServer(_ *plugin.GRPCBroker, s *grpc.Server) error

type FactoryInstance added in v0.0.51

type FactoryInstance struct {
	*configurations.Service
	Factory
}

func (*FactoryInstance) Create added in v0.0.51

func (instance *FactoryInstance) Create(ctx context.Context) (*factoryv1.CreateResponse, error)

func (*FactoryInstance) Load added in v0.0.72

func (instance *FactoryInstance) Load(ctx context.Context) (*factoryv1.LoadResponse, error)

type FactoryServer added in v0.0.26

type FactoryServer struct {
	factoryv1.UnimplementedFactoryServer
	Factory Factory
}

FactoryServer wraps the gRPC protocol Request/Response

func (*FactoryServer) Build added in v0.0.26

func (*FactoryServer) Communicate added in v0.0.26

func (*FactoryServer) Create added in v0.0.26

func (*FactoryServer) Deploy added in v0.0.26

func (*FactoryServer) Load added in v0.0.72

func (*FactoryServer) Sync added in v0.0.26

func (*FactoryServer) Update added in v0.0.26

type FactoryWrapper added in v0.0.72

type FactoryWrapper struct {
	*Base
}

func (*FactoryWrapper) CreateError added in v0.0.72

func (s *FactoryWrapper) CreateError(err error) (*factoryv1.CreateResponse, error)

func (*FactoryWrapper) CreateResponse added in v0.0.72

func (s *FactoryWrapper) CreateResponse(ctx context.Context, settings any, endpoints ...*basev1.Endpoint) (*factoryv1.CreateResponse, error)

func (*FactoryWrapper) LoadError added in v0.0.72

func (s *FactoryWrapper) LoadError(err error) (*factoryv1.LoadResponse, error)

func (*FactoryWrapper) LoadResponse added in v0.0.72

func (s *FactoryWrapper) LoadResponse(es []*basev1.Endpoint, gettingStarted string) (*factoryv1.LoadResponse, error)

type Information added in v0.0.26

type Information struct {
	Service *configurations.ServiceWithCase
	Agent   *configurations.Agent
	Domain  string
}

type InformationStateDesired added in v0.0.72

type InformationStateDesired = runtimev1.InformationResponse_DesiredState

type InformationStatus added in v0.0.26

type InformationStatus = runtimev1.InformationResponse_Status

type ProcessInfo added in v0.0.68

type ProcessInfo struct {
	AgentPID int
	Trackers []*runtimev1.Tracker
}

type Runtime added in v0.0.51

type Runtime interface {
	// Load loads the service: it is a NoOp operation and can be called safely
	Load(ctx context.Context, req *runtimev1.LoadRequest) (*runtimev1.LoadResponse, error)

	// Init initializes the service: can include steps like compilation, etc...
	Init(ctx context.Context, req *runtimev1.InitRequest) (*runtimev1.InitResponse, error)

	// Start the underlying service
	Start(ctx context.Context, req *runtimev1.StartRequest) (*runtimev1.StartResponse, error)

	Stop(ctx context.Context, req *runtimev1.StopRequest) (*runtimev1.StopResponse, error)

	Information(ctx context.Context, req *runtimev1.InformationRequest) (*runtimev1.InformationResponse, error)

	// Communicate is a special method that is used to communicate with the agent
	communicate.Communicate
}

type RuntimeAgent added in v0.0.51

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

func LoadRuntime added in v0.0.26

func LoadRuntime(ctx context.Context, service *configurations.Service) (*RuntimeAgent, error)

func (*RuntimeAgent) Communicate added in v0.0.51

func (m *RuntimeAgent) Communicate(ctx context.Context, req *agentv1.Engage) (*agentv1.InformationRequest, error)

Communicate helper

func (*RuntimeAgent) Information added in v0.0.51

Information return some useful information about the service

func (*RuntimeAgent) Init added in v0.0.51

Init initializes the service

func (*RuntimeAgent) Load added in v0.0.72

Load loads the service: it is a NoOp operation and can be called safely

func (*RuntimeAgent) Start added in v0.0.51

Start starts the service

func (*RuntimeAgent) Stop added in v0.0.51

Stop stops the service

type RuntimeAgentGRPC added in v0.0.51

type RuntimeAgentGRPC struct {
	// GRPCAgent must still implement the ServiceAgent interface
	plugin.Plugin
	Runtime Runtime
}

func (*RuntimeAgentGRPC) GRPCClient added in v0.0.51

func (p *RuntimeAgentGRPC) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

func (*RuntimeAgentGRPC) GRPCServer added in v0.0.51

func (p *RuntimeAgentGRPC) GRPCServer(_ *plugin.GRPCBroker, s *grpc.Server) error

type RuntimeInstance added in v0.0.51

type RuntimeInstance struct {
	*configurations.Service
	Runtime
}

func (*RuntimeInstance) Load added in v0.0.72

func (instance *RuntimeInstance) Load(ctx context.Context) (*runtimev1.LoadResponse, error)

type RuntimeServer added in v0.0.26

type RuntimeServer struct {
	runtimev1.UnimplementedRuntimeServer
	Runtime Runtime
}

RuntimeServer wraps the gRPC protocol Request/Response

func (*RuntimeServer) Communicate added in v0.0.26

func (*RuntimeServer) Information added in v0.0.26

func (*RuntimeServer) Init added in v0.0.26

func (*RuntimeServer) Load added in v0.0.72

func (*RuntimeServer) Start added in v0.0.26

func (*RuntimeServer) Stop added in v0.0.26

type RuntimeWrapper added in v0.0.72

type RuntimeWrapper struct {
	*Base
}

func (*RuntimeWrapper) InformationResponse added in v0.0.75

func (*RuntimeWrapper) InitError added in v0.0.72

func (s *RuntimeWrapper) InitError(err error, fields ...*wool.LogField) (*runtimev1.InitResponse, error)

func (*RuntimeWrapper) InitResponse added in v0.0.72

func (s *RuntimeWrapper) InitResponse() (*runtimev1.InitResponse, error)

func (*RuntimeWrapper) LoadError added in v0.0.72

func (s *RuntimeWrapper) LoadError(err error) (*runtimev1.LoadResponse, error)

func (*RuntimeWrapper) LoadResponse added in v0.0.72

func (s *RuntimeWrapper) LoadResponse(endpoints []*basev1.Endpoint) (*runtimev1.LoadResponse, error)

func (*RuntimeWrapper) StartError added in v0.0.72

func (s *RuntimeWrapper) StartError(err error, fields ...*wool.LogField) (*runtimev1.StartResponse, error)

func (*RuntimeWrapper) StartResponse added in v0.0.72

func (s *RuntimeWrapper) StartResponse(trackers []*runtimev1.Tracker) (*runtimev1.StartResponse, error)

type ServiceAgent added in v0.0.51

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

func LoadAgent added in v0.0.51

func LoadAgent(ctx context.Context, agent *configurations.Agent) (*ServiceAgent, error)

func (*ServiceAgent) GetAgentInformation added in v0.0.51

GetAgentInformation provides - capabilities

type ServiceAgentContext added in v0.0.51

type ServiceAgentContext struct {
}

func (ServiceAgentContext) Default added in v0.0.51

func (m ServiceAgentContext) Default() plugin.Plugin

func (ServiceAgentContext) Key added in v0.0.51

type ServiceAgentGRPC added in v0.0.51

type ServiceAgentGRPC struct {
	// GRPCAgent must still implement the ServiceAgent interface
	plugin.Plugin
	Service Agent
}

func (*ServiceAgentGRPC) GRPCClient added in v0.0.51

func (p *ServiceAgentGRPC) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

func (*ServiceAgentGRPC) GRPCServer added in v0.0.51

func (p *ServiceAgentGRPC) GRPCServer(_ *plugin.GRPCBroker, s *grpc.Server) error

type ServiceAgentServer added in v0.0.51

type ServiceAgentServer struct {
	agentv1.UnimplementedAgentServer
	Service Agent
}

ServiceAgentServer wraps the gRPC protocol Request/Response

func (*ServiceAgentServer) GetAgentInformation added in v0.0.51

type ServiceFactoryAgentContext added in v0.0.26

type ServiceFactoryAgentContext struct {
}

func (ServiceFactoryAgentContext) Default added in v0.0.26

func (m ServiceFactoryAgentContext) Default() plugin.Plugin

func (ServiceFactoryAgentContext) Key added in v0.0.26

type ServiceInstance added in v0.0.51

type ServiceInstance struct {
	*configurations.Service
	Agent   Agent
	Factory *FactoryInstance
	Runtime *RuntimeInstance
	ProcessInfo
}

func Load added in v0.0.51

func (*ServiceInstance) LoadFactory added in v0.0.51

func (instance *ServiceInstance) LoadFactory(ctx context.Context, service *configurations.Service) error

func (*ServiceInstance) LoadRuntime added in v0.0.51

func (instance *ServiceInstance) LoadRuntime(ctx context.Context, service *configurations.Service) error

type ServiceRuntimeAgentContext added in v0.0.26

type ServiceRuntimeAgentContext struct {
}

func (ServiceRuntimeAgentContext) Default added in v0.0.26

func (m ServiceRuntimeAgentContext) Default() plugin.Plugin

func (ServiceRuntimeAgentContext) Key added in v0.0.26

type TemplateWrapper added in v0.0.26

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

func WithBuilder added in v0.0.26

func WithBuilder(fs embed.FS) TemplateWrapper

func WithDeployment added in v0.0.26

func WithDeployment(fs embed.FS) TemplateWrapper

func WithFactory added in v0.0.26

func WithFactory(fs embed.FS, ignores ...string) TemplateWrapper

type WatchConfiguration added in v0.0.26

type WatchConfiguration struct {
	Includes []string
	Excludes []string
}

func NewWatchConfiguration added in v0.0.26

func NewWatchConfiguration(includes []string, excludes ...string) *WatchConfiguration

Jump to

Keyboard shortcuts

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