Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( KindReqGetter = Kind{"am_req_getter"} KindReqMutation = Kind{"am_req_mutation"} KindReqWaiting = Kind{"am_req_waiting"} KindRespGetter = Kind{"am_resp_getter"} KindRespMutation = Kind{"am_resp_mutation"} KindRespWaiting = Kind{"am_resp_waiting"} KindEnum = enum.New(KindReqGetter, KindReqMutation, KindReqWaiting, KindRespGetter, KindRespMutation, KindRespWaiting) )
Functions ¶
This section is empty.
Types ¶
type GetterReq ¶
type GetterReq struct {
// The kind of the request.
Kind Kind `json:"kind" jsonschema:"required,enum=am_req_getter"`
// Request ticks of the passed states
Time am.S `json:"time,omitempty"`
// Request the sum of ticks of the passed states
TimeSum am.S `json:"time_sum,omitempty"`
// Request named clocks of the passed states
Clocks am.S `json:"clocks,omitempty"`
// Request the tags of the state machine
Tags bool `json:"tags,omitempty"`
// Request an importable version of the state machine
Export bool `json:"export,omitempty"`
// Request the ID of the state machine
Id bool `json:"id,omitempty"`
// Request the ID of the parent state machine
ParentId bool `json:"parent_id,omitempty"`
}
GetterReq is a generic request, which results in GetterResp with respective fields filled out.
type GetterResp ¶
type GetterResp struct {
// The kind of the response.
Kind Kind `json:"kind" jsonschema:"required,enum=am_resp_getter"`
// The ID of the state machine.
MachId string `json:"mach_id,omitempty"`
// The ticks of the passed states
Time am.Time `json:"time,omitempty"`
// The sum of ticks of the passed states
TimeSum int `json:"time_sum,omitempty"`
// The named clocks of the passed states
Clocks am.Clock `json:"clocks,omitempty"`
// The tags of the state machine
Tags []string `json:"tags,omitempty"`
// The importable version of the state machine
Export *am.Serialized `json:"export,omitempty"`
// The ID of the state machine
Id string `json:"id,omitempty"`
// The ID of the parent state machine
ParentId string `json:"parent_id,omitempty"`
}
GetterResp is a response to GetterReq.
func HandlerGetter ¶
type MsgKindReq ¶
type MsgKindReq struct {
// The kind of the request.
Kind Kind `json:"kind" jsonschema:"required,enum=am_req_getter,enum=am_req_mutation,enum=am_req_waiting"`
}
MsgKindReq is a decoding helper.
type MsgKindResp ¶
type MsgKindResp struct {
// The kind of the response.
Kind Kind `json:"kind" jsonschema:"required,enum=am_resp_waiting,enum=am_resp_mutation,enum=am_resp_getter"`
}
MsgKindResp is a decoding helper.
type MutationReq ¶
type MutationReq struct {
// The kind of the request.
Kind Kind `json:"kind" jsonschema:"required,enum=am_req_mutation"`
// The states to add to the state machine.
Add am.S `json:"add,omitempty" jsonschema:"oneof_required=add"`
// The states to remove from the state machine.
Remove am.S `json:"remove,omitempty" jsonschema:"oneof_required=remove"`
// Arguments passed to transition handlers.
Args map[string]any `json:"args,omitempty"`
}
func NewMutationReq ¶
func NewMutationReq() *MutationReq
NewMutationReq creates a new mutation request. TODO sugar for NewAddReq and NewRemoveReq
type MutationResp ¶
type MutationResp struct {
// The kind of the request.
Kind Kind `json:"kind" jsonschema:"required,enum=am_req_mutation"`
// The result of the mutation request.
Result am.Result `json:"result"`
}
func HandlerMutation ¶
func HandlerMutation( ctx context.Context, mach am.Api, req *MutationReq, ) (*MutationResp, error)
type WaitingReq ¶
type WaitingReq struct {
// The kind of the request.
Kind Kind `json:"kind" jsonschema:"required,enum=am_req_waiting"`
// The states to wait for, the default is to all states being active simultaneously (if no time passed).
States am.S `json:"states,omitempty" jsonschema:"oneof_required=states"`
// The states names to wait for to be inactive. Ignores the Time field.
StatesNot am.S `json:"states_not,omitempty" jsonschema:"oneof_required=statesNot"`
// The specific (minimal) time to wait for.
Time am.Time `json:"time,omitempty"`
}
type WaitingResp ¶
type WaitingResp struct {
WaitingRespUnsafe
}
func HandlerWaiting ¶
func HandlerWaiting( ctx context.Context, mach am.Api, req *WaitingReq, ) (*WaitingResp, error)
func (*WaitingResp) UnmarshalJSON ¶
func (w *WaitingResp) UnmarshalJSON(b []byte) error
type WaitingRespUnsafe ¶
type WaitingRespUnsafe struct {
// The kind of the response.
Kind Kind `json:"kind" jsonschema:"required,enum=am_resp_waiting"`
// The ID of the state machine.
MachId string `json:"mach_id"`
// The active states waited for. If time is empty, all these states are active simultaneously.
States am.S `json:"states,omitempty" jsonschema:"oneof_required=states"`
// The inactive states waited for.
StatesNot am.S `json:"states_not,omitempty" jsonschema:"oneof_required=states"`
// The requested machine time (the current one may be higher).
Time am.Time `json:"time,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.