Documentation ¶
Index ¶
- func ContainsEdge(l EdgeList, e Edge) bool
- func ContainsNode(l NodeList, n Node) bool
- type AccessType
- type BasicSignalHandler
- type Branch
- type CDS
- type DGNode
- type Disjoint
- type Edge
- type EdgeList
- type EmptyUI
- func (u *EmptyUI) GetPriority() int
- func (u *EmptyUI) GetSection() Section
- func (u *EmptyUI) GetType() NodeType
- func (u *EmptyUI) ID() int
- func (u *EmptyUI) IsUnique() bool
- func (u *EmptyUI) IsVirtual() bool
- func (u *EmptyUI) ListProcedures() ProcedureList
- func (u *EmptyUI) ListSignalers() SignalingMap
- func (u *EmptyUI) ListSignals() SignalsMap
- func (u *EmptyUI) Signal(s NodeSignal)
- func (u *EmptyUI) UpdateSignaling(sm SignalingMap, s SignalsMap)
- type Graph
- func (g *Graph) AddRealEdge(source int, dest DGNode)
- func (g *Graph) AddRealNode(node DGNode) (DGNode, error)
- func (g *Graph) AddVDG(v *VDG) error
- func (g *Graph) AddVUI(node UI) (DGNode, error)
- func (g *Graph) AllowedProcedure(node DGNode, procedure AccessType) bool
- func (g *Graph) Covered() bool
- func (g *Graph) CycleDetect() bool
- func (g *Graph) Dependencies(n DGNode) []DGNode
- func (g *Graph) Dependents(n DGNode) []DGNode
- func (g *Graph) GenID() int
- func (g *Graph) GetAdjacents(node DGNode) []DGNode
- func (g *Graph) IsLeafBoundary(n DGNode) bool
- func (g *Graph) IsRootBoundary(n DGNode) bool
- func (g *Graph) RemoveVDG(v *VDG)
- func (g *Graph) RemoveVUI(n DGNode) error
- func (g *Graph) SignalsAndSignalers()
- func (g *Graph) TotalBlock(nodeID int, handler BasicSignalHandler) bool
- func (g *Graph) TotalityUnique() bool
- func (g *Graph) Type(n DGNode) NodeType
- type Node
- type NodeList
- type NodeSignal
- type NodeType
- type Partition
- type Poset
- type ProcedureList
- type RestoreEdges
- type RestoreNodes
- type Root
- func (r *Root) GetPriority() int
- func (r *Root) GetSection() Section
- func (r *Root) GetType() NodeType
- func (r *Root) ID() int
- func (r *Root) IsRoot() bool
- func (r *Root) IsUnique() bool
- func (r *Root) IsVirtual() bool
- func (r *Root) ListProcedures() ProcedureList
- func (r *Root) ListSignalers() SignalingMap
- func (r *Root) ListSignals() SignalsMap
- func (r *Root) Signal(s NodeSignal)
- func (r *Root) Start()
- func (r *Root) Started() bool
- func (r *Root) Subspace() UI
- func (r *Root) UpdateSignaling(sm SignalingMap, s SignalsMap)
- type Section
- type Signal
- type SignalingMap
- type SignalsMap
- type Subgraph
- type Subset
- type Temporal
- type UI
- type VDG
- func (g *VDG) AddTopNode(node Virtual) error
- func (g *VDG) AddVirtualEdge(source int, d Virtual) error
- func (g *VDG) AddVirtualNode(node Virtual) (Virtual, error)
- func (g *VDG) CreateSignalers(n Virtual) SignalingMap
- func (g *VDG) CycleDetect() bool
- func (g *VDG) Dependencies(n Virtual) []Virtual
- func (g *VDG) Dependents(n Virtual) []Virtual
- func (g *VDG) GenID() int
- func (g *VDG) RemoveVirtualEdge(source int, d Virtual)
- func (g *VDG) RemoveVirtualNode(n Virtual) error
- func (g *VDG) Signals(n Virtual) SignalsMap
- func (g *VDG) TotalBlock(nodeID int, handler BasicSignalHandler) bool
- type VPoset
- type Virtual
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsEdge ¶
ContainsEdge checks if a CDS edge (reference) is in an Edglist
func ContainsNode ¶
ContainsNode checks if a CDS node (reference) is in a NodeList
Types ¶
type AccessType ¶
type AccessType interface { // Class() string // the "class" of action (e.g. "read") ID() int // integer id assigned to Access Type Priority() int // priorities are not a necessity but can be helpful for ordering algorithms for posets Commit(DGNode) error // takes a DGNode to signal for ... Rollback(RestoreNodes, RestoreEdges) error // takes a list of all CDS nodes and edges that have been operated on }
AccessType is the interface to define how an access procedure should behave; Create an Access Procedure function signature type and add these methods to it. IMPORTANT: In order to best utilize the commit and rollback features the Access Type should have an error return value.
type BasicSignalHandler ¶
type BasicSignalHandler func(<-chan NodeSignal, sync.WaitGroup)
BasicSignalHandler is the basic function type for handling signals from a dependency node Used in total-blocking, to call wg.Done() on certain Signal Values and return. will not allow for more complex signal handling e.g. handling an Abort or AbortRetry with more resilience (use with caution)
type CDS ¶
type CDS interface { GenNodeID() int GenEdgeID() int ListNodes() NodeList // a simple `return MyCDS.Nodes` will suffice here; once a NodeList has been created ListEdges() EdgeList // a simple `return MyCDS.Edges` will suffice here; once an EdgesList has been created }
CDS is the interface definition that must be satisfied for the global shared data structure
type DGNode ¶
type DGNode interface { ID() int // must be unique from all other DGNodes in our graph GetType() NodeType // specifies whether node is UI, VUI, etc. GetPriority() int // not necessary, but can be useful ListProcedures() ProcedureList UpdateSignaling(SignalingMap, SignalsMap) // makes it possible to update the SignalingMap and SignalsMap for a DGNode ListSignalers() SignalingMap ListSignals() SignalsMap Signal(NodeSignal) // used to send the same signal to all dependents in signalers list }
DGNode (Dependency Graph Node) ... every DGNode has an id, a Type, a state, and a set of Access Procedures NOTE: This will require assigning signals to their appropriate nodes
when setting up a dependency graph.
type Disjoint ¶
Disjoint ...
func (*Disjoint) UpdateEdgeList ¶
UpdateEdgeList ...
func (*Disjoint) UpdateNodeList ¶
UpdateNodeList ...
type Edge ¶
type Edge interface { ID() int // returns edge id GetSource() Node GetDestination() Node Immutable() bool }
Edge ...
type EmptyUI ¶
type EmptyUI struct { AccessProcedures *ProcedureList Signalers *SignalingMap Signals *SignalsMap CDS Section }
EmptyUI can be used when a UI is needed codewise, but the CDS system will not be using any spatial virtualization (UI DDAGs).
func (*EmptyUI) ListProcedures ¶
func (u *EmptyUI) ListProcedures() ProcedureList
ListProcedures ...
func (*EmptyUI) UpdateSignaling ¶
func (u *EmptyUI) UpdateSignaling(sm SignalingMap, s SignalsMap)
UpdateSignaling ...
type Graph ¶
Graph can be either UI DDAG, Temporal DAG or VDG
func SingleUIGraph ¶
func (*Graph) AddRealEdge ¶
AddRealEdge will create an edge and an appropriate signaling channel between nodes
func (*Graph) AddRealNode ¶
AddRealNode ... This should only be used for adding nodes to a graph to intialize the graph.
func (*Graph) AllowedProcedure ¶
func (g *Graph) AllowedProcedure(node DGNode, procedure AccessType) bool
AllowedProcedure checks whether or not an access procedure is allowed to act on a node ...
func (*Graph) CycleDetect ¶
CycleDetect will check whether a graph has cycles or not
func (*Graph) GetAdjacents ¶
GetAdjacents will return the list of nodes that a node is connected too
func (*Graph) SignalsAndSignalers ¶
func (g *Graph) SignalsAndSignalers()
SignalsAndSignalers will udpate the SignalingMaps and SignalsMaps for all DGNodes in the graph
func (*Graph) TotalBlock ¶
func (g *Graph) TotalBlock(nodeID int, handler BasicSignalHandler) bool
TotalBlock is the most basic format for signal checking (used when a node wants to simply totally-block all further operations until its dependencies have signaled) as it only accepts a BasicSignalHandler it will not be a very powerful form of blocking (only use if lazy)
func (*Graph) TotalityUnique ¶
TotalityUnique is a Totality-Uniqueness check for the UI nodes of a graph... should only be called once when creating the UI dependency graph; can be called with the creation of each UI if needed for more "real-time" verification.
type NodeSignal ¶
type NodeSignal struct { AccessType int // should be equivalent to the ID() method return value for the Access Type Value Signal Space UI }
NodeSignal carries all the information a dependent node will need in order to know what action a dependent node has just taken.
type NodeType ¶
type NodeType int
NodeType defines the possible values for types of dependency graph nodes
const ( // UINode are the spatial definitions usually assigned to a single thread UINode NodeType = iota // TemporalNode are assigned to threads which address the same UI as the temporals UI dependent TemporalNode // VirtualTemporalNode is a spawned temporary temporal node VirtualTemporalNode // VUINode is a temporary UI node VUINode // VDGNode is a node in a virtual dependency graph VDGNode // Unknown is a catch-all for an improperly constructed dependency graph node Unknown )
type Partition ¶
Partition ...
func (*Partition) UpdateEdgeList ¶
UpdateEdgeList ...
func (*Partition) UpdateNodeList ¶
UpdateNodeList ...
type Poset ¶
type Poset interface { // Graph should return a pointer to the graph that our POSET object is "wrapping" Graph() *Graph // InitGraph should take a list of nodes and order them according to the Order() method and return a new Graph InitGraph([]DGNode) *Graph // Order should be a method that determines what dependents and what // dependencies to assign a node in the wrapped Graph i.e. it determines // what edges to make for the node in the Graph. // Order returns the location of the DGnode inside the Graph Order(DGNode) error }
Poset is an object that wraps a dependency graph
type RestoreEdges ¶
type RestoreEdges []Edge
RestoreEdges is a list of Edge values that can be used to overwrite existing Edge values after an operation failure.
type RestoreNodes ¶
type RestoreNodes []Node
RestoreNodes is a list of Node values that can be used to overwrite existing Node values after an operation failure.
type Root ¶
type Root struct { AccessProcedures *ProcedureList CDS Section Isroot bool IsLeaf bool Signalers *SignalingMap Signals *SignalsMap Executing bool Type NodeType }
Root is the object type for pre-made root nodes Root is also is able to satisfy the UI interface in order to add itself as it's subspace
func (*Root) UpdateSignaling ¶
func (r *Root) UpdateSignaling(sm SignalingMap, s SignalsMap)
UpdateSignaling ...
type Section ¶
type Section interface { ListNodes() *NodeList ListEdges() *EdgeList // NOTE: UpdateNodes and UpdateEdges can be used to add or remove nodes // and edges from the Sections list and provide the section with a new list. UpdateNodeList(*NodeList) UpdateEdgeList(*EdgeList) }
Section is the interface definition for cutting out a section of the global CDS
func ComposeSections ¶
ComposeSections takes a list of CDS graphs (sections) and composes them into a new single disjoint
func NewSubgraph ¶
NewSubgraph will grab all edges from nodes that connect to other nodes that are in our list.
type Signal ¶
type Signal int
Signal defines the possible signal values one dependency graph node can send to another RECOMMENDATION: every thread should have a proper reaction (which may be a non-reaction)
to each signal value for each access procedure in each dependency node.
EXAMPLE: an example reaction to an abort signal could be "Abort Chain/Tree" where the dependents
and their dependents, etc. all abort their operations if a signal value from a dependency node is an 'Abort' signal.
const ( // Waiting can be used for an access procedure that has not begun but is in line too Waiting Signal = iota // Started can be used for an access procedure that is no longer waiting and has begun execution Started // Completed can be used for an access procedure that has finished execution successfully Completed // Aborted can be used for an access procedure that failed to finish execution Aborted // AbortRetry EXAMPLE: could use exponential backoff checks on retries for AbortRetry signals from dependencies ... AbortRetry // PartialAbort can be used to specify if an operation partially-completed before aborting PartialAbort // Help can be used to specify that a helping mechanism should be triggered in the dependent node Help )
type SignalingMap ¶
type SignalingMap map[int]chan NodeSignal
SignalingMap is a map of dependent node ids to a channel of signals
type SignalsMap ¶
type SignalsMap map[int]<-chan NodeSignal
SignalsMap is a map of dependency node ids to recieve-only channel of signals
type Subgraph ¶
Subgraph ...
func (*Subgraph) UpdateEdgeList ¶
UpdateEdgeList ...
func (*Subgraph) UpdateNodeList ¶
UpdateNodeList ...
type Temporal ¶
Temporal is what is assigned to Threads beyond the first thread assigned to a particular UI.
type UI ¶
type UI interface { DGNode GetSection() Section IsUnique() bool // specifies whether a UI is *strictly* unique or not (a UI will always have totality-uniqueness) IsVirtual() bool // specifies whether a UI is virtual or not }
UI ...
func NewTotalUI ¶
type VDG ¶
type VDG struct { Global *Graph // a reference to the real global graph of the system Root Virtual Top map[Virtual][]Virtual Space []int // the set of all (V)UI ids that at least one node in the VDG has access too }
VDG ...
func (*VDG) AddTopNode ¶
AddTopNode will add a node to the VDG and create an edge pointing from the root node to it
func (*VDG) AddVirtualEdge ¶
AddVirtualEdge adds an edge to a VDG
func (*VDG) AddVirtualNode ¶
AddVirtualNode adds a node to a VDG
func (*VDG) CreateSignalers ¶
func (g *VDG) CreateSignalers(n Virtual) SignalingMap
CreateSignalers ...
func (*VDG) CycleDetect ¶
CycleDetect will check whether a graph has cycles or not
func (*VDG) RemoveVirtualEdge ¶
RemoveVirtualEdge removes a single edge from the VDG Useful for when a dependency node is not being removed but the dependent node no longer requires it as a dependency.
func (*VDG) RemoveVirtualNode ¶
RemoveVirtualNode is for removing a single node from a VDG It will also remove all edges that have the node as the destination node of the edge. And it will remove the (V)UI subspace if not required by any other node in the VDG.
func (*VDG) TotalBlock ¶
func (g *VDG) TotalBlock(nodeID int, handler BasicSignalHandler) bool
TotalBlock is the most basic format for signal checking (used when a node wants to simply totally-block all further operations until its dependencies have signaled) as it only accepts a BasicSignalHandler it will not be a very powerful form of blocking (only use if lazy)
type VPoset ¶
type VPoset interface { // VDG should return a pointer to the VDG that our VPOSET object is "wrapping" VDG() *VDG // InitGraph should take a list of nodes and order them according to the Order() method and return a new VDG InitGraph([]Virtual) *VDG // Order should be a method that determines what dependents and what // dependencies to assign a node in the wrapped VDG i.e. it determines // what edges to make for the node in the VDG. // Order returns the location of the Virtual node inside the VDG Order(Virtual) error }
VPoset is an object that wraps a virtual dependency graph
type Virtual ¶
type Virtual interface { DGNode Start() // tells the node to begin execution (usually by flipping a 'Started' boolean -- can also signal to dependents that it has started) Started() bool // specifies whether a node has started execution or not IsRoot() bool // specifies whether VDG node is root node or not Subspace() UI // the (V)UI that the Virtual node is associated to }
Virtual is the interface definition that virtual nodes in a VDG graph need to satsify. NOTE: Virtual Dependency Graph Nodes can only have other
VDG nodes as dependents or dependencies