services

package
v0.0.71 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: MIT Imports: 22 Imported by: 6

Documentation

Index

Constants

Variables

This section is empty.

Functions

func ConfigureError added in v0.0.26

func ConfigureError(err error) *runtimev1.ConfigureStatus

func ConfigureSuccess added in v0.0.26

func ConfigureSuccess() *runtimev1.ConfigureStatus

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 StartError added in v0.0.26

func StartError(err error) *runtimev1.StartStatus

func StartSuccess added in v0.0.26

func StartSuccess() *runtimev1.StartStatus

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

	// Runtime
	State InformationStatus

	// 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) CreateResponse added in v0.0.51

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

func (*Base) CreateResponseError added in v0.0.51

func (s *Base) CreateResponseError(err error) (*factoryv1.CreateResponse, 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) FactoryInitResponse added in v0.0.31

func (s *Base) FactoryInitResponse(es []*basev1.Endpoint, gettingStarted string) (*factoryv1.InitResponse, error)

func (*Base) FactoryInitResponseError added in v0.0.26

func (s *Base) FactoryInitResponseError(err error) (*factoryv1.InitResponse, error)

func (*Base) Focus added in v0.0.69

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

func (*Base) Init added in v0.0.26

func (s *Base) Init(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) RuntimeConfigureResponse added in v0.0.67

func (s *Base) RuntimeConfigureResponse() (*runtimev1.ConfigureResponse, error)

func (*Base) RuntimeConfigureResponseError added in v0.0.67

func (s *Base) RuntimeConfigureResponseError(err error, _ ...*wool.LogField) (*runtimev1.ConfigureResponse, error)

func (*Base) RuntimeInitResponse added in v0.0.26

func (s *Base) RuntimeInitResponse(endpoints []*basev1.Endpoint) (*runtimev1.InitResponse, error)

func (*Base) RuntimeInitResponseError added in v0.0.26

func (s *Base) RuntimeInitResponseError(err error) (*runtimev1.InitResponse, error)

func (*Base) RuntimeStartResponse added in v0.0.67

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

func (*Base) RuntimeStartResponseError added in v0.0.67

func (s *Base) RuntimeStartResponseError(err error, _ ...*wool.LogField) (*runtimev1.StartResponse, error)

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()

func (*Base) Wrapf added in v0.0.26

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

type Factory added in v0.0.51

type Factory interface {
	Init(ctx context.Context, req *factoryv1.InitRequest) (*factoryv1.InitResponse, 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) Init added in v0.0.51

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) Init added in v0.0.51

func (instance *FactoryInstance) Init(ctx context.Context) (*factoryv1.InitResponse, 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) Init added in v0.0.26

func (*FactoryServer) Sync added in v0.0.26

func (*FactoryServer) Update added in v0.0.26

type Information added in v0.0.26

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

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 {
	Init(ctx context.Context, req *runtimev1.InitRequest) (*runtimev1.InitResponse, error)

	Configure(ctx context.Context, req *runtimev1.ConfigureRequest) (*runtimev1.ConfigureResponse, error)

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

	Stop(ctx context.Context, req *runtimev1.StopRequest) (*runtimev1.StopResponse, 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) Configure added in v0.0.51

Configure documents things It can be used safely anywhere: doesn't start or do anything

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) 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) Init added in v0.0.51

func (instance *RuntimeInstance) Init(ctx context.Context) (*runtimev1.InitResponse, 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) Configure added in v0.0.26

func (*RuntimeServer) Information added in v0.0.26

func (*RuntimeServer) Init added in v0.0.26

func (*RuntimeServer) Start added in v0.0.26

func (*RuntimeServer) Stop added in v0.0.26

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