102 lines
2.2 KiB
Protocol Buffer
102 lines
2.2 KiB
Protocol Buffer
syntax = "proto3";
|
|
package anytype;
|
|
option go_package = "/syncproto";
|
|
|
|
import "pkg/acl/aclchanges/aclpb/protos/aclchanges.proto";
|
|
import "pkg/acl/treestorage/treepb/protos/tree.proto";
|
|
|
|
message Message {
|
|
Header header = 1;
|
|
bytes data = 2;
|
|
}
|
|
|
|
message Header {
|
|
bytes traceId = 1;
|
|
uint64 requestId = 2;
|
|
uint64 replyId = 3;
|
|
MessageType type = 4;
|
|
}
|
|
|
|
enum MessageType {
|
|
MessageTypeSystem = 0;
|
|
MessageTypeSubscription = 1;
|
|
MessageTypeSync = 2;
|
|
}
|
|
|
|
message System {
|
|
Handshake handshake = 1;
|
|
Ping ping = 2;
|
|
Ack ack = 3;
|
|
|
|
message Handshake {
|
|
string protocolVersion = 1;
|
|
}
|
|
message Ping {
|
|
uint64 unixTime = 1;
|
|
}
|
|
message Ack {
|
|
Error error = 2;
|
|
}
|
|
message Error {
|
|
Code code = 1;
|
|
string description = 2;
|
|
|
|
enum Code {
|
|
UNKNOWN = 0;
|
|
UNSUPPORTED_PROTOCOL_VERSION = 10;
|
|
}
|
|
}
|
|
}
|
|
|
|
message Subscription {
|
|
SubscribeSpace subscribeSpace = 1;
|
|
UnsubscribeSpace unsubscribeSpace = 2;
|
|
|
|
message SubscribeSpace {
|
|
string spaceId = 1;
|
|
}
|
|
message UnsubscribeSpace {
|
|
string spaceId = 1;
|
|
}
|
|
}
|
|
|
|
message Sync {
|
|
string spaceId = 1;
|
|
ContentValue message = 2;
|
|
|
|
message ContentValue {
|
|
oneof value {
|
|
HeadUpdate headUpdate = 1;
|
|
Full.Request fullSyncRequest = 2;
|
|
Full.Response fullSyncResponse = 3;
|
|
}
|
|
}
|
|
|
|
message HeadUpdate {
|
|
repeated string heads = 1;
|
|
repeated acl.RawChange changes = 2;
|
|
string treeId = 3;
|
|
repeated string snapshotPath = 4;
|
|
tree.TreeHeader treeHeader = 5;
|
|
}
|
|
|
|
message Full {
|
|
// here with send the request with all changes we have (we already know sender's snapshot path)
|
|
message Request {
|
|
repeated string heads = 1;
|
|
repeated acl.RawChange changes = 2;
|
|
string treeId = 3;
|
|
repeated string snapshotPath = 4;
|
|
tree.TreeHeader treeHeader = 5;
|
|
}
|
|
|
|
message Response {
|
|
repeated string heads = 1;
|
|
repeated acl.RawChange changes = 2;
|
|
string treeId = 3;
|
|
repeated string snapshotPath = 4;
|
|
tree.TreeHeader treeHeader = 5;
|
|
}
|
|
}
|
|
}
|