Documentation
¶
Overview ¶
Package application is the handwritten Go contract for proto/cloudpath/v1/application.proto (Application Protocol v1).
ApplicationEffect is deliberately a closed set: upsert/delete domain records, request commands, schedule/cancel tasks and send notifications. It cannot carry arbitrary SQL, shell commands, file operations or global credential requests. Plugin HTTP requests get tenant/actor/instance/scope context injected by Core and are scoped to /api/plugins/{plugin_id}/instances/{instance_id}/....
Index ¶
- Constants
- func NewRPCServer(tr transport.Transport, impl ApplicationServer) *rpc.Server
- type ApplicationClient
- type ApplicationDescriptor
- type ApplicationEffect
- type ApplicationEffectUnion
- type ApplicationEffectWriter
- type ApplicationEvent
- type ApplicationEventReader
- type ApplicationEventStream
- type ApplicationEventUnion
- type ApplicationServer
- type Binding
- type BindingIssue
- type CancelScheduledTask
- type CapabilityEvent
- type CommandState
- type ConfigureInstanceRequest
- type ConfigureInstanceResponse
- type DeleteDomainRecord
- type DescribeRequest
- type HealthRequest
- type HealthResponse
- type HealthState
- type InitializeRequest
- type InitializeResponse
- type InstanceHealth
- type InstanceLifecycle
- type JobDescriptor
- type PluginHTTPRequest
- type PluginHTTPResponse
- type RequestCommand
- type RequestCompleted
- type RequestContext
- type RequirementDescriptor
- type RunJobRequest
- type RunJobResponse
- type ScheduleTask
- type ScheduleTick
- type SendNotification
- type ShutdownRequest
- type ShutdownResponse
- type Status
- type UpsertDomainRecord
- type ValidateBindingRequest
- type ValidateBindingResponse
Constants ¶
const ( MethodInitialize = "cloudpath.v1.application.ApplicationService/Initialize" MethodDescribe = "cloudpath.v1.application.ApplicationService/Describe" MethodConfigureInstance = "cloudpath.v1.application.ApplicationService/ConfigureInstance" MethodValidateBinding = "cloudpath.v1.application.ApplicationService/ValidateBinding" MethodHandleEvents = "cloudpath.v1.application.ApplicationService/HandleEvents" MethodHandleRequest = "cloudpath.v1.application.ApplicationService/HandleRequest" MethodRunJob = "cloudpath.v1.application.ApplicationService/RunJob" MethodHealth = "cloudpath.v1.application.ApplicationService/Health" MethodShutdown = "cloudpath.v1.application.ApplicationService/Shutdown" )
Service method names carried on the wire.
const ProtocolVersion uint32 = 1
ProtocolVersion is the single application protocol version implemented here.
const SchemaVersion = "1"
SchemaVersion is the data semantic version stamped on event/effect messages.
Variables ¶
This section is empty.
Functions ¶
func NewRPCServer ¶
func NewRPCServer(tr transport.Transport, impl ApplicationServer) *rpc.Server
NewRPCServer binds impl to a transport and returns the dispatcher.
Types ¶
type ApplicationClient ¶
type ApplicationClient interface {
Initialize(ctx context.Context, req *InitializeRequest) (*InitializeResponse, error)
Describe(ctx context.Context) (*ApplicationDescriptor, error)
ConfigureInstance(ctx context.Context, req *ConfigureInstanceRequest) (*ConfigureInstanceResponse, error)
ValidateBinding(ctx context.Context, req *ValidateBindingRequest) (*ValidateBindingResponse, error)
HandleEvents(ctx context.Context) (ApplicationEventStream, error)
HandleRequest(ctx context.Context, req *PluginHTTPRequest) (*PluginHTTPResponse, error)
RunJob(ctx context.Context, req *RunJobRequest) (*RunJobResponse, error)
Health(ctx context.Context) (*HealthResponse, error)
Shutdown(ctx context.Context, req *ShutdownRequest) (*ShutdownResponse, error)
}
ApplicationClient is the Core-side view of ApplicationService.
func NewClient ¶
func NewClient(tr transport.Transport) ApplicationClient
NewClient wraps a transport as an ApplicationClient.
type ApplicationDescriptor ¶
type ApplicationDescriptor struct {
ApplicationID string `json:"application_id"`
Version string `json:"version"`
SchemaVersions []string `json:"schema_versions"`
Requirements []RequirementDescriptor `json:"requirements"`
Jobs []JobDescriptor `json:"jobs"`
DeclarativeOnly bool `json:"declarative_only"`
}
type ApplicationEffect ¶
type ApplicationEffect struct {
PluginInstanceID string `json:"plugin_instance_id"`
Sequence uint64 `json:"sequence"`
SchemaVersion string `json:"schema_version"`
Union ApplicationEffectUnion `json:"-"`
}
func (*ApplicationEffect) MarshalJSON ¶
func (e *ApplicationEffect) MarshalJSON() ([]byte, error)
MarshalJSON implements the ApplicationEffect oneof.
func (*ApplicationEffect) UnmarshalJSON ¶
func (e *ApplicationEffect) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the ApplicationEffect oneof.
type ApplicationEffectUnion ¶
type ApplicationEffectUnion interface {
// contains filtered or unexported methods
}
type ApplicationEffectWriter ¶
type ApplicationEffectWriter interface {
Send(ctx context.Context, effect *ApplicationEffect) error
}
ApplicationEffectWriter lets a plugin emit effects.
type ApplicationEvent ¶
type ApplicationEvent struct {
PluginInstanceID string `json:"plugin_instance_id"`
Sequence uint64 `json:"sequence"`
SchemaVersion string `json:"schema_version"`
Union ApplicationEventUnion `json:"-"`
}
func (*ApplicationEvent) MarshalJSON ¶
func (e *ApplicationEvent) MarshalJSON() ([]byte, error)
MarshalJSON implements the ApplicationEvent oneof.
func (*ApplicationEvent) UnmarshalJSON ¶
func (e *ApplicationEvent) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the ApplicationEvent oneof.
type ApplicationEventReader ¶
type ApplicationEventReader interface {
Recv(ctx context.Context) (*ApplicationEvent, error)
}
ApplicationEventReader feeds events to a plugin handler.
type ApplicationEventStream ¶
type ApplicationEventStream interface {
Send(ctx context.Context, event *ApplicationEvent) error
CloseSend(ctx context.Context) error
Recv(ctx context.Context) (*ApplicationEffect, error)
Cancel(ctx context.Context) error
}
ApplicationEventStream is the client view of the HandleEvents bidi stream: Core sends events and receives effects.
type ApplicationEventUnion ¶
type ApplicationEventUnion interface {
// contains filtered or unexported methods
}
type ApplicationServer ¶
type ApplicationServer interface {
Initialize(ctx context.Context, req *InitializeRequest) (*InitializeResponse, error)
Describe(ctx context.Context) (*ApplicationDescriptor, error)
ConfigureInstance(ctx context.Context, req *ConfigureInstanceRequest) (*ConfigureInstanceResponse, error)
ValidateBinding(ctx context.Context, req *ValidateBindingRequest) (*ValidateBindingResponse, error)
HandleEvents(ctx context.Context, events ApplicationEventReader, effects ApplicationEffectWriter) error
HandleRequest(ctx context.Context, req *PluginHTTPRequest) (*PluginHTTPResponse, error)
RunJob(ctx context.Context, req *RunJobRequest) (*RunJobResponse, error)
Health(ctx context.Context) (*HealthResponse, error)
Shutdown(ctx context.Context, req *ShutdownRequest) (*ShutdownResponse, error)
}
ApplicationServer is the plugin-side implementation of ApplicationService.
type BindingIssue ¶
type CancelScheduledTask ¶
type CancelScheduledTask struct {
ScheduleID string `json:"schedule_id"`
}
type CapabilityEvent ¶
type CommandState ¶
type CommandState int32
const ( CommandStateUnspecified CommandState = 0 CommandStateCreated CommandState = 1 CommandStateDispatched CommandState = 2 CommandStateAccepted CommandState = 3 CommandStateRunning CommandState = 4 CommandStateSucceeded CommandState = 5 CommandStateFailed CommandState = 6 CommandStateTimedOut CommandState = 7 CommandStateCancelled CommandState = 8 )
func (CommandState) String ¶
func (s CommandState) String() string
String returns a stable name for the command state.
type DeleteDomainRecord ¶
type DescribeRequest ¶
type DescribeRequest struct{}
type HealthRequest ¶
type HealthRequest struct{}
type HealthResponse ¶
type HealthResponse struct {
State HealthState `json:"state"`
Instances []InstanceHealth `json:"instances"`
}
type HealthState ¶
type HealthState int32
const ( HealthStateUnspecified HealthState = 0 HealthStateServing HealthState = 1 HealthStateNotServing HealthState = 2 )
type InitializeRequest ¶
type InitializeRequest struct {
PluginID string `json:"plugin_id"`
PluginVersion string `json:"plugin_version"`
LaunchID string `json:"launch_id"`
HandshakeCookie string `json:"handshake_cookie"`
ProtocolVersion uint32 `json:"protocol_version"`
SupportedProtocolVersions []uint32 `json:"supported_protocol_versions"`
NodeID string `json:"node_id"`
RuntimeType string `json:"runtime_type"`
HostInfo map[string]string `json:"host_info"`
}
type InitializeResponse ¶
type InstanceHealth ¶
type InstanceHealth struct {
PluginInstanceID string `json:"plugin_instance_id"`
State HealthState `json:"state"`
Detail string `json:"detail"`
}
type InstanceLifecycle ¶
type JobDescriptor ¶
type PluginHTTPRequest ¶
type PluginHTTPResponse ¶
type RequestCommand ¶
type RequestCompleted ¶
type RequestContext ¶
type RequirementDescriptor ¶
type RunJobRequest ¶
type RunJobResponse ¶
type ScheduleTask ¶
type ScheduleTick ¶
type SendNotification ¶
type ShutdownRequest ¶
type ShutdownResponse ¶
type ShutdownResponse struct {
Status *Status `json:"status"`
}
type Status ¶
Status mirrors the inline Status message in application.proto and shares the driver protocol's code table.
type UpsertDomainRecord ¶
type ValidateBindingRequest ¶
type ValidateBindingResponse ¶
type ValidateBindingResponse struct {
Valid bool `json:"valid"`
Issues []BindingIssue `json:"issues"`
}