Documentation ¶
Index ¶
- Constants
- func AddAndSetFlagUpdatePSM(machineKey psm.StateKey, subState psm.SubState, unsetSubState psm.SubState) (err error)
- func AddContinuator(t string, proc comm.ProtProc)
- func AddCreator(t string, proc comm.ProtProc)
- func AddStarter(t string, proc comm.ProtProc)
- func AddStatusProvider(t string, proc comm.ProtProc)
- func Continue(packet comm.Packet, im didcomm.Msg)
- func ContinuePSM(ts Again) (err error)
- func CreateTask(header *comm.TaskHeader, protocol *pb.Protocol) (t comm.Task, err error)
- func ExecPSM(ts Transition) (err error)
- func FindAndStartTask(receiver comm.Receiver, task comm.Task)
- func GetStatus(protocol string, key *psm.StateKey) interface{}
- func NotifyEdge(ne notifyEdge)
- func Resume(rcvr comm.Receiver, typeID, protocolID string, ack bool)
- func StartPSM(ts Initial) (err error)
- func UpdatePSM(meDID, msgMe string, task comm.Task, opl didcomm.Payload, subs psm.SubState) (err error)
- type Again
- type InOut
- type Initial
- type Setup
- type TaskStatus
- type Transfer
- type Transition
Constants ¶
const StatusReady = "ready"
const StatusWaiting = "waiting"
Variables ¶
This section is empty.
Functions ¶
func AddAndSetFlagUpdatePSM ¶
func AddAndSetFlagUpdatePSM( machineKey psm.StateKey, subState psm.SubState, unsetSubState psm.SubState) (err error)
AddFlagUpdatePSM updates existing PSM by adding a sub-state with state flag:
lastSubState | subState => adding a new sub state flag to last one
and if needed sub-state can be cleared before adding a new one:
lastSubState = lastSubState ^& unsetSubState
func AddContinuator ¶
func AddCreator ¶ added in v0.24.29
AddStarter adds association between CA API message type and protocol. The association is used to start protocol with FindAndStart function.
func AddStarter ¶
func AddStatusProvider ¶
func ContinuePSM ¶
ContinuePSM continues PSM when, usually user, has answered what do with the protocol. According to the Aries protocol spec there are messages that need to be verified by user if they can be continued. With this function user's decision is given to the PSM. The PSM can continue or it can send NACK to other end and terminate. All that's defined in Again struct.
func CreateTask ¶ added in v0.24.29
func ExecPSM ¶
func ExecPSM(ts Transition) (err error)
ExecPSM is a generic protocol handler function for PSM transitions. ts will guide the the execution. Note! that MHandler should return false in all of the NACK cases: when receiving NACK even not responding, and when terminating current PSM with NACK.
func FindAndStartTask ¶
FindAndStartTask start the protocol by using CA API Type in the packet.PL.
func NotifyEdge ¶
func NotifyEdge(ne notifyEdge)
NotifyEdge sends notification to CA's controllores.
func StartPSM ¶
StartPSM starts the protocol state machine according to Initial struct by finally sending the protocol message. During the processing the Initial data, the function calls the Save callback where the caller can perform needed processing.
func UpdatePSM ¶
func UpdatePSM(meDID, msgMe string, task comm.Task, opl didcomm.Payload, subs psm.SubState) (err error)
UpdatePSM adds new sub state to PSM with timestamp and all the working data. The PSM key is meDID (worker agent) and the task.Nonce. The PSM includes all state history.
meDID = handling agent DID i.e. worker agent DID msgMe = our end's connection aka pairwise DID (important!) task = current comm.Task struct for additional protocol information opl = output payload we are building to send, state by state subs = current sub state of the protocol state machine (PSM)
Types ¶
type Again ¶
type Again struct { CA comm.Receiver // the start CA InMsg didcomm.Msg // Client data SendNext string // the type of the PL we will send next if any WaitingNext string // the type of the PL we will wait if any SendOnNACK string // the type to send when we NACK Transfer // input/output protocol msg }
type InOut ¶
type InOut func(connID string, im, om didcomm.MessageHdr) (ack bool, err error)
TransitionHandler is a type for Transition to process PSM state transition. It receivers input msg and produce output msg. Implementor should return false if it wants to NACK otherwise true.
type Initial ¶
type Initial struct { SendNext string // the type of the PL we will send next if any WaitingNext string // the type of the PL we will wait if any Ca comm.Receiver // the start CA T comm.Task // the start TAsk Setup // setup & save the msg data at the PSM start }
Initial is a PSM starting config. It will init PSM accordingly. What msg send next and what message wait for. It has Save handler where PSM persistence can be handled
type TaskStatus ¶
type TaskStatus struct { ID string `json:"id"` Type string `json:"type"` Status string `json:"status"` Name string `json:"name"` TimestampMs uint64 `json:"timestamp"` PendingUserAction bool `json:"pendingUserAction"` Payload interface{} `json:"payload"` }
func StatusForTask ¶
func StatusForTask(workerDID string, taskID string) *TaskStatus
type Transition ¶
type Transition struct { comm.Packet SendNext string // the type of the PL we will send next if any WaitingNext string // the type of the PL we will wait if any SendOnNACK string // the type to send when we NACK InOut // the handler func, NOTE! return false in all NACK cases }
Transition is a Protocol State Machine transition definition. It combines rules to execute state transition i.e. move to next state.