-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinterface.go
39 lines (30 loc) · 863 Bytes
/
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
33
34
35
36
37
38
39
package main
type dhtNode interface {
Get(k string) (bool, string)
Put(k string, v string) bool
Del(k string) bool
/* before run(), we have NewNode()
which will init datas*/
// start the service of goroutine
// do fix fingers, check pre or others here
Run()
// create a dht-net with this node as start node
Create()
// join node; tell pre you 2 coming
Join(addr string) bool
// quit node, quit all go-routine services, flush all tables
Quit()
// test ForceQuit method which requires you no backup, no tell with quit
// however, you can stop go-routine if you want
// TA will check this function whether you statisify these conditions.
ForceQuit()
// check existence of node
Ping(addr string) bool
// you can delete this function if you don't want to write.
Dump()
}
type dhtAdditive interface {
dhtNode
AppendTo()
RemoveFrom()
}