Documentation ¶
Index ¶
- Constants
- Variables
- func AddPSM(p *PSM) (err error)
- func AddRawPL(addr *endp.Addr, data []byte) (err error)
- func AddRep(p Rep) (err error)
- func Close()
- func Open(filename string) (err error)
- func RmPSM(p *PSM) (err error)
- func RmRawPL(addr *endp.Addr) (err error)
- type CreatorFunc
- type Factor
- type PSM
- func (p *PSM) Accept(state SubState) (yes bool)
- func (p *PSM) Data() []byte
- func (p *PSM) FirstState() *State
- func (p *PSM) IsReady() bool
- func (p *PSM) LastState() *State
- func (p *PSM) Next() string
- func (p *PSM) PendingUserAction() bool
- func (p *PSM) PresentTask() (t comm.Task)
- func (p *PSM) Protocol() string
- func (p *PSM) Timestamp() int64
- type PayloadInfo
- type Rep
- type State
- type StateKey
- type SubState
Constants ¶
const ( BucketPSM byte = 0 + iota BucketRawPL BucketPairwise BucketBasicMessage BucketIssueCred BucketPresentProof )
Variables ¶
var Creator = &Factor{factors: make(map[byte]CreatorFunc)}
Functions ¶
Types ¶
type CreatorFunc ¶ added in v0.25.13
type Factor ¶ added in v0.25.13
type Factor struct {
// contains filtered or unexported fields
}
func (*Factor) Add ¶ added in v0.25.13
func (f *Factor) Add(t byte, factor CreatorFunc)
type PSM ¶
type PSM struct { // Key is the primary key of the protocol state machine: it's pointed by // CA's DID and the current connection ID Key StateKey // StartedByUs tells if Our CA is the one who sent the first protocol msg. // It' false if we are the receving part. Please note that Role is a // protocol specific and not directly correlate with StartedByUs flag. StartedByUs bool // Role is a protocol role in the current DID protocol Role pb.Protocol_Role // ConnID stores connection ID. ConnID string // States has all ouf the state history of this PSM in timestamp order States []State }
PSM is Protocol State Machine that works in event sourcing principle, i.e. every state transition is saved to its State field. Other fields are calculated ASAP and kept that way until to the end.
func FindPSM ¶ added in v0.25.7
FindPSM doesn't return error if the PSM doesn't exist. Instead the returned PSM is nil.
func GetPSM ¶
GetPSM get existing PSM from DB. If the PSM doesn't exist it returns error. See FindPSM for version which doesn't return error if the PSM doesn't exist.
func (*PSM) FirstState ¶
func (*PSM) Next ¶
Next is for getting the upcoming protocol message type. For example, if we are waiting a certain message from other end, we can check the message type with this function.
func (*PSM) PendingUserAction ¶
PendingUserAction returns true if we the PSM is waiting an user action msg.
func (*PSM) PresentTask ¶ added in v0.25.8
PresentTask returns latest state's Task of the PSM.
type PayloadInfo ¶
type PayloadInfo struct {
Type string
}
type State ¶
type State struct { Timestamp int64 T comm.Task PLInfo PayloadInfo Sub SubState }
todo: new idea StateEvent, rename atleast T
type SubState ¶
type SubState uint // TODO: rename State or StateType
SubState is enumeration for the state transitions PSM will have during its execution. The above PUML diagram illustrates what transitions are currently recognized. The Ready state should have 2 internal states: ACK/NACK