docs(bitswap/message) BitSwapMessage interface
Brian Tiger Chow committed
Oct 27, 2014 at 22:39 UTC
42dfc502500fe2af67c0cf22eee3d7b02d0a93d4
1 file changed
+17
-2
exchange/bitswap/message/message.go
+17
-2
@@ -14,10 +14,25 @@ import (
14
// TODO move bs/msg/internal/pb to bs/internal/pb and rename pb package to bitswap_pb
15
16
type BitSwapMessage interface {
17
+ // Wantlist returns a slice of unique keys that represent data wanted by
18
+ // the sender.
19
Wantlist() []u.Key
20
+
21
+ // Blocks returns a slice of unique blocks
22
Blocks() []blocks.Block
19
- AddWanted(k u.Key)
20
- AddBlock(b blocks.Block)
23
+
24
+ // AddWanted adds the key to the Wantlist.
25
+ //
26
+ // Insertion order determines priority. That is, earlier insertions are
27
+ // deemed higher priority than keys inserted later.
28
+ //
29
+ // t = 0, msg.AddWanted(A)
30
+ // t = 1, msg.AddWanted(B)
31
+ //
32
+ // implies Priority(A) > Priority(B)
33
+ AddWanted(u.Key)
34
+
35
+ AddBlock(blocks.Block)
36
Exportable
37
}
38