Documentation
¶
Index ¶
- func ApplicationID() string
- func Version() string
- type Compartment
- type Config
- type Service
- func (s *Service) ConfigureInstance(_ context.Context, req *application.ConfigureInstanceRequest) (*application.ConfigureInstanceResponse, error)
- func (s *Service) Describe(context.Context) (*application.ApplicationDescriptor, error)
- func (s *Service) HandleEvents(ctx context.Context, events application.ApplicationEventReader, ...) error
- func (s *Service) HandleRequest(_ context.Context, req *application.PluginHTTPRequest) (*application.PluginHTTPResponse, error)
- func (s *Service) Health(context.Context) (*application.HealthResponse, error)
- func (s *Service) Initialize(_ context.Context, req *application.InitializeRequest) (*application.InitializeResponse, error)
- func (s *Service) RunJob(_ context.Context, req *application.RunJobRequest) (*application.RunJobResponse, error)
- func (s *Service) Shutdown(_ context.Context, _ *application.ShutdownRequest) (*application.ShutdownResponse, error)
- func (s *Service) ValidateBinding(_ context.Context, req *application.ValidateBindingRequest) (*application.ValidateBindingResponse, error)
- type WindowSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Compartment ¶
Compartment is one managed compartment. ID is the stable, local key used to bind a schedule window to a compartment entity.
type Config ¶
type Config struct {
Timezone string `json:"timezone"`
Compartments []Compartment `json:"compartments"`
Schedule []WindowSpec `json:"schedule"`
}
Config is the bounded instance configuration for the Scheduled Compartment application. It is intentionally device-agnostic: it carries a timezone, the configured compartments and a list of daily schedule windows. It never references a Driver ID, a port or any vendor-specific field.
func UnmarshalConfig ¶
UnmarshalConfig parses and validates the instance config JSON. Invalid JSON or invalid semantics yield a non-OK status-worthy error.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service implements the ApplicationService protocol for the Scheduled Compartment reference application. It is device-agnostic: it only ever works with the entity ids supplied through capability bindings and never refers to a Driver id, port or vendor field.
func (*Service) ConfigureInstance ¶
func (s *Service) ConfigureInstance(_ context.Context, req *application.ConfigureInstanceRequest) (*application.ConfigureInstanceResponse, error)
ConfigureInstance parses and validates the bounded config for one instance.
func (*Service) Describe ¶
func (s *Service) Describe(context.Context) (*application.ApplicationDescriptor, error)
Describe returns the stable application descriptor. It is the machine source of truth for requirements and jobs and must mirror plugin.yaml.
func (*Service) HandleEvents ¶
func (s *Service) HandleEvents(ctx context.Context, events application.ApplicationEventReader, effects application.ApplicationEffectWriter) error
HandleEvents is the bidi event/effect stream. Core sends events here and the plugin emits Core-approved effects back over the same stream.
func (*Service) HandleRequest ¶
func (s *Service) HandleRequest(_ context.Context, req *application.PluginHTTPRequest) (*application.PluginHTTPResponse, error)
HandleRequest serves the plugin-scoped HTTP subroute. It is read-only and returns a bounded JSON summary of the instance config and window state.
func (*Service) Health ¶
func (s *Service) Health(context.Context) (*application.HealthResponse, error)
Health reports serving state per configured instance.
func (*Service) Initialize ¶
func (s *Service) Initialize(_ context.Context, req *application.InitializeRequest) (*application.InitializeResponse, error)
Initialize negotiates the application protocol version and pins a runtime id.
func (*Service) RunJob ¶
func (s *Service) RunJob(_ context.Context, req *application.RunJobRequest) (*application.RunJobResponse, error)
RunJob executes the window-check job. It scans active windows against the (injectable) clock and emits a missed domain record for any that have expired without completing. RunJob is idempotent per IdempotencyKey.
func (*Service) Shutdown ¶
func (s *Service) Shutdown(_ context.Context, _ *application.ShutdownRequest) (*application.ShutdownResponse, error)
Shutdown marks the service as closed. Subsequent RPCs fail grace-fully.
func (*Service) ValidateBinding ¶
func (s *Service) ValidateBinding(_ context.Context, req *application.ValidateBindingRequest) (*application.ValidateBindingResponse, error)
ValidateBinding checks bindings against the declared requirements and, when valid, stores them for event processing.
type WindowSpec ¶
type WindowSpec struct {
ID string `json:"id"`
Compartment string `json:"compartment"`
Start string `json:"start"`
End string `json:"end"`
}
WindowSpec declares one daily schedule window in the instance timezone. Start and End are "HH:MM" (24-hour) in the configured timezone. End must be strictly after Start (midnight-crossing windows are not supported).
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
cloud-path-app-scheduled-compartment
command
Command cloud-path-app-scheduled-compartment is the executable entrypoint for the Scheduled Compartment reference application.
|
Command cloud-path-app-scheduled-compartment is the executable entrypoint for the Scheduled Compartment reference application. |