all: Use protobuf to generate config structs (fixes #6734) (#6900)

This commit is contained in:
Audrius Butkevicius
2020-08-25 08:11:14 +02:00
committed by GitHub
parent 5b953033c7
commit d507d932b8
84 changed files with 3807 additions and 542 deletions
+14
View File
@@ -0,0 +1,14 @@
syntax = "proto3";
package config;
import "repos/protobuf/gogoproto/gogo.proto";
import "ext.proto";
enum AuthMode {
option (gogoproto.goproto_enum_stringer) = false;
AUTH_MODE_STATIC = 0;
AUTH_MODE_LDAP = 1 [(ext.enumgoname) = "AuthModeLDAP"];
}
+9
View File
@@ -0,0 +1,9 @@
syntax = "proto3";
package config;
enum BlockPullOrder {
BLOCK_PULL_ORDER_STANDARD = 0;
BLOCK_PULL_ORDER_RANDOM = 1;
BLOCK_PULL_ORDER_IN_ORDER = 2;
}
+23
View File
@@ -0,0 +1,23 @@
syntax = "proto3";
package config;
import "lib/config/folderconfiguration.proto";
import "lib/config/deviceconfiguration.proto";
import "lib/config/guiconfiguration.proto";
import "lib/config/ldapconfiguration.proto";
import "lib/config/optionsconfiguration.proto";
import "lib/config/observed.proto";
import "ext.proto";
message Configuration {
int32 version = 1 [(ext.xml) = "version,attr"];
repeated FolderConfiguration folders = 2;
repeated DeviceConfiguration devices = 3;
GUIConfiguration gui = 4 [(ext.goname) = "GUI"];
LDAPConfiguration ldap = 5 [(ext.goname) = "LDAP"];
OptionsConfiguration options = 6;
repeated ObservedDevice ignored_devices = 7 [(ext.json) = "remoteIgnoredDevices", (ext.xml) = "remoteIgnoredDevice"];
repeated ObservedDevice pending_devices = 8;
}
@@ -0,0 +1,27 @@
syntax = "proto3";
package config;
import "lib/protocol/bep.proto";
import "lib/config/observed.proto";
import "ext.proto";
message DeviceConfiguration {
bytes device_id = 1 [(ext.goname) = "DeviceID", (ext.xml) = "id,attr", (ext.json) = "deviceID", (ext.device_id) = true];
string name = 2 [(ext.xml) = "name,attr,omitempty"];
repeated string addresses = 3 [(ext.xml) = "address,omitempty", (ext.default) = "dynamic"];
protocol.Compression compression = 4 [(ext.xml) = "compression,attr"];
string cert_name = 5 [(ext.xml) = "certName,attr,omitempty"];
bool introducer = 6 [(ext.xml) = "introducer,attr"];
bool skip_introduction_removals = 7 [(ext.xml) = "skipIntroductionRemovals,attr"];
bytes introduced_by = 8 [(ext.xml) = "introducedBy,attr", (ext.device_id) = true];
bool paused = 9;
repeated string allowed_networks = 10 [(ext.xml) = "allowedNetwork,omitempty"];
bool auto_accept_folders = 11;
int32 max_send_kbps = 12;
int32 max_recv_kbps = 13;
repeated ObservedFolder ignored_folders = 14;
repeated ObservedFolder pending_folders = 15;
int32 max_request_kib = 16 [(ext.goname) = "MaxRequestKiB", (ext.xml) = "maxRequestKiB", (ext.json) = "maxRequestKiB"];
}
@@ -0,0 +1,61 @@
syntax = "proto3";
package config;
import "lib/config/foldertype.proto";
import "lib/config/size.proto";
import "lib/config/pullorder.proto";
import "lib/config/versioningconfiguration.proto";
import "lib/config/blockpullorder.proto";
import "lib/fs/types.proto";
import "lib/fs/copyrangemethod.proto";
import "ext.proto";
message FolderDeviceConfiguration {
bytes device_id = 1 [(ext.goname) = "DeviceID", (ext.xml) = "id,attr", (ext.json) = "deviceID", (ext.device_id) = true];
bytes introduced_by = 2 [(ext.xml) = "introducedBy,attr", (ext.device_id) = true];
}
message FolderConfiguration {
string id = 1 [(ext.goname) = "ID", (ext.xml) = "id,attr"];
string label = 2 [(ext.xml) = "label,attr", (ext.restart) = false];
fs.FilesystemType filesystem_type = 3;
string path = 4 [(ext.xml) = "path,attr"];
FolderType type = 5 [(ext.xml) = "type,attr"];
repeated FolderDeviceConfiguration devices = 6;
int32 rescan_interval_s = 7 [(ext.xml) = "rescanIntervalS,attr", (ext.default) = "3600"];
bool fs_watcher_enabled = 8 [(ext.goname) = "FSWatcherEnabled", (ext.xml) = "fsWatcherEnabled,attr", (ext.default) = "true"];
int32 fs_watcher_delay_s = 9 [(ext.goname) = "FSWatcherDelayS", (ext.xml) = "fsWatcherDelayS,attr", (ext.default) = "10"];
bool ignore_perms = 10 [(ext.xml) = "ignorePerms,attr"];
bool auto_normalize = 11 [(ext.xml) = "autoNormalize,attr", (ext.default) = "true"];
Size min_disk_free = 12;
VersioningConfiguration versioning = 13;
int32 copiers = 14;
int32 puller_max_pending_kib = 15 [(ext.goname) = "PullerMaxPendingKiB", (ext.xml) = "pullerMaxPendingKiB", (ext.json) = "pullerMaxPendingKiB"];
int32 hashers = 16;
PullOrder order = 17;
bool ignore_delete = 18;
int32 scan_progress_interval_s = 19;
int32 puller_pause_s = 20;
int32 max_conflicts = 21 [(ext.default) = "-1"];
bool disable_sparse_files = 22;
bool disable_temp_indexes = 23;
bool paused = 24;
int32 weak_hash_threshold_pct = 25;
string marker_name = 26;
bool copy_ownership_from_parent = 27;
int32 mod_time_window_s = 28 [(ext.goname) = "RawModTimeWindowS"];
int32 max_concurrent_writes = 29 [(ext.default) = "2"];
bool disable_fsync = 30;
BlockPullOrder block_pull_order = 31;
fs.CopyRangeMethod copy_range_method = 32 [(ext.default) = "standard"];
bool case_sensitive_fs = 33 [(ext.goname) = "CaseSensitiveFS", (ext.xml) = "caseSensitiveFS", (ext.json) = "caseSensitiveFS"];
bool follow_junctions = 34 [(ext.goname) = "JunctionsAsDirs", (ext.xml) = "junctionsAsDirs", (ext.json) = "junctionsAsDirs"];
// Legacy deprecated
bool read_only = 9000 [deprecated=true, (ext.xml) = "ro,attr,omitempty"];
double min_disk_free_pct = 9001 [deprecated=true];
int32 pullers = 9002 [deprecated=true];
}
+9
View File
@@ -0,0 +1,9 @@
syntax = "proto3";
package config;
enum FolderType {
FOLDER_TYPE_SEND_RECEIVE = 0;
FOLDER_TYPE_SEND_ONLY = 1;
FOLDER_TYPE_RECEIVE_ONLY = 2;
}
+23
View File
@@ -0,0 +1,23 @@
syntax = "proto3";
package config;
import "lib/config/authmode.proto";
import "ext.proto";
message GUIConfiguration {
bool enabled = 1 [(ext.xml) = "enabled,attr", (ext.default) = "true"];
string address = 2 [(ext.goname) = "RawAddress", (ext.default) = "127.0.0.1:8384"];
string unix_socket_permissions = 3 [(ext.goname) = "RawUnixSocketPermissions", (ext.xml) = "unixSocketPermissions,omitempty"];
string user = 4 [(ext.xml) = "user,omitempty"];
string password = 5 [(ext.xml) = "password,omitempty"];
AuthMode auth_mode = 6 [(ext.xml) = "authMode,omitempty"];
bool use_tls = 7 [(ext.goname) = "RawUseTLS", (ext.xml) = "tls,attr", (ext.json) = "useTLS"];
string api_key = 8 [(ext.goname) = "APIKey", (ext.xml) = "apikey,omitempty"];
bool insecure_admin_access = 9 [(ext.xml) = "insecureAdminAccess,omitempty"];
string theme = 10 [(ext.default) = "default"];
bool debugging = 11 [(ext.xml) = "debugging,attr"];
bool insecure_skip_host_check = 12 [(ext.xml) = "insecureSkipHostcheck,omitempty", (ext.json) = "insecureSkipHostcheck"];
bool insecure_allow_frame_loading = 13 [(ext.xml) = "insecureAllowFrameLoading,omitempty"];
}
+17
View File
@@ -0,0 +1,17 @@
syntax = "proto3";
package config;
import "lib/config/ldaptransport.proto";
import "ext.proto";
message LDAPConfiguration {
string address = 1 [(ext.xml) = "address,omitempty"];
string bind_dn = 2 [(ext.goname) = "BindDN", (ext.xml) = "bindDN,omitempty", (ext.json) = "bindDN"];
LDAPTransport transport = 3 [(ext.xml) = "transport,omitempty"];
bool insecure_skip_verify = 4 [(ext.xml) = "insecureSkipVerify,omitempty", (ext.default) = "false"];
string search_base_dn = 5 [(ext.goname) = "SearchBaseDN", (ext.xml) = "searchBaseDN,omitempty", (ext.json) = "searchBaseDN"];
string search_filter = 6 [(ext.xml) = "searchFilter,omitempty"];
}
+15
View File
@@ -0,0 +1,15 @@
syntax = "proto3";
package config;
import "repos/protobuf/gogoproto/gogo.proto";
import "ext.proto";
enum LDAPTransport {
option (gogoproto.goproto_enum_stringer) = false;
LDAP_TRANSPORT_PLAIN = 0 [(ext.enumgoname) = "LDAPTransportPlain"];
LDAP_TRANSPORT_TLS = 2 [(ext.enumgoname) = "LDAPTransportTLS"];
LDAP_TRANSPORT_START_TLS = 3 [(ext.enumgoname) = "LDAPTransportStartTLS"];
}
+20
View File
@@ -0,0 +1,20 @@
syntax = "proto3";
package config;
import "google/protobuf/timestamp.proto";
import "ext.proto";
message ObservedFolder {
google.protobuf.Timestamp time = 1 [(ext.xml) = "time,attr"];
string id = 2 [(ext.goname) = "ID", (ext.xml) = "id,attr"];
string label = 3 [(ext.xml) = "label,attr"];
}
message ObservedDevice {
google.protobuf.Timestamp time = 1 [(ext.xml) = "time,attr"];
bytes id = 2 [(ext.goname) = "ID", (ext.json) = "deviceID", (ext.xml) = "id,attr", (ext.device_id) = true];
string name = 3 [(ext.xml) = "name,attr"];
string address = 4 [(ext.xml) = "address,attr"];
}
@@ -0,0 +1,66 @@
syntax = "proto3";
package config;
import "lib/config/tuning.proto";
import "lib/config/size.proto";
import "ext.proto";
message OptionsConfiguration {
repeated string listen_addresses = 1 [(ext.goname) = "RawListenAddresses", (ext.default) = "default"];
repeated string global_discovery_servers = 2 [(ext.goname) = "RawGlobalAnnServers", (ext.xml) = "globalAnnounceServer", (ext.json) = "globalAnnounceServers", (ext.default) = "default"];
bool global_discovery_enabled = 3 [(ext.goname) = "GlobalAnnEnabled", (ext.xml) = "globalAnnounceEnabled", (ext.json) = "globalAnnounceEnabled", (ext.default) = "true"];
bool local_discovery_enabled = 4 [(ext.goname) = "LocalAnnEnabled", (ext.xml) = "localAnnounceEnabled", (ext.json) = "localAnnounceEnabled", (ext.default) = "true"];
int32 local_announce_port = 5 [(ext.goname) = "LocalAnnPort", (ext.xml) = "localAnnouncePort", (ext.json) = "localAnnouncePort", (ext.default) = "21027"];
string local_announce_multicast_address = 6 [(ext.goname) = "LocalAnnMCAddr", (ext.xml) = "localAnnounceMCAddr", (ext.json) = "localAnnounceMCAddr", (ext.default) = "[ff12::8384]:21027"];
int32 max_send_kbps = 7;
int32 max_recv_kbps = 8;
int32 reconnection_interval_s = 9 [(ext.goname) = "ReconnectIntervalS", (ext.default) = "60"];
bool relays_enabled = 10 [(ext.default) = "true"];
int32 relays_reconnect_interval_m = 11 [(ext.goname) = "RelayReconnectIntervalM", (ext.xml) = "relayReconnectIntervalM", (ext.json) = "relayReconnectIntervalM", (ext.default) = "10"];
bool start_browser = 12 [(ext.default) = "true"];
bool nat_traversal_enabled = 14 [(ext.goname) = "NATEnabled", (ext.xml) = "natEnabled", (ext.json) = "natEnabled", (ext.default) = "true"];
int32 nat_traversal_lease_m = 15 [(ext.goname) = "NATLeaseM", (ext.xml) = "natLeaseMinutes", (ext.json) = "natLeaseMinutes", (ext.default) = "60"];
int32 nat_traversal_renewal_m = 16 [(ext.goname) = "NATRenewalM", (ext.xml) = "natRenewalMinutes", (ext.json) = "natRenewalMinutes", (ext.default) = "30"];
int32 nat_traversal_timeout_s = 17 [(ext.goname) = "NATTimeoutS", (ext.xml) = "natTimeoutSeconds", (ext.json) = "natTimeoutSeconds", (ext.default) = "10"];
int32 usage_reporting_accepted = 18 [(ext.goname) = "URAccepted", (ext.xml) = "urAccepted", (ext.json) = "urAccepted"];
int32 usage_reporting_seen = 19 [(ext.goname) = "URSeen", (ext.xml) = "urSeen", (ext.json) = "urSeen"];
string usage_reporting_unique_id = 20 [(ext.goname) = "URUniqueID", (ext.xml) = "urUniqueID", (ext.json) = "urUniqueId"];
string usage_reporting_url = 21 [(ext.goname) = "URURL", (ext.xml) = "urURL", (ext.json) = "urURL", (ext.default) = "https://data.syncthing.net/newdata"];
bool usage_reporting_post_insecurely = 22 [(ext.goname) = "URPostInsecurely", (ext.xml) = "urPostInsecurely", (ext.json) = "urPostInsecurely", (ext.default) = "false"];
int32 usage_reporting_initial_delay_s = 23 [(ext.goname) = "URInitialDelayS", (ext.xml) = "urInitialDelayS", (ext.json) = "urInitialDelayS", (ext.default) = "1800"];
bool restart_on_wakeup = 24 [(ext.default) = "true"];
int32 auto_upgrade_interval_h = 25 [(ext.default) = "12"];
bool upgrade_to_pre_releases = 26;
int32 keep_temporaries_h = 27 [(ext.default) = "24"];
bool cache_ignored_files = 28 [(ext.default) = "false"];
int32 progress_update_interval_s = 29 [(ext.default) = "5"];
bool limit_bandwidth_in_lan = 30 [(ext.default) = "false"];
Size min_home_disk_free = 31 [(ext.default) = "1 %"];
string releases_url = 32 [(ext.goname) = "ReleasesURL", (ext.xml) = "releasesURL", (ext.json) = "releasesURL", (ext.default) = "https://upgrades.syncthing.net/meta.json"];
repeated string always_local_nets = 33;
bool overwrite_remote_device_names_on_connect = 34 [(ext.goname) = "OverwriteRemoteDevNames", (ext.default) = "false"];
int32 temp_index_min_blocks = 35 [(ext.default) = "10"];
repeated string unacked_notification_ids = 36 [(ext.goname) = "UnackedNotificationIDs", (ext.xml) = "unackedNotificationID", (ext.json) = "unackedNotificationIDs"];
int32 traffic_class = 37;
string default_folder_path = 38 [(ext.default) = "~"];
bool set_low_priority = 39 [(ext.default) = "true"];
int32 max_folder_concurrency = 40 [(ext.goname) = "RawMaxFolderConcurrency"];
string crash_reporting_url = 41 [(ext.goname) = "CRURL", (ext.xml) = "crashReportingURL", (ext.json) = "crURL", (ext.default) = "https://crash.syncthing.net/newcrash"];
bool crash_reporting_enabled = 42 [(ext.goname) = "CREnabled", (ext.default) = "true"];
int32 stun_keepalive_start_s = 43 [(ext.default) = "180"];
int32 stun_keepalive_min_s = 44 [(ext.default) = "20"];
repeated string stun_servers = 45 [(ext.goname) = "RawStunServers", (ext.default) = "default"];
Tuning database_tuning = 46 [(ext.restart) = true];
int32 max_concurrent_incoming_request_kib = 47 [(ext.goname) = "RawMaxCIRequestKiB", (ext.xml) = "maxConcurrentIncomingRequestKiB", (ext.json) = "maxConcurrentIncomingRequestKiB"];
// Legacy deprecated
bool upnp_enabled = 9000 [deprecated = true, (ext.goname) = "DeprecatedUPnPEnabled"];
int32 upnp_lease_m = 9001 [deprecated = true, (ext.goname) = "DeprecatedUPnPLeaseM", (ext.xml) = "upnpLeaseMinutes,omitempty"];
int32 upnp_renewal_m = 9002 [deprecated = true, (ext.goname) = "DeprecatedUPnPRenewalM", (ext.xml) = "upnpRenewalMinutes,omitempty"];
int32 upnp_timeout_s = 9003 [deprecated = true, (ext.goname) = "DeprecatedUPnPTimeoutS", (ext.xml) = "upnpTimeoutSeconds,omitempty"];
repeated string relay_servers = 9004 [deprecated = true];
double min_home_disk_free_pct = 9005 [deprecated = true];
int32 max_concurrent_scans = 9006 [deprecated = true];
}
+16
View File
@@ -0,0 +1,16 @@
syntax = "proto3";
package config;
import "repos/protobuf/gogoproto/gogo.proto";
enum PullOrder {
option (gogoproto.goproto_enum_stringer) = false;
PULL_ORDER_RANDOM = 0;
PULL_ORDER_ALPHABETIC = 1;
PULL_ORDER_SMALLEST_FIRST = 2;
PULL_ORDER_LARGEST_FIRST = 3;
PULL_ORDER_OLDEST_FIRST = 4;
PULL_ORDER_NEWEST_FIRST = 5;
}
+14
View File
@@ -0,0 +1,14 @@
syntax = "proto3";
package config;
import "repos/protobuf/gogoproto/gogo.proto";
import "ext.proto";
message Size {
option (gogoproto.goproto_stringer) = false;
double value = 1 [(ext.xml) = ",chardata"];
string unit = 2 [(ext.xml) = "unit,attr"];
}
+13
View File
@@ -0,0 +1,13 @@
syntax = "proto3";
package config;
import "repos/protobuf/gogoproto/gogo.proto";
enum Tuning {
option (gogoproto.goproto_enum_stringer) = false;
TUNING_AUTO = 0;
TUNING_SMALL = 1;
TUNING_LARGE = 2;
}
@@ -0,0 +1,14 @@
syntax = "proto3";
package config;
import "ext.proto";
// VersioningConfiguration is used in the code and for JSON serialization
message VersioningConfiguration {
option (ext.xml_tags) = false;
string type = 1;
map<string, string> parameters = 2 [(ext.goname) = "Params", (ext.json) = "params"];
int32 cleanup_interval_s = 3 [(ext.default) = "3600"];
}
+12
View File
@@ -0,0 +1,12 @@
syntax = "proto3";
package fs;
enum CopyRangeMethod {
COPY_RANGE_METHOD_STANDARD = 0;
COPY_RANGE_METHOD_IOCTL = 1;
COPY_RANGE_METHOD_COPY_FILE_RANGE = 2;
COPY_RANGE_METHOD_SEND_FILE = 3;
COPY_RANGE_METHOD_DUPLICATE_EXTENTS = 4;
COPY_RANGE_METHOD_ALL_WITH_FALLBACK = 5;
}
+8
View File
@@ -0,0 +1,8 @@
syntax = "proto3";
package fs;
enum FilesystemType {
FILESYSTEM_TYPE_BASIC = 0;
FILESYSTEM_TYPE_FAKE = 1;
}
+214
View File
@@ -0,0 +1,214 @@
syntax = "proto3";
package protocol;
import "repos/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;
option (gogoproto.goproto_unkeyed_all) = false;
option (gogoproto.goproto_unrecognized_all) = false;
option (gogoproto.goproto_sizecache_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;
bool paused = 7;
repeated Device devices = 16 [(gogoproto.nullable) = false];
}
message Device {
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;
}
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;
// The field ordering here optimizes for struct size / alignment --
// large types come before smaller ones.
string name = 1;
int64 size = 3;
int64 modified_s = 5;
uint64 modified_by = 12 [(gogoproto.customtype) = "ShortID", (gogoproto.nullable) = false];
Vector version = 9 [(gogoproto.nullable) = false];
int64 sequence = 10;
repeated BlockInfo blocks = 16 [(gogoproto.nullable) = false];
string symlink_target = 17;
bytes blocks_hash = 18;
FileInfoType type = 2;
uint32 permissions = 4;
int32 modified_ns = 11;
int32 block_size = 13 [(gogoproto.customname) = "RawBlockSize"];
// The local_flags fields stores flags that are relevant to the local
// host only. It is not part of the protocol, doesn't get sent or
// received (we make sure to zero it), nonetheless we need it on our
// struct and to be able to serialize it to/from the database.
uint32 local_flags = 1000;
// The version_hash is an implementation detail and not part of the wire
// format.
bytes version_hash = 1001;
bool deleted = 6;
bool invalid = 7 [(gogoproto.customname) = "RawInvalid"];
bool no_permissions = 8;
}
enum FileInfoType {
FILE = 0 [(gogoproto.enumvalue_customname) = "FileInfoTypeFile"];
DIRECTORY = 1 [(gogoproto.enumvalue_customname) = "FileInfoTypeDirectory"];
SYMLINK_FILE = 2 [(gogoproto.enumvalue_customname) = "FileInfoTypeDeprecatedSymlinkFile", deprecated = true];
SYMLINK_DIRECTORY = 3 [(gogoproto.enumvalue_customname) = "FileInfoTypeDeprecatedSymlinkDirectory", deprecated = true];
SYMLINK = 4 [(gogoproto.enumvalue_customname) = "FileInfoTypeSymlink"];
}
message BlockInfo {
option (gogoproto.goproto_stringer) = false;
bytes hash = 3;
int64 offset = 1;
int32 size = 2;
uint32 weak_hash = 4;
}
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;
uint32 weak_hash = 8;
}
// 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];
repeated int32 block_indexes = 4 [packed=false];
int32 block_size = 5;
}
enum FileDownloadProgressUpdateType {
APPEND = 0 [(gogoproto.enumvalue_customname) = "UpdateTypeAppend"];
FORGET = 1 [(gogoproto.enumvalue_customname) = "UpdateTypeForget"];
}
// Ping
message Ping {
}
// Close
message Close {
string reason = 1;
}