Documentation ¶
Index ¶
- 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 ContinuePSM(shift Again) (err error)
- func CreateTask(header *comm.TaskHeader, protocol *pb.Protocol) (t comm.Task, err error)
- func ExecPSM(ts Transition) (err error)
- func FillStatus(protocol string, key psm.StateKey, ps *pb.ProtocolStatus) *pb.ProtocolStatus
- func FindAndStartTask(receiver comm.Receiver, task comm.Task)
- func NotifyEdge(ne notifyEdge)
- func Resume(rcvr comm.Receiver, typeID, protocolID string, ack bool)
- func StartPSM(ts Initial) (err error)
- func UpdatePSM(agentDID, connID string, task comm.Task, opl didcomm.Payload, ...) (err error)
- type Again
- type InOut
- type Initial
- type Setup
- type Transfer
- type Transition
Constants ¶
This section is empty.
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
AddCreator 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 FillStatus ¶ added in v0.25.13
func FillStatus(protocol string, key psm.StateKey, ps *pb.ProtocolStatus) *pb.ProtocolStatus
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( agentDID, connID string, task comm.Task, opl didcomm.Payload, stateType 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 connID = connection ID 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 InOut ¶
type InOut func(connID string, im, om didcomm.MessageHdr) (ack bool, err error)
InOut 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 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 TaskHeader *comm.TaskHeader // updated task data }
Transition is a Protocol State Machine transition definition. It combines rules to execute state transition i.e. move to next state.