forked from go-distributed/meritop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
topology_interface.go
32 lines (28 loc) · 1.2 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
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 GetParents and GetChildren with given epoch, so that it knows
how to setup watcher for node failures.
*/
package meritop
// 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)
// GetParents returns the parents' IDs of this task at the
// given epoch.
GetParents(epoch uint64) []uint64
// GetChlidren returns the children's IDs of this task at the
// given epoch.
GetChildren(epoch uint64) []uint64
// Inform the new NumberOfTasks, this allow the number of tasks to change.
SetNumberOfTasks(numOfTasks uint64)
}