Documentation
¶
Index ¶
- Constants
- func AgentLogger(ctx context.Context) *agents.AgentLogger
- func ConfigureError(err error) *runtimev1.ConfigureStatus
- func ConfigureSuccess() *runtimev1.ConfigureStatus
- func NetworkMappingForRoute(ctx context.Context, route *configurations.RestRoute, ...) (*runtimev1.NetworkMapping, error)
- func NewFactoryAgent(conf *configurations.Agent, factory IFactory) agents.AgentImplementation
- func NewRuntimeAgent(conf *configurations.Agent, runtime IRuntime) agents.AgentImplementation
- func ServiceLogger(ctx context.Context) *agents.ServiceLogger
- func StartError(err error) *runtimev1.StartStatus
- func StartSuccess() *runtimev1.StartStatus
- func WithDestination(destination string, args ...any) templates.TemplateOptionFunc
- type Base
- func (s *Base) Communicate(eng *agentsv1.Engage) (*agentsv1.InformationRequest, error)
- func (s *Base) Context() context.Context
- func (s *Base) Create(settings any, endpoints ...*basev1.Endpoint) (*factoryv1.CreateResponse, error)
- func (s *Base) DebugMe(format string, args ...any)
- func (s *Base) Debugf(format string, args ...any)
- func (s *Base) DockerImage() *configurations.DockerImage
- func (s *Base) EndpointsFromConfiguration() ([]*basev1.Endpoint, error)
- func (s *Base) Errorf(format string, args ...interface{}) error
- func (s *Base) FactoryInitResponse(es []*basev1.Endpoint, channels []*agentsv1.Channel, readme string) (*factoryv1.InitResponse, error)
- func (s *Base) FactoryInitResponseError(err error) (*factoryv1.InitResponse, error)
- func (s *Base) Init(req *servicev1.InitRequest, settings any) error
- func (s *Base) Local(f string) string
- func (s *Base) RuntimeInitResponse(endpoints []*basev1.Endpoint, channels ...*agentsv1.Channel) (*runtimev1.InitResponse, error)
- func (s *Base) RuntimeInitResponseError(err error) (*runtimev1.InitResponse, error)
- func (s *Base) SetupWatcher(conf *WatchConfiguration, handler func(event code.Change) error) error
- func (s *Base) Stop() error
- func (s *Base) Templates(obj any, ws ...TemplateWrapper) error
- func (s *Base) Version() *servicev1.Version
- func (s *Base) WantRestart()
- func (s *Base) WantSync()
- func (s *Base) Wire(method agentsv1.Method, client *communicate.ClientContext) error
- func (s *Base) WithCommunications(channels ...*Channel) ([]*agentsv1.Channel, error)
- func (s *Base) Wrapf(err error, format string, args ...interface{}) error
- type Channel
- type FactoryServer
- func (m *FactoryServer) Build(ctx context.Context, req *factoryv1.BuildRequest) (*factoryv1.BuildResponse, error)
- func (m *FactoryServer) Communicate(ctx context.Context, req *agentsv1.Engage) (*agentsv1.InformationRequest, error)
- func (m *FactoryServer) Create(ctx context.Context, req *factoryv1.CreateRequest) (*factoryv1.CreateResponse, error)
- func (m *FactoryServer) Deploy(ctx context.Context, req *factoryv1.DeploymentRequest) (*factoryv1.DeploymentResponse, error)
- func (m *FactoryServer) Init(ctx context.Context, req *servicev1.InitRequest) (*factoryv1.InitResponse, error)
- func (m *FactoryServer) Sync(ctx context.Context, req *factoryv1.SyncRequest) (*factoryv1.SyncResponse, error)
- func (m *FactoryServer) Update(ctx context.Context, req *factoryv1.UpdateRequest) (*factoryv1.UpdateResponse, error)
- type IFactory
- type IRuntime
- type Information
- type InformationStatus
- type ProcessState
- type RuntimeServer
- func (m *RuntimeServer) Communicate(ctx context.Context, req *agentsv1.Engage) (*agentsv1.InformationRequest, error)
- func (m *RuntimeServer) Configure(ctx context.Context, req *runtimev1.ConfigureRequest) (*runtimev1.ConfigureResponse, error)
- func (m *RuntimeServer) Information(ctx context.Context, req *runtimev1.InformationRequest) (*runtimev1.InformationResponse, error)
- func (m *RuntimeServer) Init(ctx context.Context, req *v1.InitRequest) (*runtimev1.InitResponse, error)
- func (m *RuntimeServer) Start(ctx context.Context, req *runtimev1.StartRequest) (*runtimev1.StartResponse, error)
- func (m *RuntimeServer) Stop(ctx context.Context, req *runtimev1.StopRequest) (*runtimev1.StopResponse, error)
- type ServiceEvent
- type ServiceFactory
- func (m ServiceFactory) Build(req *factoryv1.BuildRequest) (*factoryv1.BuildResponse, error)
- func (m ServiceFactory) Communicate(req *agentsv1.Engage) (*agentsv1.InformationRequest, error)
- func (m ServiceFactory) Create(req *factoryv1.CreateRequest) (*factoryv1.CreateResponse, error)
- func (m ServiceFactory) Deploy(req *factoryv1.DeploymentRequest) (*factoryv1.DeploymentResponse, error)
- func (m ServiceFactory) Init(req *servicev1.InitRequest) (*factoryv1.InitResponse, error)
- func (m ServiceFactory) Sync(req *factoryv1.SyncRequest) (*factoryv1.SyncResponse, error)
- func (m ServiceFactory) Update(req *factoryv1.UpdateRequest) (*factoryv1.UpdateResponse, error)
- type ServiceFactoryAgent
- type ServiceFactoryAgentContext
- type ServiceRuntime
- func (m *ServiceRuntime) Communicate(req *agentsv1.Engage) (*agentsv1.InformationRequest, error)
- func (m *ServiceRuntime) Configure(req *runtimev1.ConfigureRequest) (*runtimev1.ConfigureResponse, error)
- func (m *ServiceRuntime) Information(req *runtimev1.InformationRequest) (*runtimev1.InformationResponse, error)
- func (m *ServiceRuntime) Init(req *v1.InitRequest) (*runtimev1.InitResponse, error)
- func (m *ServiceRuntime) Start(req *runtimev1.StartRequest) (*runtimev1.StartResponse, error)
- func (m *ServiceRuntime) Stop(req *runtimev1.StopRequest) (*runtimev1.StopResponse, error)
- type ServiceRuntimeAgent
- type ServiceRuntimeAgentContext
- type ServiceRuntimeLoader
- type SingleTracker
- type TemplateWrapper
- type Tracked
- type TrackedContainer
- type TrackedProcess
- type Tracker
- type Usage
- type WatchConfiguration
Constants ¶
View Source
const ( UnknownState = runtimev1.InformationResponse_UNKNOWN InitState = runtimev1.InformationResponse_INIT StartedState = runtimev1.InformationResponse_STARTED RestartWantedState = runtimev1.InformationResponse_RESTART_WANTED SyncWantedState = runtimev1.InformationResponse_SYNC_WANTED StoppedState = runtimev1.InformationResponse_STOPPED ErrorState = runtimev1.InformationResponse_ERROR )
Variables ¶
This section is empty.
Functions ¶
func AgentLogger ¶ added in v0.0.26
func AgentLogger(ctx context.Context) *agents.AgentLogger
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 IFactory) agents.AgentImplementation
func NewRuntimeAgent ¶ added in v0.0.26
func NewRuntimeAgent(conf *configurations.Agent, runtime IRuntime) agents.AgentImplementation
func ServiceLogger ¶ added in v0.0.26
func ServiceLogger(ctx context.Context) *agents.ServiceLogger
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 WithDestination ¶ added in v0.0.31
func WithDestination(destination string, args ...any) templates.TemplateOptionFunc
Types ¶
type Base ¶ added in v0.0.26
type Base struct {
// Agent
Agent *configurations.Agent
// State
Identity *servicev1.ServiceIdentity
Location string
// codefly configuration
ConfigurationLocation string
Configuration *configurations.Service
// Information convenience
Information *Information
// Endpoints
Endpoints []*basev1.Endpoint
// Runtime
State InformationStatus
// Loggers
ServiceLogger *agents.ServiceLogger
AgentLogger *agents.AgentLogger
// Communication Manager
CommunicationClientManager *communicate.ClientManager
// Code Watcher
Watcher *code.Watcher
Events chan code.Change
// contains filtered or unexported fields
}
func NewServiceBase ¶ added in v0.0.26
func NewServiceBase(agent *configurations.Agent) *Base
func (*Base) Communicate ¶ added in v0.0.26
func (*Base) DockerImage ¶ added in v0.0.31
func (s *Base) DockerImage() *configurations.DockerImage
func (*Base) EndpointsFromConfiguration ¶ added in v0.0.26
EndpointsFromConfiguration from Configuration and data from the service
func (*Base) FactoryInitResponse ¶ added in v0.0.31
func (*Base) FactoryInitResponseError ¶ added in v0.0.26
func (s *Base) FactoryInitResponseError(err error) (*factoryv1.InitResponse, error)
func (*Base) Init ¶ added in v0.0.26
func (s *Base) Init(req *servicev1.InitRequest, settings any) error
func (*Base) RuntimeInitResponse ¶ added in v0.0.26
func (*Base) RuntimeInitResponseError ¶ added in v0.0.26
func (s *Base) RuntimeInitResponseError(err error) (*runtimev1.InitResponse, error)
func (*Base) SetupWatcher ¶ added in v0.0.26
func (*Base) Templates ¶ added in v0.0.26
func (s *Base) Templates(obj any, ws ...TemplateWrapper) error
func (*Base) WantRestart ¶ added in v0.0.26
func (s *Base) WantRestart()
func (*Base) Wire ¶ added in v0.0.26
func (s *Base) Wire(method agentsv1.Method, client *communicate.ClientContext) error
func (*Base) WithCommunications ¶ added in v0.0.26
type Channel ¶ added in v0.0.26
type Channel struct {
Method agentsv1.Method
Client *communicate.ClientContext
}
func NewChannel ¶ added in v0.0.26
func NewChannel(method agentsv1.Method, client *communicate.ClientContext) *Channel
func NewDynamicChannel ¶ added in v0.0.26
type FactoryServer ¶ added in v0.0.26
type FactoryServer struct {
factoryv1.UnimplementedFactoryServer
Factory IFactory
}
FactoryServer wraps the gRPC protocol Request/Response
func (*FactoryServer) Build ¶ added in v0.0.26
func (m *FactoryServer) Build(ctx context.Context, req *factoryv1.BuildRequest) (*factoryv1.BuildResponse, error)
func (*FactoryServer) Communicate ¶ added in v0.0.26
func (m *FactoryServer) Communicate(ctx context.Context, req *agentsv1.Engage) (*agentsv1.InformationRequest, error)
func (*FactoryServer) Create ¶ added in v0.0.26
func (m *FactoryServer) Create(ctx context.Context, req *factoryv1.CreateRequest) (*factoryv1.CreateResponse, error)
func (*FactoryServer) Deploy ¶ added in v0.0.26
func (m *FactoryServer) Deploy(ctx context.Context, req *factoryv1.DeploymentRequest) (*factoryv1.DeploymentResponse, error)
func (*FactoryServer) Init ¶ added in v0.0.26
func (m *FactoryServer) Init(ctx context.Context, req *servicev1.InitRequest) (*factoryv1.InitResponse, error)
func (*FactoryServer) Sync ¶ added in v0.0.26
func (m *FactoryServer) Sync(ctx context.Context, req *factoryv1.SyncRequest) (*factoryv1.SyncResponse, error)
func (*FactoryServer) Update ¶ added in v0.0.26
func (m *FactoryServer) Update(ctx context.Context, req *factoryv1.UpdateRequest) (*factoryv1.UpdateResponse, error)
type IFactory ¶ added in v0.0.26
type IFactory interface {
Init(req *servicev1.InitRequest) (*factoryv1.InitResponse, error)
Create(req *factoryv1.CreateRequest) (*factoryv1.CreateResponse, error)
Update(req *factoryv1.UpdateRequest) (*factoryv1.UpdateResponse, error)
Sync(req *factoryv1.SyncRequest) (*factoryv1.SyncResponse, error)
Build(req *factoryv1.BuildRequest) (*factoryv1.BuildResponse, error)
Deploy(req *factoryv1.DeploymentRequest) (*factoryv1.DeploymentResponse, error)
Communicate(req *agentsv1.Engage) (*agentsv1.InformationRequest, error)
}
type IRuntime ¶ added in v0.0.26
type IRuntime interface {
Init(req *v1.InitRequest) (*runtimev1.InitResponse, error)
Configure(req *runtimev1.ConfigureRequest) (*runtimev1.ConfigureResponse, error)
Start(req *runtimev1.StartRequest) (*runtimev1.StartResponse, error)
Information(req *runtimev1.InformationRequest) (*runtimev1.InformationResponse, error)
Stop(req *runtimev1.StopRequest) (*runtimev1.StopResponse, error)
Communicate(req *agentsv1.Engage) (*agentsv1.InformationRequest, error)
}
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 ProcessState ¶
type ProcessState int
const ( Unknown ProcessState = iota NotFound ProcessState = iota Running InterruptibleSleep UninterruptibleSleep Stopped Zombie Dead TracingStop Idle Parked Waking )
func (ProcessState) String ¶
func (ps ProcessState) String() string
type RuntimeServer ¶ added in v0.0.26
type RuntimeServer struct {
runtimev1.UnimplementedRuntimeServer
Runtime IRuntime
}
RuntimeServer wraps the gRPC protocol Request/Response
func (*RuntimeServer) Communicate ¶ added in v0.0.26
func (m *RuntimeServer) Communicate(ctx context.Context, req *agentsv1.Engage) (*agentsv1.InformationRequest, error)
func (*RuntimeServer) Configure ¶ added in v0.0.26
func (m *RuntimeServer) Configure(ctx context.Context, req *runtimev1.ConfigureRequest) (*runtimev1.ConfigureResponse, error)
func (*RuntimeServer) Information ¶ added in v0.0.26
func (m *RuntimeServer) Information(ctx context.Context, req *runtimev1.InformationRequest) (*runtimev1.InformationResponse, error)
func (*RuntimeServer) Init ¶ added in v0.0.26
func (m *RuntimeServer) Init(ctx context.Context, req *v1.InitRequest) (*runtimev1.InitResponse, error)
func (*RuntimeServer) Start ¶ added in v0.0.26
func (m *RuntimeServer) Start(ctx context.Context, req *runtimev1.StartRequest) (*runtimev1.StartResponse, error)
func (*RuntimeServer) Stop ¶ added in v0.0.26
func (m *RuntimeServer) Stop(ctx context.Context, req *runtimev1.StopRequest) (*runtimev1.StopResponse, error)
type ServiceEvent ¶
type ServiceFactory ¶ added in v0.0.26
type ServiceFactory struct {
// contains filtered or unexported fields
}
func LoadFactory ¶ added in v0.0.26
func LoadFactory(conf *configurations.Service) (*ServiceFactory, error)
func (ServiceFactory) Build ¶ added in v0.0.26
func (m ServiceFactory) Build(req *factoryv1.BuildRequest) (*factoryv1.BuildResponse, error)
func (ServiceFactory) Communicate ¶ added in v0.0.26
func (m ServiceFactory) Communicate(req *agentsv1.Engage) (*agentsv1.InformationRequest, error)
func (ServiceFactory) Create ¶ added in v0.0.26
func (m ServiceFactory) Create(req *factoryv1.CreateRequest) (*factoryv1.CreateResponse, error)
func (ServiceFactory) Deploy ¶ added in v0.0.26
func (m ServiceFactory) Deploy(req *factoryv1.DeploymentRequest) (*factoryv1.DeploymentResponse, error)
func (ServiceFactory) Init ¶ added in v0.0.26
func (m ServiceFactory) Init(req *servicev1.InitRequest) (*factoryv1.InitResponse, error)
func (ServiceFactory) Sync ¶ added in v0.0.26
func (m ServiceFactory) Sync(req *factoryv1.SyncRequest) (*factoryv1.SyncResponse, error)
func (ServiceFactory) Update ¶ added in v0.0.26
func (m ServiceFactory) Update(req *factoryv1.UpdateRequest) (*factoryv1.UpdateResponse, error)
type ServiceFactoryAgent ¶ added in v0.0.26
type ServiceFactoryAgent struct {
// GRPCAgent must still implement the Agent interface
plugin.Plugin
Factory IFactory
}
func (*ServiceFactoryAgent) GRPCClient ¶ added in v0.0.26
func (p *ServiceFactoryAgent) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
func (*ServiceFactoryAgent) GRPCServer ¶ added in v0.0.26
func (p *ServiceFactoryAgent) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error
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
func (m ServiceFactoryAgentContext) Key(p *configurations.Agent, unique string) string
type ServiceRuntime ¶ added in v0.0.26
type ServiceRuntime struct {
// contains filtered or unexported fields
}
func LoadRuntime ¶ added in v0.0.26
func LoadRuntime(service *configurations.Service, opts ...agents.Option) (*ServiceRuntime, error)
func (*ServiceRuntime) Communicate ¶ added in v0.0.26
func (m *ServiceRuntime) Communicate(req *agentsv1.Engage) (*agentsv1.InformationRequest, error)
Communicate helper
func (*ServiceRuntime) Configure ¶ added in v0.0.26
func (m *ServiceRuntime) Configure(req *runtimev1.ConfigureRequest) (*runtimev1.ConfigureResponse, error)
Configure documents things It can be used safely anywhere: doesn't start or do anything
func (*ServiceRuntime) Information ¶ added in v0.0.26
func (m *ServiceRuntime) Information(req *runtimev1.InformationRequest) (*runtimev1.InformationResponse, error)
Information return some useful information about the service
func (*ServiceRuntime) Init ¶ added in v0.0.26
func (m *ServiceRuntime) Init(req *v1.InitRequest) (*runtimev1.InitResponse, error)
Init initializes the service
func (*ServiceRuntime) Start ¶ added in v0.0.26
func (m *ServiceRuntime) Start(req *runtimev1.StartRequest) (*runtimev1.StartResponse, error)
Start starts the service
func (*ServiceRuntime) Stop ¶ added in v0.0.26
func (m *ServiceRuntime) Stop(req *runtimev1.StopRequest) (*runtimev1.StopResponse, error)
Stop stops the service
type ServiceRuntimeAgent ¶ added in v0.0.26
type ServiceRuntimeAgent struct {
// GRPCAgent must still implement the Agent interface
plugin.Plugin
Runtime IRuntime
}
func (*ServiceRuntimeAgent) GRPCClient ¶ added in v0.0.26
func (p *ServiceRuntimeAgent) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
func (*ServiceRuntimeAgent) GRPCServer ¶ added in v0.0.26
func (p *ServiceRuntimeAgent) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) 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
func (m ServiceRuntimeAgentContext) Key(p *configurations.Agent, unique string) string
type ServiceRuntimeLoader ¶ added in v0.0.26
type ServiceRuntimeLoader struct {
Logger hclog.Logger
}
type SingleTracker ¶
type SingleTracker struct {
Tracked Tracked
sync.RWMutex
// contains filtered or unexported fields
}
func (*SingleTracker) Stop ¶
func (t *SingleTracker) Stop()
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 WithDeploymentFor ¶ added in v0.0.26
func WithDeploymentFor(fs embed.FS, relativePath string, opts ...templates.TemplateOptionFunc) TemplateWrapper
func WithFactory ¶ added in v0.0.26
func WithFactory(fs embed.FS, ignores ...string) TemplateWrapper
type Tracked ¶
type Tracked interface {
Name() string // For display
Unique() string // For identification in the system
GetStatus() (ProcessState, error)
GetUsage() (*Usage, error)
Kill() error
}
func NewTracked ¶
type TrackedContainer ¶
type TrackedContainer struct {
// contains filtered or unexported fields
}
func (TrackedContainer) GetStatus ¶
func (t TrackedContainer) GetStatus() (ProcessState, error)
func (TrackedContainer) GetUsage ¶
func (t TrackedContainer) GetUsage() (*Usage, error)
func (TrackedContainer) Kill ¶
func (t TrackedContainer) Kill() error
func (TrackedContainer) Name ¶
func (t TrackedContainer) Name() string
func (TrackedContainer) Unique ¶
func (t TrackedContainer) Unique() string
type TrackedProcess ¶
func (*TrackedProcess) GetStatus ¶
func (p *TrackedProcess) GetStatus() (ProcessState, error)
func (*TrackedProcess) GetUsage ¶
func (p *TrackedProcess) GetUsage() (*Usage, error)
func (*TrackedProcess) Kill ¶
func (p *TrackedProcess) Kill() error
func (*TrackedProcess) Name ¶
func (p *TrackedProcess) Name() string
func (*TrackedProcess) Proto ¶
func (p *TrackedProcess) Proto() *runtimev1.Tracker
func (*TrackedProcess) Unique ¶
func (p *TrackedProcess) Unique() string
type Tracker ¶
type Tracker interface {
Start(events chan<- ServiceEvent) error
Stop()
}
type WatchConfiguration ¶ added in v0.0.26
func NewWatchConfiguration ¶ added in v0.0.26
func NewWatchConfiguration(includes []string, excludes ...string) *WatchConfiguration
Click to show internal directories.
Click to hide internal directories.