forked from taskgraph/taskgraph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtopology_interface.go
32 lines (27 loc) · 1.24 KB
/
topology_interface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
The topology is a data structure implemented by application, and
used by framework implementation to setup/manage the event according to
a set of topology defined here.
Each Topology describe a specific linkType in overall topology.
After SetTaskID(), GetNeighbors() return the result of this relationship of this taskID
For instance, a topology describe a master link, it will instruct
the framework the master link of node in each epoch.
The main usage is:
a. At beginning of the framework initialization for each task, framework
call the SetTaskID so that the singleton Topology knows which taskID it
represents.
b. At beginning of each epoch, the framework implementation call GetNeighbors
with given epoch, so that it knows how to set watcher for node failure
for specific relationship
*/
package taskgraph
// The Topology will be implemented by the application.
// Each Topology might have many epochs. The topology of each epoch
// might be different.
type Topology interface {
// This method is called once by framework implementation. So that
// we can get the local topology for each epoch later.
SetTaskID(taskID uint64)
// This returns the neighbors of given link for this node at this epoch.
GetNeighbors(epoch uint64) []uint64
}