forked from taskgraph/taskgraph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
topology_interface.go
27 lines (24 loc) · 1.08 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
/*
The topology is a data structure implemented by application, and
used by framework implementation to setup/manage the event according to
topology defined here. 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 (on each task)
will call GetLinkTypes and GetNeighbors with given epoch, so that it knows
how to setup watcher for node failures.
*/
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 type of links this topology supports
GetLinkTypes() []string
// This returns the neighbors of given link for this node at this epoch.
GetNeighbors(linkType string, epoch uint64) []uint64
}