Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConditionCreate ¶
type ConditionCreate struct {
Exclusive bool `json:"exclusive"`
Parameters json.RawMessage `json:"parameters"`
Fault *ptypes.Fault `json:"fault,omitempty"`
}
ConditionCreate is the request payload to create a condition with its parameters on server.
func (*ConditionCreate) NewCondition ¶
func (c *ConditionCreate) NewCondition(kind ptypes.ConditionKind) *ptypes.Condition
NewCondition returns a new Condition type.
type ConditionUpdate ¶
type ConditionUpdate struct {
ConditionID uuid.UUID `json:"conditionID"`
ServerID uuid.UUID `json:"serverID"`
State ptypes.ConditionState `json:"state,omitempty"`
Status json.RawMessage `json:"status,omitempty"`
ResourceVersion int64 `json:"resourceVersion"`
}
ConditionUpdate is the request payload to update an existing condition.
func (*ConditionUpdate) MergeExisting ¶
func (c *ConditionUpdate) MergeExisting(existing *ptypes.Condition, compareResourceVersion bool) (*ptypes.Condition, error)
MergeExisting when given an existing condition, validates the update based on existing values and returns a condition that can be passed to the repository for update.
The resourceVersion is not updated here and is left for the repository Store to update.
This method makes sure that update does not overwrite existing data inadvertently.
func (*ConditionUpdate) Validate ¶
func (c *ConditionUpdate) Validate() error
type ConditionUpdateEvent ¶
type ConditionUpdateEvent struct {
ConditionUpdate
Kind ptypes.ConditionKind `json:"kind"`
UpdatedAt time.Time `json:"updatedAt"`
registry.ControllerID `json:"controllerID"`
}
ConditionUpdateEvent is the payload received for a condition update over the event stream.
func (*ConditionUpdateEvent) Validate ¶
func (c *ConditionUpdateEvent) Validate() error
Validate checks for required attributes.
Note: The ResourceVersion attribute is not validated for updates through events, this is because the controllers do not perform requests for the existing condition since implementing a Request-Reply pattern on the NATS Jetstream is tideous and not recommended.
The NATS Jetstream guarantees ordered delivery, as long as there is a single consumer of the event, for now we're deploying a single orchestrator instance in each facility and so this check is not required. In the case that we require multiple orchestrators in a facility the stream would need to be partitioned to ensure ordered delivery.
ref: https://github.com/nats-io/nats.py/discussions/221 https://github.com/nats-io/nats.go/discussions/970#discussioncomment-2690789
TODO: move this note into the messaging architecture doc.
type ConditionsResponse ¶
type ConditionsResponse struct {
ServerID uuid.UUID `json:"serverID,omitempty"`
Conditions []*ptypes.Condition `json:"conditions,omitempty"`
}
ConditionsResponse is the response returned for listing multiple conditions on a server.
type ServerResponse ¶
type ServerResponse struct {
StatusCode int `json:"statusCode,omitempty"`
Message string `json:"message,omitempty"`
Records *ConditionsResponse `json:"records,omitempty"`
}