message.proto 1.45 KB
Newer Older
Steven Allen's avatar
Steven Allen committed
1 2
syntax = "proto3";

3
package bitswap.message.pb;
4

Steven Allen's avatar
Steven Allen committed
5 6
import "github.com/gogo/protobuf/gogoproto/gogo.proto";

7
message Message {
Jeromy's avatar
Jeromy committed
8 9

  message Wantlist {
dirkmc's avatar
dirkmc committed
10 11 12 13
    enum WantType {
      Block = 0;
      Have = 1;
    }
Jeromy's avatar
Jeromy committed
14 15

    message Entry {
Steven Allen's avatar
Steven Allen committed
16
			bytes block = 1 [(gogoproto.customtype) = "Cid", (gogoproto.nullable) = false];		// the block cid (cidV0 in bitswap 1.0.0, cidV1 in bitswap 1.1.0)
Steven Allen's avatar
Steven Allen committed
17 18
			int32 priority = 2;	// the priority (normalized). default to 1
			bool cancel = 3;		// whether this revokes an entry
dirkmc's avatar
dirkmc committed
19 20
      WantType wantType = 4; // Note: defaults to enum 0, ie Block
      bool sendDontHave = 5; // Note: defaults to false
Steven Allen's avatar
Steven Allen committed
21
		}
Jeromy's avatar
Jeromy committed
22

Steven Allen's avatar
Steven Allen committed
23
    repeated Entry entries = 1 [(gogoproto.nullable) = false];	// a list of wantlist entries
Steven Allen's avatar
Steven Allen committed
24
    bool full = 2;							// whether this is the full wantlist. default to false
Jeromy's avatar
Jeromy committed
25 26
  }

27
  message Block {
Steven Allen's avatar
Steven Allen committed
28 29
    bytes prefix = 1;		// CID prefix (cid version, multicodec and multihash prefix (type + length)
    bytes data = 2;
30 31
  }

dirkmc's avatar
dirkmc committed
32 33 34 35 36
  enum BlockPresenceType {
    Have = 0;
    DontHave = 1;
  }
  message BlockPresence {
Steven Allen's avatar
Steven Allen committed
37
    bytes cid = 1 [(gogoproto.customtype) = "Cid", (gogoproto.nullable) = false];
dirkmc's avatar
dirkmc committed
38 39 40
    BlockPresenceType type = 2;
  }

Steven Allen's avatar
Steven Allen committed
41
  Wantlist wantlist = 1 [(gogoproto.nullable) = false];
David Dias's avatar
David Dias committed
42
  repeated bytes blocks = 2;		// used to send Blocks in bitswap 1.0.0
Steven Allen's avatar
Steven Allen committed
43
  repeated Block payload = 3 [(gogoproto.nullable) = false];		// used to send Blocks in bitswap 1.1.0
dirkmc's avatar
dirkmc committed
44 45
  repeated BlockPresence blockPresences = 4 [(gogoproto.nullable) = false];
  int32 pendingBytes = 5;
46
}