Documentation
¶
Overview ¶
Package sesstype encapsulates representation of session types As opposed to role-based session types, this representation is channel-based. In particular, sending and receiving both keep track of the role and channel involved.
Index ¶
- Constants
- func CountNodes(root Node) int
- func PrintNodeSummary(session *Session)
- func SessionCountNodes(session *Session) map[string]int
- func StringRecursive(node Node) string
- type CFSMs
- type Chan
- type EmptyBodyNode
- type EndNode
- type GotoNode
- type GraphvizDot
- type LabelNode
- type NewChanNode
- type Node
- func NewEndNode(ch Chan) Node
- func NewGotoNode(name string) Node
- func NewLabelNode(name string) Node
- func NewNewChanNode(ch Chan) Node
- func NewRecvNode(orig Chan, rcvr Role, typ types.Type) Node
- func NewRecvStopNode(orig Chan, rcvr Role, typ types.Type) Node
- func NewSelectRecvNode(orig Chan, rcvr Role, typ types.Type) Node
- func NewSelectSendNode(sndr Role, dest Chan, typ types.Type) Node
- func NewSendNode(sndr Role, dest Chan, typ types.Type) Node
- type NodeStack
- type RecvNode
- func (r *RecvNode) Append(node Node) Node
- func (r *RecvNode) Child(index int) Node
- func (r *RecvNode) Children() []Node
- func (r *RecvNode) From() Chan
- func (r *RecvNode) IsNondet() bool
- func (r *RecvNode) Kind() op
- func (r *RecvNode) Receiver() Role
- func (r *RecvNode) Stop() bool
- func (r *RecvNode) String() string
- type Role
- type SendNode
- type Session
Constants ¶
const ( NoOp op = iota NewChanOp SendOp RecvOp EndOp )
Different operations/actions available in session.
const STOP = "STOP"
STOP is the 'close' message.
Variables ¶
This section is empty.
Functions ¶
func CountNodes ¶
func PrintNodeSummary ¶
func PrintNodeSummary(session *Session)
func SessionCountNodes ¶
func StringRecursive ¶
Types ¶
type CFSMs ¶
type CFSMs struct { Sys *cfsm.System Chans map[Role]*cfsm.CFSM Roles map[Role]*cfsm.CFSM States map[*cfsm.CFSM]map[string]*cfsm.State }
CFSMs captures a CFSM system syserated from a Session.
func (*CFSMs) PrintSummary ¶
func (sys *CFSMs) PrintSummary()
PrintSummary shows the statistics of the CFSM syseration.
type Chan ¶
type Chan struct {
// contains filtered or unexported fields
}
Chan is a typed channel in a session.
type EmptyBodyNode ¶
type EmptyBodyNode struct {
// contains filtered or unexported fields
}
func (*EmptyBodyNode) Append ¶
func (e *EmptyBodyNode) Append(node Node) Node
func (*EmptyBodyNode) Child ¶
func (e *EmptyBodyNode) Child(i int) Node
func (*EmptyBodyNode) Children ¶
func (e *EmptyBodyNode) Children() []Node
func (*EmptyBodyNode) Kind ¶
func (e *EmptyBodyNode) Kind() op
func (*EmptyBodyNode) String ¶
func (e *EmptyBodyNode) String() string
type GotoNode ¶
type GotoNode struct {
// contains filtered or unexported fields
}
GotoNode represents a jump (edge to existing LabelNode)
type GraphvizDot ¶
type GraphvizDot struct { Graph *gographviz.Escape Count int LabelNodes map[string]string }
GraphvizDot reprents a new graphviz dot graph.
func NewGraphvizDot ¶
func NewGraphvizDot(s *Session) *GraphvizDot
NewGraphvizDot creates a new graphviz dot graph from a session.
type LabelNode ¶
type LabelNode struct {
// contains filtered or unexported fields
}
LabelNode makes a placeholder for loop/jumping
type NewChanNode ¶
type NewChanNode struct {
// contains filtered or unexported fields
}
NewChanNode represents creation of new channel
func (*NewChanNode) Append ¶
func (nc *NewChanNode) Append(n Node) Node
func (*NewChanNode) Chan ¶
func (nc *NewChanNode) Chan() Chan
func (*NewChanNode) Child ¶
func (nc *NewChanNode) Child(i int) Node
func (*NewChanNode) Children ¶
func (nc *NewChanNode) Children() []Node
func (*NewChanNode) Kind ¶
func (nc *NewChanNode) Kind() op
func (*NewChanNode) String ¶
func (nc *NewChanNode) String() string
type Node ¶
type Node interface { Kind() op // For checking type without type switching Child(index int) Node // Gets child at index Append(child Node) Node // Returns new child for chaining Children() []Node // Returns whole slice String() string }
A Node in the session graph.
func NewRecvNode ¶
NewRecvNode makes a RecvNode.
func NewRecvStopNode ¶
NewRecvStopNode makes a RecvNode (for STOP messages).
func NewSelectRecvNode ¶
NewSelectRecvNode makes a RecvNode in a select (non-deterministic).
func NewSelectSendNode ¶
NewSelectSendNode makes a SendNode in a select (non-deterministic).
type NodeStack ¶
type NodeStack struct {
// contains filtered or unexported fields
}
NodeStack is a stack for sesstype.Node
type RecvNode ¶
type RecvNode struct {
// contains filtered or unexported fields
}
RecvNode represents a receive.
type SendNode ¶
type SendNode struct {
// contains filtered or unexported fields
}
SendNode represents a send.
type Session ¶
type Session struct { Types map[Role]Node // Root Node for each Role Chans map[*utils.Definition]Chan // Actual channels are stored here Roles map[string]Role // Actual roles are stored here }
Session is a container of session graph nodes, also holds information about channels and roles in the current session.
func (*Session) MakeChan ¶
func (s *Session) MakeChan(v *utils.Definition, r Role) Chan
MakeChan creates and stores a new session channel created.
func (*Session) MakeExtChan ¶
func (s *Session) MakeExtChan(v *utils.Definition, r Role) Chan
MakeExtChan creates and stores a new channel and mark as externally created.