2016-07-04 10:40:29 +00:00
|
|
|
syntax = "proto3";
|
|
|
|
|
|
|
|
package protocol;
|
|
|
|
|
|
|
|
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
|
|
|
|
|
|
|
option (gogoproto.goproto_getters_all) = false;
|
|
|
|
option (gogoproto.sizer_all) = false;
|
|
|
|
option (gogoproto.protosizer_all) = true;
|
|
|
|
option (gogoproto.goproto_enum_stringer_all) = true;
|
|
|
|
option (gogoproto.goproto_enum_prefix_all) = false;
|
|
|
|
|
|
|
|
// --- Pre-auth ---
|
|
|
|
|
|
|
|
message Hello {
|
|
|
|
string device_name = 1;
|
|
|
|
string client_name = 2;
|
|
|
|
string client_version = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
// --- Header ---
|
|
|
|
|
|
|
|
message Header {
|
|
|
|
MessageType type = 1;
|
|
|
|
MessageCompression compression = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
enum MessageType {
|
|
|
|
CLUSTER_CONFIG = 0 [(gogoproto.enumvalue_customname) = "messageTypeClusterConfig"];
|
|
|
|
INDEX = 1 [(gogoproto.enumvalue_customname) = "messageTypeIndex"];
|
|
|
|
INDEX_UPDATE = 2 [(gogoproto.enumvalue_customname) = "messageTypeIndexUpdate"];
|
|
|
|
REQUEST = 3 [(gogoproto.enumvalue_customname) = "messageTypeRequest"];
|
|
|
|
RESPONSE = 4 [(gogoproto.enumvalue_customname) = "messageTypeResponse"];
|
|
|
|
DOWNLOAD_PROGRESS = 5 [(gogoproto.enumvalue_customname) = "messageTypeDownloadProgress"];
|
|
|
|
PING = 6 [(gogoproto.enumvalue_customname) = "messageTypePing"];
|
|
|
|
CLOSE = 7 [(gogoproto.enumvalue_customname) = "messageTypeClose"];
|
|
|
|
}
|
|
|
|
|
|
|
|
enum MessageCompression {
|
|
|
|
NONE = 0 [(gogoproto.enumvalue_customname) = "MessageCompressionNone"];
|
|
|
|
LZ4 = 1 [(gogoproto.enumvalue_customname) = "MessageCompressionLZ4"];
|
|
|
|
}
|
|
|
|
|
|
|
|
// --- Actual messages ---
|
|
|
|
|
|
|
|
// Cluster Config
|
|
|
|
|
|
|
|
message ClusterConfig {
|
|
|
|
repeated Folder folders = 1 [(gogoproto.nullable) = false];
|
|
|
|
}
|
|
|
|
|
|
|
|
message Folder {
|
|
|
|
string id = 1 [(gogoproto.customname) = "ID"];
|
|
|
|
string label = 2;
|
|
|
|
bool read_only = 3;
|
|
|
|
bool ignore_permissions = 4;
|
|
|
|
bool ignore_delete = 5;
|
|
|
|
bool disable_temp_indexes = 6;
|
2016-12-21 18:41:25 +00:00
|
|
|
bool paused = 7;
|
2016-07-04 10:40:29 +00:00
|
|
|
|
|
|
|
repeated Device devices = 16 [(gogoproto.nullable) = false];
|
|
|
|
}
|
|
|
|
|
|
|
|
message Device {
|
2016-11-07 16:40:48 +00:00
|
|
|
bytes id = 1 [(gogoproto.customname) = "ID", (gogoproto.customtype) = "DeviceID", (gogoproto.nullable) = false];
|
|
|
|
string name = 2;
|
|
|
|
repeated string addresses = 3;
|
|
|
|
Compression compression = 4;
|
|
|
|
string cert_name = 5;
|
|
|
|
int64 max_sequence = 6;
|
|
|
|
bool introducer = 7;
|
|
|
|
uint64 index_id = 8 [(gogoproto.customname) = "IndexID", (gogoproto.customtype) = "IndexID", (gogoproto.nullable) = false];
|
|
|
|
bool skip_introduction_removals = 9;
|
2016-07-04 10:40:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
enum Compression {
|
|
|
|
METADATA = 0 [(gogoproto.enumvalue_customname) = "CompressMetadata"];
|
|
|
|
NEVER = 1 [(gogoproto.enumvalue_customname) = "CompressNever"];
|
|
|
|
ALWAYS = 2 [(gogoproto.enumvalue_customname) = "CompressAlways"];
|
|
|
|
}
|
|
|
|
|
|
|
|
// Index and Index Update
|
|
|
|
|
|
|
|
message Index {
|
|
|
|
string folder = 1;
|
|
|
|
repeated FileInfo files = 2 [(gogoproto.nullable) = false];
|
|
|
|
}
|
|
|
|
|
|
|
|
message IndexUpdate {
|
|
|
|
string folder = 1;
|
|
|
|
repeated FileInfo files = 2 [(gogoproto.nullable) = false];
|
|
|
|
}
|
|
|
|
|
|
|
|
message FileInfo {
|
|
|
|
option (gogoproto.goproto_stringer) = false;
|
|
|
|
string name = 1;
|
|
|
|
FileInfoType type = 2;
|
|
|
|
int64 size = 3;
|
|
|
|
uint32 permissions = 4;
|
2016-08-06 13:05:59 +00:00
|
|
|
int64 modified_s = 5;
|
|
|
|
int32 modified_ns = 11;
|
2016-12-21 16:35:20 +00:00
|
|
|
uint64 modified_by = 12 [(gogoproto.customtype) = "ShortID", (gogoproto.nullable) = false];
|
2016-07-04 10:40:29 +00:00
|
|
|
bool deleted = 6;
|
|
|
|
bool invalid = 7;
|
|
|
|
bool no_permissions = 8;
|
|
|
|
Vector version = 9 [(gogoproto.nullable) = false];
|
2016-07-29 19:54:24 +00:00
|
|
|
int64 sequence = 10;
|
2016-07-04 10:40:29 +00:00
|
|
|
|
2016-12-09 18:02:18 +00:00
|
|
|
repeated BlockInfo Blocks = 16 [(gogoproto.nullable) = false];
|
|
|
|
string symlink_target = 17;
|
2016-07-04 10:40:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
enum FileInfoType {
|
|
|
|
FILE = 0 [(gogoproto.enumvalue_customname) = "FileInfoTypeFile"];
|
|
|
|
DIRECTORY = 1 [(gogoproto.enumvalue_customname) = "FileInfoTypeDirectory"];
|
2017-02-07 08:34:24 +00:00
|
|
|
SYMLINK_FILE = 2 [(gogoproto.enumvalue_customname) = "FileInfoTypeDeprecatedSymlinkFile", deprecated = true];
|
|
|
|
SYMLINK_DIRECTORY = 3 [(gogoproto.enumvalue_customname) = "FileInfoTypeDeprecatedSymlinkDirectory", deprecated = true];
|
|
|
|
SYMLINK = 4 [(gogoproto.enumvalue_customname) = "FileInfoTypeSymlink"];
|
2016-07-04 10:40:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message BlockInfo {
|
|
|
|
option (gogoproto.goproto_stringer) = false;
|
2016-12-14 23:30:29 +00:00
|
|
|
int64 offset = 1;
|
|
|
|
int32 size = 2;
|
|
|
|
bytes hash = 3;
|
|
|
|
uint32 weak_hash = 4;
|
2016-07-04 10:40:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message Vector {
|
|
|
|
repeated Counter counters = 1 [(gogoproto.nullable) = false];
|
|
|
|
}
|
|
|
|
|
|
|
|
message Counter {
|
|
|
|
uint64 id = 1 [(gogoproto.customname) = "ID", (gogoproto.customtype) = "ShortID", (gogoproto.nullable) = false];
|
|
|
|
uint64 value = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Request
|
|
|
|
|
|
|
|
message Request {
|
|
|
|
int32 id = 1 [(gogoproto.customname) = "ID"];
|
|
|
|
string folder = 2;
|
|
|
|
string name = 3;
|
|
|
|
int64 offset = 4;
|
|
|
|
int32 size = 5;
|
|
|
|
bytes hash = 6;
|
|
|
|
bool from_temporary = 7;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Response
|
|
|
|
|
|
|
|
message Response {
|
|
|
|
int32 id = 1 [(gogoproto.customname) = "ID"];
|
|
|
|
bytes data = 2;
|
|
|
|
ErrorCode code = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
enum ErrorCode {
|
|
|
|
NO_ERROR = 0 [(gogoproto.enumvalue_customname) = "ErrorCodeNoError"];
|
|
|
|
GENERIC = 1 [(gogoproto.enumvalue_customname) = "ErrorCodeGeneric"];
|
|
|
|
NO_SUCH_FILE = 2 [(gogoproto.enumvalue_customname) = "ErrorCodeNoSuchFile"];
|
|
|
|
INVALID_FILE = 3 [(gogoproto.enumvalue_customname) = "ErrorCodeInvalidFile"];
|
|
|
|
}
|
|
|
|
|
|
|
|
// DownloadProgress
|
|
|
|
|
|
|
|
message DownloadProgress {
|
|
|
|
string folder = 1;
|
|
|
|
repeated FileDownloadProgressUpdate updates = 2 [(gogoproto.nullable) = false];
|
|
|
|
}
|
|
|
|
|
|
|
|
message FileDownloadProgressUpdate {
|
|
|
|
FileDownloadProgressUpdateType update_type = 1;
|
|
|
|
string name = 2;
|
|
|
|
Vector version = 3 [(gogoproto.nullable) = false];
|
2017-01-03 00:16:21 +00:00
|
|
|
repeated int32 block_indexes = 4 [packed=false];
|
2016-07-04 10:40:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
enum FileDownloadProgressUpdateType {
|
|
|
|
APPEND = 0 [(gogoproto.enumvalue_customname) = "UpdateTypeAppend"];
|
|
|
|
FORGET = 1 [(gogoproto.enumvalue_customname) = "UpdateTypeForget"];
|
|
|
|
}
|
|
|
|
|
|
|
|
// Ping
|
|
|
|
|
|
|
|
message Ping {
|
|
|
|
}
|
|
|
|
|
|
|
|
// Close
|
|
|
|
|
|
|
|
message Close {
|
|
|
|
string reason = 1;
|
|
|
|
}
|
|
|
|
|