research/archive/data_sync/sync.proto

64 lines
1.2 KiB
Protocol Buffer

syntax = "proto3";
package sync;
// Wire format
message Record {
Header header = 1;
// XXX: How listen to thing?
Payload payload = 2;
// four-byte header - fixed-length encoding?
message Header {
// XXX: These fields should be 1, 1, 2 bytes respectively
int32 version = 1;
Type type = 2;
int32 length = 3;
}
enum Type {
// XXX: 0 is default version for enums
ACK = 0;
MESSAGE = 1;
OFFER = 2;
REQUEST = 3;
}
message Payload {
oneof payload {
Ack ack = 1;
Message message = 2;
Offer offer = 3;
Request request = 4;
}
}
// XXX: This only applies for version 1 - how would this extend?
message Ack {
repeated string id = 1;
}
message Message {
string group_id = 1;
int64 timestamp = 2;
bytes body = 3;
}
message Offer {
repeated string id = 1;
}
message Request {
repeated string id = 1;
}
}
// XXX: How do you know who the sender is?
// **2: OFFER** - The payload consists of one or more message identifiers. This record informs the recipient that the sender holds the listed messages, is sharing them with the recipient, and does not know whether the recipient holds them.