From b6ab8e64d4f93372c6da1b532a863f7e7a1991d0 Mon Sep 17 00:00:00 2001 From: Roman Borschel Date: Wed, 22 May 2019 15:47:46 +0200 Subject: [PATCH] Update Kademlia protobuf. (#1138) --- protocols/kad/dht.proto | 34 +- protocols/kad/record.proto | 21 - protocols/kad/regen_dht_proto.sh | 6 +- protocols/kad/src/protobuf_structs/dht.rs | 765 +++++++++++++------ protocols/kad/src/protobuf_structs/mod.rs | 1 - protocols/kad/src/protobuf_structs/record.rs | 453 ----------- 6 files changed, 540 insertions(+), 740 deletions(-) delete mode 100644 protocols/kad/record.proto delete mode 100644 protocols/kad/src/protobuf_structs/record.rs diff --git a/protocols/kad/dht.proto b/protocols/kad/dht.proto index 48640639..79599eac 100644 --- a/protocols/kad/dht.proto +++ b/protocols/kad/dht.proto @@ -1,7 +1,24 @@ -syntax = "proto2"; +syntax = "proto3"; package dht.pb; -import "record.proto"; +// Record represents a dht record that contains a value +// for a key value pair +message Record { + // The key that references this record + bytes key = 1; + + // The actual value this record is storing + bytes value = 2; + + // Note: These fields were removed from the Record message + // hash of the authors public key + //optional string author = 3; + // A PKI signature for the key+value+author + //optional bytes signature = 4; + + // Time the record was received, set by receiver + string timeReceived = 5; +}; message Message { enum MessageType { @@ -30,28 +47,29 @@ message Message { message Peer { // ID of a given peer. - optional bytes id = 1; + bytes id = 1; // multiaddrs for a given peer repeated bytes addrs = 2; // used to signal the sender's connection capabilities to the peer - optional ConnectionType connection = 3; + ConnectionType connection = 3; } // defines what type of message it is. - optional MessageType type = 1; + MessageType type = 1; // defines what coral cluster level this query/response belongs to. - optional int32 clusterLevelRaw = 10; + // in case we want to implement coral's cluster rings in the future. + int32 clusterLevelRaw = 10; // NOT USED // Used to specify the key associated with this message. // PUT_VALUE, GET_VALUE, ADD_PROVIDER, GET_PROVIDERS - optional bytes key = 2; + bytes key = 2; // Used to return a value // PUT_VALUE, GET_VALUE - optional record.pb.Record record = 3; + Record record = 3; // Used to return peers closer to a key in a query // GET_VALUE, GET_PROVIDERS, FIND_NODE diff --git a/protocols/kad/record.proto b/protocols/kad/record.proto deleted file mode 100644 index d31fc914..00000000 --- a/protocols/kad/record.proto +++ /dev/null @@ -1,21 +0,0 @@ -syntax = "proto2"; -package record.pb; - -// Record represents a dht record that contains a value -// for a key value pair -message Record { - // The key that references this record - optional string key = 1; - - // The actual value this record is storing - optional bytes value = 2; - - // hash of the authors public key - optional string author = 3; - - // A PKI signature for the key+value+author - optional bytes signature = 4; - - // Time the record was received, set by receiver - optional string timeReceived = 5; -} diff --git a/protocols/kad/regen_dht_proto.sh b/protocols/kad/regen_dht_proto.sh index 91aba0ca..703ed009 100755 --- a/protocols/kad/regen_dht_proto.sh +++ b/protocols/kad/regen_dht_proto.sh @@ -5,11 +5,9 @@ docker run --rm -v `pwd`:/usr/code:z -w /usr/code rust /bin/bash -c " \ apt-get update; \ apt-get install -y protobuf-compiler; \ - cargo install --version 2.3.0 protobuf-codegen; \ - protoc --rust_out . dht.proto;\ - protoc --rust_out . record.proto" + cargo install --version 2.6.0 protobuf-codegen; \ + protoc --rust_out . dht.proto;" sudo chown $USER:$USER *.rs mv -f dht.rs ./src/protobuf_structs/dht.rs -mv -f record.rs ./src/protobuf_structs/record.rs diff --git a/protocols/kad/src/protobuf_structs/dht.rs b/protocols/kad/src/protobuf_structs/dht.rs index 411304ca..9d829a56 100644 --- a/protocols/kad/src/protobuf_structs/dht.rs +++ b/protocols/kad/src/protobuf_structs/dht.rs @@ -1,9 +1,9 @@ -// This file is generated by rust-protobuf 2.3.0. Do not edit +// This file is generated by rust-protobuf 2.6.0. Do not edit // @generated // https://github.com/Manishearth/rust-clippy/issues/702 #![allow(unknown_lints)] -#![allow(clippy::all)] +#![allow(clippy)] #![cfg_attr(rustfmt, rustfmt_skip)] @@ -22,100 +22,345 @@ use protobuf::Message as Message_imported_for_functions; use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; #[derive(PartialEq,Clone,Default)] -pub struct Message { +pub struct Record { // message fields - field_type: ::std::option::Option, - clusterLevelRaw: ::std::option::Option, - key: ::protobuf::SingularField<::std::vec::Vec>, - record: ::protobuf::SingularPtrField, - closerPeers: ::protobuf::RepeatedField, - providerPeers: ::protobuf::RepeatedField, + pub key: ::std::vec::Vec, + pub value: ::std::vec::Vec, + pub timeReceived: ::std::string::String, // special fields pub unknown_fields: ::protobuf::UnknownFields, pub cached_size: ::protobuf::CachedSize, } +impl<'a> ::std::default::Default for &'a Record { + fn default() -> &'a Record { + ::default_instance() + } +} + +impl Record { + pub fn new() -> Record { + ::std::default::Default::default() + } + + // bytes key = 1; + + + pub fn get_key(&self) -> &[u8] { + &self.key + } + pub fn clear_key(&mut self) { + self.key.clear(); + } + + // Param is passed by value, moved + pub fn set_key(&mut self, v: ::std::vec::Vec) { + self.key = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { + &mut self.key + } + + // Take field + pub fn take_key(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.key, ::std::vec::Vec::new()) + } + + // bytes value = 2; + + + pub fn get_value(&self) -> &[u8] { + &self.value + } + pub fn clear_value(&mut self) { + self.value.clear(); + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: ::std::vec::Vec) { + self.value = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { + &mut self.value + } + + // Take field + pub fn take_value(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.value, ::std::vec::Vec::new()) + } + + // string timeReceived = 5; + + + pub fn get_timeReceived(&self) -> &str { + &self.timeReceived + } + pub fn clear_timeReceived(&mut self) { + self.timeReceived.clear(); + } + + // Param is passed by value, moved + pub fn set_timeReceived(&mut self, v: ::std::string::String) { + self.timeReceived = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_timeReceived(&mut self) -> &mut ::std::string::String { + &mut self.timeReceived + } + + // Take field + pub fn take_timeReceived(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.timeReceived, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for Record { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.key)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.value)?; + }, + 5 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.timeReceived)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.key.is_empty() { + my_size += ::protobuf::rt::bytes_size(1, &self.key); + } + if !self.value.is_empty() { + my_size += ::protobuf::rt::bytes_size(2, &self.value); + } + if !self.timeReceived.is_empty() { + my_size += ::protobuf::rt::string_size(5, &self.timeReceived); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.key.is_empty() { + os.write_bytes(1, &self.key)?; + } + if !self.value.is_empty() { + os.write_bytes(2, &self.value)?; + } + if !self.timeReceived.is_empty() { + os.write_string(5, &self.timeReceived)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Record { + Record::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "key", + |m: &Record| { &m.key }, + |m: &mut Record| { &mut m.key }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "value", + |m: &Record| { &m.value }, + |m: &mut Record| { &mut m.value }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "timeReceived", + |m: &Record| { &m.timeReceived }, + |m: &mut Record| { &mut m.timeReceived }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Record", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Record { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Record, + }; + unsafe { + instance.get(Record::new) + } + } +} + +impl ::protobuf::Clear for Record { + fn clear(&mut self) { + self.key.clear(); + self.value.clear(); + self.timeReceived.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Record { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Record { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Message { + // message fields + pub field_type: Message_MessageType, + pub clusterLevelRaw: i32, + pub key: ::std::vec::Vec, + pub record: ::protobuf::SingularPtrField, + pub closerPeers: ::protobuf::RepeatedField, + pub providerPeers: ::protobuf::RepeatedField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Message { + fn default() -> &'a Message { + ::default_instance() + } +} + impl Message { pub fn new() -> Message { ::std::default::Default::default() } - // optional .dht.pb.Message.MessageType type = 1; + // .dht.pb.Message.MessageType type = 1; - pub fn clear_field_type(&mut self) { - self.field_type = ::std::option::Option::None; + + pub fn get_field_type(&self) -> Message_MessageType { + self.field_type } - - pub fn has_field_type(&self) -> bool { - self.field_type.is_some() + pub fn clear_field_type(&mut self) { + self.field_type = Message_MessageType::PUT_VALUE; } // Param is passed by value, moved pub fn set_field_type(&mut self, v: Message_MessageType) { - self.field_type = ::std::option::Option::Some(v); + self.field_type = v; } - pub fn get_field_type(&self) -> Message_MessageType { - self.field_type.unwrap_or(Message_MessageType::PUT_VALUE) + // int32 clusterLevelRaw = 10; + + + pub fn get_clusterLevelRaw(&self) -> i32 { + self.clusterLevelRaw } - - // optional int32 clusterLevelRaw = 10; - pub fn clear_clusterLevelRaw(&mut self) { - self.clusterLevelRaw = ::std::option::Option::None; - } - - pub fn has_clusterLevelRaw(&self) -> bool { - self.clusterLevelRaw.is_some() + self.clusterLevelRaw = 0; } // Param is passed by value, moved pub fn set_clusterLevelRaw(&mut self, v: i32) { - self.clusterLevelRaw = ::std::option::Option::Some(v); + self.clusterLevelRaw = v; } - pub fn get_clusterLevelRaw(&self) -> i32 { - self.clusterLevelRaw.unwrap_or(0) + // bytes key = 2; + + + pub fn get_key(&self) -> &[u8] { + &self.key } - - // optional bytes key = 2; - pub fn clear_key(&mut self) { self.key.clear(); } - pub fn has_key(&self) -> bool { - self.key.is_some() - } - // Param is passed by value, moved pub fn set_key(&mut self, v: ::std::vec::Vec) { - self.key = ::protobuf::SingularField::some(v); + self.key = v; } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { - if self.key.is_none() { - self.key.set_default(); - } - self.key.as_mut().unwrap() + &mut self.key } // Take field pub fn take_key(&mut self) -> ::std::vec::Vec { - self.key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + ::std::mem::replace(&mut self.key, ::std::vec::Vec::new()) } - pub fn get_key(&self) -> &[u8] { - match self.key.as_ref() { - Some(v) => &v, - None => &[], - } + // .dht.pb.Record record = 3; + + + pub fn get_record(&self) -> &Record { + self.record.as_ref().unwrap_or_else(|| Record::default_instance()) } - - // optional .record.pb.Record record = 3; - pub fn clear_record(&mut self) { self.record.clear(); } @@ -125,13 +370,13 @@ impl Message { } // Param is passed by value, moved - pub fn set_record(&mut self, v: super::record::Record) { + pub fn set_record(&mut self, v: Record) { self.record = ::protobuf::SingularPtrField::some(v); } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. - pub fn mut_record(&mut self) -> &mut super::record::Record { + pub fn mut_record(&mut self) -> &mut Record { if self.record.is_none() { self.record.set_default(); } @@ -139,16 +384,16 @@ impl Message { } // Take field - pub fn take_record(&mut self) -> super::record::Record { - self.record.take().unwrap_or_else(|| super::record::Record::new()) - } - - pub fn get_record(&self) -> &super::record::Record { - self.record.as_ref().unwrap_or_else(|| super::record::Record::default_instance()) + pub fn take_record(&mut self) -> Record { + self.record.take().unwrap_or_else(|| Record::new()) } // repeated .dht.pb.Message.Peer closerPeers = 8; + + pub fn get_closerPeers(&self) -> &[Message_Peer] { + &self.closerPeers + } pub fn clear_closerPeers(&mut self) { self.closerPeers.clear(); } @@ -168,12 +413,12 @@ impl Message { ::std::mem::replace(&mut self.closerPeers, ::protobuf::RepeatedField::new()) } - pub fn get_closerPeers(&self) -> &[Message_Peer] { - &self.closerPeers - } - // repeated .dht.pb.Message.Peer providerPeers = 9; + + pub fn get_providerPeers(&self) -> &[Message_Peer] { + &self.providerPeers + } pub fn clear_providerPeers(&mut self) { self.providerPeers.clear(); } @@ -192,10 +437,6 @@ impl Message { pub fn take_providerPeers(&mut self) -> ::protobuf::RepeatedField { ::std::mem::replace(&mut self.providerPeers, ::protobuf::RepeatedField::new()) } - - pub fn get_providerPeers(&self) -> &[Message_Peer] { - &self.providerPeers - } } impl ::protobuf::Message for Message { @@ -218,22 +459,22 @@ impl ::protobuf::Message for Message { true } - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { - ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.field_type, 1, &mut self.unknown_fields)? + ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.field_type, 1, &mut self.unknown_fields)? }, 10 => { if wire_type != ::protobuf::wire_format::WireTypeVarint { return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_int32()?; - self.clusterLevelRaw = ::std::option::Option::Some(tmp); + self.clusterLevelRaw = tmp; }, 2 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.key)?; + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.key)?; }, 3 => { ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.record)?; @@ -256,14 +497,14 @@ impl ::protobuf::Message for Message { #[allow(unused_variables)] fn compute_size(&self) -> u32 { let mut my_size = 0; - if let Some(v) = self.field_type { - my_size += ::protobuf::rt::enum_size(1, v); + if self.field_type != Message_MessageType::PUT_VALUE { + my_size += ::protobuf::rt::enum_size(1, self.field_type); } - if let Some(v) = self.clusterLevelRaw { - my_size += ::protobuf::rt::value_size(10, v, ::protobuf::wire_format::WireTypeVarint); + if self.clusterLevelRaw != 0 { + my_size += ::protobuf::rt::value_size(10, self.clusterLevelRaw, ::protobuf::wire_format::WireTypeVarint); } - if let Some(ref v) = self.key.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); + if !self.key.is_empty() { + my_size += ::protobuf::rt::bytes_size(2, &self.key); } if let Some(ref v) = self.record.as_ref() { let len = v.compute_size(); @@ -282,15 +523,15 @@ impl ::protobuf::Message for Message { my_size } - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.field_type { - os.write_enum(1, v.value())?; + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.field_type != Message_MessageType::PUT_VALUE { + os.write_enum(1, self.field_type.value())?; } - if let Some(v) = self.clusterLevelRaw { - os.write_int32(10, v)?; + if self.clusterLevelRaw != 0 { + os.write_int32(10, self.clusterLevelRaw)?; } - if let Some(ref v) = self.key.as_ref() { - os.write_bytes(2, &v)?; + if !self.key.is_empty() { + os.write_bytes(2, &self.key)?; } if let Some(ref v) = self.record.as_ref() { os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; @@ -323,13 +564,13 @@ impl ::protobuf::Message for Message { &mut self.unknown_fields } - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any } - fn into_any(self: Box) -> ::std::boxed::Box { + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { self } @@ -349,22 +590,22 @@ impl ::protobuf::Message for Message { unsafe { descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( "type", |m: &Message| { &m.field_type }, |m: &mut Message| { &mut m.field_type }, )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( "clusterLevelRaw", |m: &Message| { &m.clusterLevelRaw }, |m: &mut Message| { &mut m.clusterLevelRaw }, )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "key", |m: &Message| { &m.key }, |m: &mut Message| { &mut m.key }, )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "record", |m: &Message| { &m.record }, |m: &mut Message| { &mut m.record }, @@ -401,24 +642,24 @@ impl ::protobuf::Message for Message { impl ::protobuf::Clear for Message { fn clear(&mut self) { - self.clear_field_type(); - self.clear_clusterLevelRaw(); - self.clear_key(); - self.clear_record(); - self.clear_closerPeers(); - self.clear_providerPeers(); + self.field_type = Message_MessageType::PUT_VALUE; + self.clusterLevelRaw = 0; + self.key.clear(); + self.record.clear(); + self.closerPeers.clear(); + self.providerPeers.clear(); self.unknown_fields.clear(); } } impl ::std::fmt::Debug for Message { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Message { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { ::protobuf::reflect::ProtobufValueRef::Message(self) } } @@ -426,57 +667,57 @@ impl ::protobuf::reflect::ProtobufValue for Message { #[derive(PartialEq,Clone,Default)] pub struct Message_Peer { // message fields - id: ::protobuf::SingularField<::std::vec::Vec>, - addrs: ::protobuf::RepeatedField<::std::vec::Vec>, - connection: ::std::option::Option, + pub id: ::std::vec::Vec, + pub addrs: ::protobuf::RepeatedField<::std::vec::Vec>, + pub connection: Message_ConnectionType, // special fields pub unknown_fields: ::protobuf::UnknownFields, pub cached_size: ::protobuf::CachedSize, } +impl<'a> ::std::default::Default for &'a Message_Peer { + fn default() -> &'a Message_Peer { + ::default_instance() + } +} + impl Message_Peer { pub fn new() -> Message_Peer { ::std::default::Default::default() } - // optional bytes id = 1; + // bytes id = 1; + + pub fn get_id(&self) -> &[u8] { + &self.id + } pub fn clear_id(&mut self) { self.id.clear(); } - pub fn has_id(&self) -> bool { - self.id.is_some() - } - // Param is passed by value, moved pub fn set_id(&mut self, v: ::std::vec::Vec) { - self.id = ::protobuf::SingularField::some(v); + self.id = v; } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. pub fn mut_id(&mut self) -> &mut ::std::vec::Vec { - if self.id.is_none() { - self.id.set_default(); - } - self.id.as_mut().unwrap() + &mut self.id } // Take field pub fn take_id(&mut self) -> ::std::vec::Vec { - self.id.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub fn get_id(&self) -> &[u8] { - match self.id.as_ref() { - Some(v) => &v, - None => &[], - } + ::std::mem::replace(&mut self.id, ::std::vec::Vec::new()) } // repeated bytes addrs = 2; + + pub fn get_addrs(&self) -> &[::std::vec::Vec] { + &self.addrs + } pub fn clear_addrs(&mut self) { self.addrs.clear(); } @@ -496,27 +737,19 @@ impl Message_Peer { ::std::mem::replace(&mut self.addrs, ::protobuf::RepeatedField::new()) } - pub fn get_addrs(&self) -> &[::std::vec::Vec] { - &self.addrs + // .dht.pb.Message.ConnectionType connection = 3; + + + pub fn get_connection(&self) -> Message_ConnectionType { + self.connection } - - // optional .dht.pb.Message.ConnectionType connection = 3; - pub fn clear_connection(&mut self) { - self.connection = ::std::option::Option::None; - } - - pub fn has_connection(&self) -> bool { - self.connection.is_some() + self.connection = Message_ConnectionType::NOT_CONNECTED; } // Param is passed by value, moved pub fn set_connection(&mut self, v: Message_ConnectionType) { - self.connection = ::std::option::Option::Some(v); - } - - pub fn get_connection(&self) -> Message_ConnectionType { - self.connection.unwrap_or(Message_ConnectionType::NOT_CONNECTED) + self.connection = v; } } @@ -525,18 +758,18 @@ impl ::protobuf::Message for Message_Peer { true } - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.id)?; + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.id)?; }, 2 => { ::protobuf::rt::read_repeated_bytes_into(wire_type, is, &mut self.addrs)?; }, 3 => { - ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.connection, 3, &mut self.unknown_fields)? + ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.connection, 3, &mut self.unknown_fields)? }, _ => { ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; @@ -550,29 +783,29 @@ impl ::protobuf::Message for Message_Peer { #[allow(unused_variables)] fn compute_size(&self) -> u32 { let mut my_size = 0; - if let Some(ref v) = self.id.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); + if !self.id.is_empty() { + my_size += ::protobuf::rt::bytes_size(1, &self.id); } for value in &self.addrs { my_size += ::protobuf::rt::bytes_size(2, &value); }; - if let Some(v) = self.connection { - my_size += ::protobuf::rt::enum_size(3, v); + if self.connection != Message_ConnectionType::NOT_CONNECTED { + my_size += ::protobuf::rt::enum_size(3, self.connection); } my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); self.cached_size.set(my_size); my_size } - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.id.as_ref() { - os.write_bytes(1, &v)?; + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.id.is_empty() { + os.write_bytes(1, &self.id)?; } for v in &self.addrs { os.write_bytes(2, &v)?; }; - if let Some(v) = self.connection { - os.write_enum(3, v.value())?; + if self.connection != Message_ConnectionType::NOT_CONNECTED { + os.write_enum(3, self.connection.value())?; } os.write_unknown_fields(self.get_unknown_fields())?; ::std::result::Result::Ok(()) @@ -590,13 +823,13 @@ impl ::protobuf::Message for Message_Peer { &mut self.unknown_fields } - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any } - fn into_any(self: Box) -> ::std::boxed::Box { + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { self } @@ -616,7 +849,7 @@ impl ::protobuf::Message for Message_Peer { unsafe { descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "id", |m: &Message_Peer| { &m.id }, |m: &mut Message_Peer| { &mut m.id }, @@ -626,7 +859,7 @@ impl ::protobuf::Message for Message_Peer { |m: &Message_Peer| { &m.addrs }, |m: &mut Message_Peer| { &mut m.addrs }, )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( "connection", |m: &Message_Peer| { &m.connection }, |m: &mut Message_Peer| { &mut m.connection }, @@ -653,21 +886,21 @@ impl ::protobuf::Message for Message_Peer { impl ::protobuf::Clear for Message_Peer { fn clear(&mut self) { - self.clear_id(); - self.clear_addrs(); - self.clear_connection(); + self.id.clear(); + self.addrs.clear(); + self.connection = Message_ConnectionType::NOT_CONNECTED; self.unknown_fields.clear(); } } impl ::std::fmt::Debug for Message_Peer { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Message_Peer { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { ::protobuf::reflect::ProtobufValueRef::Message(self) } } @@ -734,7 +967,7 @@ impl ::std::default::Default for Message_MessageType { } impl ::protobuf::reflect::ProtobufValue for Message_MessageType { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) } } @@ -795,103 +1028,129 @@ impl ::std::default::Default for Message_ConnectionType { } impl ::protobuf::reflect::ProtobufValue for Message_ConnectionType { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) } } static file_descriptor_proto_data: &'static [u8] = b"\ - \n\tdht.proto\x12\x06dht.pb\x1a\x0crecord.proto\"\xc7\x04\n\x07Message\ - \x12/\n\x04type\x18\x01\x20\x01(\x0e2\x1b.dht.pb.Message.MessageTypeR\ - \x04type\x12(\n\x0fclusterLevelRaw\x18\n\x20\x01(\x05R\x0fclusterLevelRa\ - w\x12\x10\n\x03key\x18\x02\x20\x01(\x0cR\x03key\x12)\n\x06record\x18\x03\ - \x20\x01(\x0b2\x11.record.pb.RecordR\x06record\x126\n\x0bcloserPeers\x18\ - \x08\x20\x03(\x0b2\x14.dht.pb.Message.PeerR\x0bcloserPeers\x12:\n\rprovi\ - derPeers\x18\t\x20\x03(\x0b2\x14.dht.pb.Message.PeerR\rproviderPeers\x1a\ - l\n\x04Peer\x12\x0e\n\x02id\x18\x01\x20\x01(\x0cR\x02id\x12\x14\n\x05add\ - rs\x18\x02\x20\x03(\x0cR\x05addrs\x12>\n\nconnection\x18\x03\x20\x01(\ - \x0e2\x1e.dht.pb.Message.ConnectionTypeR\nconnection\"i\n\x0bMessageType\ - \x12\r\n\tPUT_VALUE\x10\0\x12\r\n\tGET_VALUE\x10\x01\x12\x10\n\x0cADD_PR\ - OVIDER\x10\x02\x12\x11\n\rGET_PROVIDERS\x10\x03\x12\r\n\tFIND_NODE\x10\ - \x04\x12\x08\n\x04PING\x10\x05\"W\n\x0eConnectionType\x12\x11\n\rNOT_CON\ - NECTED\x10\0\x12\r\n\tCONNECTED\x10\x01\x12\x0f\n\x0bCAN_CONNECT\x10\x02\ - \x12\x12\n\x0eCANNOT_CONNECT\x10\x03J\xc9\x10\n\x06\x12\x04\0\0>\x01\n\ - \x08\n\x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\x12\x03\x01\x08\x0e\n\t\n\ - \x02\x03\0\x12\x03\x03\x07\x15\n\n\n\x02\x04\0\x12\x04\x05\0>\x01\n\n\n\ - \x03\x04\0\x01\x12\x03\x05\x08\x0f\n\x0c\n\x04\x04\0\x04\0\x12\x04\x06\ - \x08\r\t\n\x0c\n\x05\x04\0\x04\0\x01\x12\x03\x06\r\x18\n\r\n\x06\x04\0\ - \x04\0\x02\0\x12\x03\x07\x10\x1e\n\x0e\n\x07\x04\0\x04\0\x02\0\x01\x12\ - \x03\x07\x10\x19\n\x0e\n\x07\x04\0\x04\0\x02\0\x02\x12\x03\x07\x1c\x1d\n\ - \r\n\x06\x04\0\x04\0\x02\x01\x12\x03\x08\x10\x1e\n\x0e\n\x07\x04\0\x04\0\ - \x02\x01\x01\x12\x03\x08\x10\x19\n\x0e\n\x07\x04\0\x04\0\x02\x01\x02\x12\ - \x03\x08\x1c\x1d\n\r\n\x06\x04\0\x04\0\x02\x02\x12\x03\t\x10!\n\x0e\n\ - \x07\x04\0\x04\0\x02\x02\x01\x12\x03\t\x10\x1c\n\x0e\n\x07\x04\0\x04\0\ - \x02\x02\x02\x12\x03\t\x1f\x20\n\r\n\x06\x04\0\x04\0\x02\x03\x12\x03\n\ - \x10\"\n\x0e\n\x07\x04\0\x04\0\x02\x03\x01\x12\x03\n\x10\x1d\n\x0e\n\x07\ - \x04\0\x04\0\x02\x03\x02\x12\x03\n\x20!\n\r\n\x06\x04\0\x04\0\x02\x04\ - \x12\x03\x0b\x10\x1e\n\x0e\n\x07\x04\0\x04\0\x02\x04\x01\x12\x03\x0b\x10\ - \x19\n\x0e\n\x07\x04\0\x04\0\x02\x04\x02\x12\x03\x0b\x1c\x1d\n\r\n\x06\ - \x04\0\x04\0\x02\x05\x12\x03\x0c\x10\x19\n\x0e\n\x07\x04\0\x04\0\x02\x05\ - \x01\x12\x03\x0c\x10\x14\n\x0e\n\x07\x04\0\x04\0\x02\x05\x02\x12\x03\x0c\ - \x17\x18\n\x0c\n\x04\x04\0\x04\x01\x12\x04\x0f\x08\x1c\t\n\x0c\n\x05\x04\ - \0\x04\x01\x01\x12\x03\x0f\r\x1b\n^\n\x06\x04\0\x04\x01\x02\0\x12\x03\ - \x11\x10\"\x1aO\x20sender\x20does\x20not\x20have\x20a\x20connection\x20t\ - o\x20peer,\x20and\x20no\x20extra\x20information\x20(default)\n\n\x0e\n\ - \x07\x04\0\x04\x01\x02\0\x01\x12\x03\x11\x10\x1d\n\x0e\n\x07\x04\0\x04\ - \x01\x02\0\x02\x12\x03\x11\x20!\n5\n\x06\x04\0\x04\x01\x02\x01\x12\x03\ - \x14\x10\x1e\x1a&\x20sender\x20has\x20a\x20live\x20connection\x20to\x20p\ - eer\n\n\x0e\n\x07\x04\0\x04\x01\x02\x01\x01\x12\x03\x14\x10\x19\n\x0e\n\ - \x07\x04\0\x04\x01\x02\x01\x02\x12\x03\x14\x1c\x1d\n2\n\x06\x04\0\x04\ - \x01\x02\x02\x12\x03\x17\x10\x20\x1a#\x20sender\x20recently\x20connected\ - \x20to\x20peer\n\n\x0e\n\x07\x04\0\x04\x01\x02\x02\x01\x12\x03\x17\x10\ - \x1b\n\x0e\n\x07\x04\0\x04\x01\x02\x02\x02\x12\x03\x17\x1e\x1f\n\xa7\x01\ - \n\x06\x04\0\x04\x01\x02\x03\x12\x03\x1b\x10#\x1a\x97\x01\x20sender\x20r\ - ecently\x20tried\x20to\x20connect\x20to\x20peer\x20repeatedly\x20but\x20\ - failed\x20to\x20connect\n\x20(\"try\"\x20here\x20is\x20loose,\x20but\x20\ - this\x20should\x20signal\x20\"made\x20strong\x20effort,\x20failed\")\n\n\ - \x0e\n\x07\x04\0\x04\x01\x02\x03\x01\x12\x03\x1b\x10\x1e\n\x0e\n\x07\x04\ - \0\x04\x01\x02\x03\x02\x12\x03\x1b!\"\n\x0c\n\x04\x04\0\x03\0\x12\x04\ - \x1e\x08'\t\n\x0c\n\x05\x04\0\x03\0\x01\x12\x03\x1e\x10\x14\n$\n\x06\x04\ - \0\x03\0\x02\0\x12\x03\x20\x10&\x1a\x15\x20ID\x20of\x20a\x20given\x20pee\ - r.\n\n\x0e\n\x07\x04\0\x03\0\x02\0\x04\x12\x03\x20\x10\x18\n\x0e\n\x07\ - \x04\0\x03\0\x02\0\x05\x12\x03\x20\x19\x1e\n\x0e\n\x07\x04\0\x03\0\x02\0\ - \x01\x12\x03\x20\x1f!\n\x0e\n\x07\x04\0\x03\0\x02\0\x03\x12\x03\x20$%\n,\ - \n\x06\x04\0\x03\0\x02\x01\x12\x03#\x10)\x1a\x1d\x20multiaddrs\x20for\ - \x20a\x20given\x20peer\n\n\x0e\n\x07\x04\0\x03\0\x02\x01\x04\x12\x03#\ - \x10\x18\n\x0e\n\x07\x04\0\x03\0\x02\x01\x05\x12\x03#\x19\x1e\n\x0e\n\ - \x07\x04\0\x03\0\x02\x01\x01\x12\x03#\x1f$\n\x0e\n\x07\x04\0\x03\0\x02\ - \x01\x03\x12\x03#'(\nP\n\x06\x04\0\x03\0\x02\x02\x12\x03&\x107\x1aA\x20u\ - sed\x20to\x20signal\x20the\x20sender's\x20connection\x20capabilities\x20\ - to\x20the\x20peer\n\n\x0e\n\x07\x04\0\x03\0\x02\x02\x04\x12\x03&\x10\x18\ - \n\x0e\n\x07\x04\0\x03\0\x02\x02\x06\x12\x03&\x19'\n\x0e\n\x07\x04\0\x03\ - \0\x02\x02\x01\x12\x03&(2\n\x0e\n\x07\x04\0\x03\0\x02\x02\x03\x12\x03&56\ - \n2\n\x04\x04\0\x02\0\x12\x03*\x08&\x1a%\x20defines\x20what\x20type\x20o\ - f\x20message\x20it\x20is.\n\n\x0c\n\x05\x04\0\x02\0\x04\x12\x03*\x08\x10\ - \n\x0c\n\x05\x04\0\x02\0\x06\x12\x03*\x11\x1c\n\x0c\n\x05\x04\0\x02\0\ - \x01\x12\x03*\x1d!\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03*$%\nO\n\x04\x04\0\ - \x02\x01\x12\x03-\x08,\x1aB\x20defines\x20what\x20coral\x20cluster\x20le\ - vel\x20this\x20query/response\x20belongs\x20to.\n\n\x0c\n\x05\x04\0\x02\ - \x01\x04\x12\x03-\x08\x10\n\x0c\n\x05\x04\0\x02\x01\x05\x12\x03-\x11\x16\ - \n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03-\x17&\n\x0c\n\x05\x04\0\x02\x01\ - \x03\x12\x03-)+\nw\n\x04\x04\0\x02\x02\x12\x031\x08\x1f\x1aj\x20Used\x20\ - to\x20specify\x20the\x20key\x20associated\x20with\x20this\x20message.\n\ - \x20PUT_VALUE,\x20GET_VALUE,\x20ADD_PROVIDER,\x20GET_PROVIDERS\n\n\x0c\n\ - \x05\x04\0\x02\x02\x04\x12\x031\x08\x10\n\x0c\n\x05\x04\0\x02\x02\x05\ - \x12\x031\x11\x16\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x031\x17\x1a\n\x0c\n\ - \x05\x04\0\x02\x02\x03\x12\x031\x1d\x1e\n;\n\x04\x04\0\x02\x03\x12\x035\ - \x08-\x1a.\x20Used\x20to\x20return\x20a\x20value\n\x20PUT_VALUE,\x20GET_\ - VALUE\n\n\x0c\n\x05\x04\0\x02\x03\x04\x12\x035\x08\x10\n\x0c\n\x05\x04\0\ - \x02\x03\x06\x12\x035\x11!\n\x0c\n\x05\x04\0\x02\x03\x01\x12\x035\"(\n\ - \x0c\n\x05\x04\0\x02\x03\x03\x12\x035+,\nc\n\x04\x04\0\x02\x04\x12\x039\ - \x08&\x1aV\x20Used\x20to\x20return\x20peers\x20closer\x20to\x20a\x20key\ - \x20in\x20a\x20query\n\x20GET_VALUE,\x20GET_PROVIDERS,\x20FIND_NODE\n\n\ - \x0c\n\x05\x04\0\x02\x04\x04\x12\x039\x08\x10\n\x0c\n\x05\x04\0\x02\x04\ - \x06\x12\x039\x11\x15\n\x0c\n\x05\x04\0\x02\x04\x01\x12\x039\x16!\n\x0c\ - \n\x05\x04\0\x02\x04\x03\x12\x039$%\nO\n\x04\x04\0\x02\x05\x12\x03=\x08(\ - \x1aB\x20Used\x20to\x20return\x20Providers\n\x20GET_VALUE,\x20ADD_PROVID\ - ER,\x20GET_PROVIDERS\n\n\x0c\n\x05\x04\0\x02\x05\x04\x12\x03=\x08\x10\n\ - \x0c\n\x05\x04\0\x02\x05\x06\x12\x03=\x11\x15\n\x0c\n\x05\x04\0\x02\x05\ - \x01\x12\x03=\x16#\n\x0c\n\x05\x04\0\x02\x05\x03\x12\x03=&'\ + \n\tdht.proto\x12\x06dht.pb\"T\n\x06Record\x12\x10\n\x03key\x18\x01\x20\ + \x01(\x0cR\x03key\x12\x14\n\x05value\x18\x02\x20\x01(\x0cR\x05value\x12\ + \"\n\x0ctimeReceived\x18\x05\x20\x01(\tR\x0ctimeReceived\"\xc4\x04\n\x07\ + Message\x12/\n\x04type\x18\x01\x20\x01(\x0e2\x1b.dht.pb.Message.MessageT\ + ypeR\x04type\x12(\n\x0fclusterLevelRaw\x18\n\x20\x01(\x05R\x0fclusterLev\ + elRaw\x12\x10\n\x03key\x18\x02\x20\x01(\x0cR\x03key\x12&\n\x06record\x18\ + \x03\x20\x01(\x0b2\x0e.dht.pb.RecordR\x06record\x126\n\x0bcloserPeers\ + \x18\x08\x20\x03(\x0b2\x14.dht.pb.Message.PeerR\x0bcloserPeers\x12:\n\rp\ + roviderPeers\x18\t\x20\x03(\x0b2\x14.dht.pb.Message.PeerR\rproviderPeers\ + \x1al\n\x04Peer\x12\x0e\n\x02id\x18\x01\x20\x01(\x0cR\x02id\x12\x14\n\ + \x05addrs\x18\x02\x20\x03(\x0cR\x05addrs\x12>\n\nconnection\x18\x03\x20\ + \x01(\x0e2\x1e.dht.pb.Message.ConnectionTypeR\nconnection\"i\n\x0bMessag\ + eType\x12\r\n\tPUT_VALUE\x10\0\x12\r\n\tGET_VALUE\x10\x01\x12\x10\n\x0cA\ + DD_PROVIDER\x10\x02\x12\x11\n\rGET_PROVIDERS\x10\x03\x12\r\n\tFIND_NODE\ + \x10\x04\x12\x08\n\x04PING\x10\x05\"W\n\x0eConnectionType\x12\x11\n\rNOT\ + _CONNECTED\x10\0\x12\r\n\tCONNECTED\x10\x01\x12\x0f\n\x0bCAN_CONNECT\x10\ + \x02\x12\x12\n\x0eCANNOT_CONNECT\x10\x03J\x91\x16\n\x06\x12\x04\0\0P\x01\ + \n\x08\n\x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\x12\x03\x01\x08\x0e\nX\ + \n\x02\x04\0\x12\x04\x05\0\x14\x01\x1aL\x20Record\x20represents\x20a\x20\ + dht\x20record\x20that\x20contains\x20a\x20value\n\x20for\x20a\x20key\x20\ + value\x20pair\n\n\n\n\x03\x04\0\x01\x12\x03\x05\x08\x0e\n2\n\x04\x04\0\ + \x02\0\x12\x03\x07\x08\x16\x1a%\x20The\x20key\x20that\x20references\x20t\ + his\x20record\n\n\r\n\x05\x04\0\x02\0\x04\x12\x04\x07\x08\x05\x10\n\x0c\ + \n\x05\x04\0\x02\0\x05\x12\x03\x07\x08\r\n\x0c\n\x05\x04\0\x02\0\x01\x12\ + \x03\x07\x0e\x11\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x07\x14\x15\n6\n\ + \x04\x04\0\x02\x01\x12\x03\n\x08\x18\x1a)\x20The\x20actual\x20value\x20t\ + his\x20record\x20is\x20storing\n\n\r\n\x05\x04\0\x02\x01\x04\x12\x04\n\ + \x08\x07\x16\n\x0c\n\x05\x04\0\x02\x01\x05\x12\x03\n\x08\r\n\x0c\n\x05\ + \x04\0\x02\x01\x01\x12\x03\n\x0e\x13\n\x0c\n\x05\x04\0\x02\x01\x03\x12\ + \x03\n\x16\x17\n\xfc\x01\n\x04\x04\0\x02\x02\x12\x03\x13\x08\x20\x1a/\ + \x20Time\x20the\x20record\x20was\x20received,\x20set\x20by\x20receiver\n\ + 2\xbd\x01\x20Note:\x20These\x20fields\x20were\x20removed\x20from\x20the\ + \x20Record\x20message\n\x20hash\x20of\x20the\x20authors\x20public\x20key\ + \noptional\x20string\x20author\x20=\x203;\n\x20A\x20PKI\x20signature\x20\ + for\x20the\x20key+value+author\noptional\x20bytes\x20signature\x20=\x204\ + ;\n\n\r\n\x05\x04\0\x02\x02\x04\x12\x04\x13\x08\n\x18\n\x0c\n\x05\x04\0\ + \x02\x02\x05\x12\x03\x13\x08\x0e\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\ + \x13\x0f\x1b\n\x0c\n\x05\x04\0\x02\x02\x03\x12\x03\x13\x1e\x1f\n\n\n\x02\ + \x04\x01\x12\x04\x16\0P\x01\n\n\n\x03\x04\x01\x01\x12\x03\x16\x08\x0f\n\ + \x0c\n\x04\x04\x01\x04\0\x12\x04\x17\x08\x1e\t\n\x0c\n\x05\x04\x01\x04\0\ + \x01\x12\x03\x17\r\x18\n\r\n\x06\x04\x01\x04\0\x02\0\x12\x03\x18\x10\x1e\ + \n\x0e\n\x07\x04\x01\x04\0\x02\0\x01\x12\x03\x18\x10\x19\n\x0e\n\x07\x04\ + \x01\x04\0\x02\0\x02\x12\x03\x18\x1c\x1d\n\r\n\x06\x04\x01\x04\0\x02\x01\ + \x12\x03\x19\x10\x1e\n\x0e\n\x07\x04\x01\x04\0\x02\x01\x01\x12\x03\x19\ + \x10\x19\n\x0e\n\x07\x04\x01\x04\0\x02\x01\x02\x12\x03\x19\x1c\x1d\n\r\n\ + \x06\x04\x01\x04\0\x02\x02\x12\x03\x1a\x10!\n\x0e\n\x07\x04\x01\x04\0\ + \x02\x02\x01\x12\x03\x1a\x10\x1c\n\x0e\n\x07\x04\x01\x04\0\x02\x02\x02\ + \x12\x03\x1a\x1f\x20\n\r\n\x06\x04\x01\x04\0\x02\x03\x12\x03\x1b\x10\"\n\ + \x0e\n\x07\x04\x01\x04\0\x02\x03\x01\x12\x03\x1b\x10\x1d\n\x0e\n\x07\x04\ + \x01\x04\0\x02\x03\x02\x12\x03\x1b\x20!\n\r\n\x06\x04\x01\x04\0\x02\x04\ + \x12\x03\x1c\x10\x1e\n\x0e\n\x07\x04\x01\x04\0\x02\x04\x01\x12\x03\x1c\ + \x10\x19\n\x0e\n\x07\x04\x01\x04\0\x02\x04\x02\x12\x03\x1c\x1c\x1d\n\r\n\ + \x06\x04\x01\x04\0\x02\x05\x12\x03\x1d\x10\x19\n\x0e\n\x07\x04\x01\x04\0\ + \x02\x05\x01\x12\x03\x1d\x10\x14\n\x0e\n\x07\x04\x01\x04\0\x02\x05\x02\ + \x12\x03\x1d\x17\x18\n\x0c\n\x04\x04\x01\x04\x01\x12\x04\x20\x08-\t\n\ + \x0c\n\x05\x04\x01\x04\x01\x01\x12\x03\x20\r\x1b\n^\n\x06\x04\x01\x04\ + \x01\x02\0\x12\x03\"\x10\"\x1aO\x20sender\x20does\x20not\x20have\x20a\ + \x20connection\x20to\x20peer,\x20and\x20no\x20extra\x20information\x20(d\ + efault)\n\n\x0e\n\x07\x04\x01\x04\x01\x02\0\x01\x12\x03\"\x10\x1d\n\x0e\ + \n\x07\x04\x01\x04\x01\x02\0\x02\x12\x03\"\x20!\n5\n\x06\x04\x01\x04\x01\ + \x02\x01\x12\x03%\x10\x1e\x1a&\x20sender\x20has\x20a\x20live\x20connecti\ + on\x20to\x20peer\n\n\x0e\n\x07\x04\x01\x04\x01\x02\x01\x01\x12\x03%\x10\ + \x19\n\x0e\n\x07\x04\x01\x04\x01\x02\x01\x02\x12\x03%\x1c\x1d\n2\n\x06\ + \x04\x01\x04\x01\x02\x02\x12\x03(\x10\x20\x1a#\x20sender\x20recently\x20\ + connected\x20to\x20peer\n\n\x0e\n\x07\x04\x01\x04\x01\x02\x02\x01\x12\ + \x03(\x10\x1b\n\x0e\n\x07\x04\x01\x04\x01\x02\x02\x02\x12\x03(\x1e\x1f\n\ + \xa7\x01\n\x06\x04\x01\x04\x01\x02\x03\x12\x03,\x10#\x1a\x97\x01\x20send\ + er\x20recently\x20tried\x20to\x20connect\x20to\x20peer\x20repeatedly\x20\ + but\x20failed\x20to\x20connect\n\x20(\"try\"\x20here\x20is\x20loose,\x20\ + but\x20this\x20should\x20signal\x20\"made\x20strong\x20effort,\x20failed\ + \")\n\n\x0e\n\x07\x04\x01\x04\x01\x02\x03\x01\x12\x03,\x10\x1e\n\x0e\n\ + \x07\x04\x01\x04\x01\x02\x03\x02\x12\x03,!\"\n\x0c\n\x04\x04\x01\x03\0\ + \x12\x04/\x088\t\n\x0c\n\x05\x04\x01\x03\0\x01\x12\x03/\x10\x14\n$\n\x06\ + \x04\x01\x03\0\x02\0\x12\x031\x10\x1d\x1a\x15\x20ID\x20of\x20a\x20given\ + \x20peer.\n\n\x0f\n\x07\x04\x01\x03\0\x02\0\x04\x12\x041\x10/\x16\n\x0e\ + \n\x07\x04\x01\x03\0\x02\0\x05\x12\x031\x10\x15\n\x0e\n\x07\x04\x01\x03\ + \0\x02\0\x01\x12\x031\x16\x18\n\x0e\n\x07\x04\x01\x03\0\x02\0\x03\x12\ + \x031\x1b\x1c\n,\n\x06\x04\x01\x03\0\x02\x01\x12\x034\x10)\x1a\x1d\x20mu\ + ltiaddrs\x20for\x20a\x20given\x20peer\n\n\x0e\n\x07\x04\x01\x03\0\x02\ + \x01\x04\x12\x034\x10\x18\n\x0e\n\x07\x04\x01\x03\0\x02\x01\x05\x12\x034\ + \x19\x1e\n\x0e\n\x07\x04\x01\x03\0\x02\x01\x01\x12\x034\x1f$\n\x0e\n\x07\ + \x04\x01\x03\0\x02\x01\x03\x12\x034'(\nP\n\x06\x04\x01\x03\0\x02\x02\x12\ + \x037\x10.\x1aA\x20used\x20to\x20signal\x20the\x20sender's\x20connection\ + \x20capabilities\x20to\x20the\x20peer\n\n\x0f\n\x07\x04\x01\x03\0\x02\ + \x02\x04\x12\x047\x104)\n\x0e\n\x07\x04\x01\x03\0\x02\x02\x06\x12\x037\ + \x10\x1e\n\x0e\n\x07\x04\x01\x03\0\x02\x02\x01\x12\x037\x1f)\n\x0e\n\x07\ + \x04\x01\x03\0\x02\x02\x03\x12\x037,-\n2\n\x04\x04\x01\x02\0\x12\x03;\ + \x08\x1d\x1a%\x20defines\x20what\x20type\x20of\x20message\x20it\x20is.\n\ + \n\r\n\x05\x04\x01\x02\0\x04\x12\x04;\x088\t\n\x0c\n\x05\x04\x01\x02\0\ + \x06\x12\x03;\x08\x13\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03;\x14\x18\n\ + \x0c\n\x05\x04\x01\x02\0\x03\x12\x03;\x1b\x1c\n\x9f\x01\n\x04\x04\x01\ + \x02\x01\x12\x03?\x08#\x1a\x85\x01\x20defines\x20what\x20coral\x20cluste\ + r\x20level\x20this\x20query/response\x20belongs\x20to.\n\x20in\x20case\ + \x20we\x20want\x20to\x20implement\x20coral's\x20cluster\x20rings\x20in\ + \x20the\x20future.\n\"\n\x20NOT\x20USED\n\n\r\n\x05\x04\x01\x02\x01\x04\ + \x12\x04?\x08;\x1d\n\x0c\n\x05\x04\x01\x02\x01\x05\x12\x03?\x08\r\n\x0c\ + \n\x05\x04\x01\x02\x01\x01\x12\x03?\x0e\x1d\n\x0c\n\x05\x04\x01\x02\x01\ + \x03\x12\x03?\x20\"\nw\n\x04\x04\x01\x02\x02\x12\x03C\x08\x16\x1aj\x20Us\ + ed\x20to\x20specify\x20the\x20key\x20associated\x20with\x20this\x20messa\ + ge.\n\x20PUT_VALUE,\x20GET_VALUE,\x20ADD_PROVIDER,\x20GET_PROVIDERS\n\n\ + \r\n\x05\x04\x01\x02\x02\x04\x12\x04C\x08?#\n\x0c\n\x05\x04\x01\x02\x02\ + \x05\x12\x03C\x08\r\n\x0c\n\x05\x04\x01\x02\x02\x01\x12\x03C\x0e\x11\n\ + \x0c\n\x05\x04\x01\x02\x02\x03\x12\x03C\x14\x15\n;\n\x04\x04\x01\x02\x03\ + \x12\x03G\x08\x1a\x1a.\x20Used\x20to\x20return\x20a\x20value\n\x20PUT_VA\ + LUE,\x20GET_VALUE\n\n\r\n\x05\x04\x01\x02\x03\x04\x12\x04G\x08C\x16\n\ + \x0c\n\x05\x04\x01\x02\x03\x06\x12\x03G\x08\x0e\n\x0c\n\x05\x04\x01\x02\ + \x03\x01\x12\x03G\x0f\x15\n\x0c\n\x05\x04\x01\x02\x03\x03\x12\x03G\x18\ + \x19\nc\n\x04\x04\x01\x02\x04\x12\x03K\x08&\x1aV\x20Used\x20to\x20return\ + \x20peers\x20closer\x20to\x20a\x20key\x20in\x20a\x20query\n\x20GET_VALUE\ + ,\x20GET_PROVIDERS,\x20FIND_NODE\n\n\x0c\n\x05\x04\x01\x02\x04\x04\x12\ + \x03K\x08\x10\n\x0c\n\x05\x04\x01\x02\x04\x06\x12\x03K\x11\x15\n\x0c\n\ + \x05\x04\x01\x02\x04\x01\x12\x03K\x16!\n\x0c\n\x05\x04\x01\x02\x04\x03\ + \x12\x03K$%\nO\n\x04\x04\x01\x02\x05\x12\x03O\x08(\x1aB\x20Used\x20to\ + \x20return\x20Providers\n\x20GET_VALUE,\x20ADD_PROVIDER,\x20GET_PROVIDER\ + S\n\n\x0c\n\x05\x04\x01\x02\x05\x04\x12\x03O\x08\x10\n\x0c\n\x05\x04\x01\ + \x02\x05\x06\x12\x03O\x11\x15\n\x0c\n\x05\x04\x01\x02\x05\x01\x12\x03O\ + \x16#\n\x0c\n\x05\x04\x01\x02\x05\x03\x12\x03O&'b\x06proto3\ "; static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { diff --git a/protocols/kad/src/protobuf_structs/mod.rs b/protocols/kad/src/protobuf_structs/mod.rs index c5f182e2..614bc875 100644 --- a/protocols/kad/src/protobuf_structs/mod.rs +++ b/protocols/kad/src/protobuf_structs/mod.rs @@ -19,4 +19,3 @@ // DEALINGS IN THE SOFTWARE. pub mod dht; -pub mod record; diff --git a/protocols/kad/src/protobuf_structs/record.rs b/protocols/kad/src/protobuf_structs/record.rs deleted file mode 100644 index 59b8b020..00000000 --- a/protocols/kad/src/protobuf_structs/record.rs +++ /dev/null @@ -1,453 +0,0 @@ -// This file is generated by rust-protobuf 2.3.0. Do not edit -// @generated - -// https://github.com/Manishearth/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![cfg_attr(rustfmt, rustfmt_skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unsafe_code)] -#![allow(unused_imports)] -#![allow(unused_results)] - -use protobuf::Message as Message_imported_for_functions; -use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; - -#[derive(PartialEq,Clone,Default)] -pub struct Record { - // message fields - key: ::protobuf::SingularField<::std::string::String>, - value: ::protobuf::SingularField<::std::vec::Vec>, - author: ::protobuf::SingularField<::std::string::String>, - signature: ::protobuf::SingularField<::std::vec::Vec>, - timeReceived: ::protobuf::SingularField<::std::string::String>, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl Record { - pub fn new() -> Record { - ::std::default::Default::default() - } - - // optional string key = 1; - - pub fn clear_key(&mut self) { - self.key.clear(); - } - - pub fn has_key(&self) -> bool { - self.key.is_some() - } - - // Param is passed by value, moved - pub fn set_key(&mut self, v: ::std::string::String) { - self.key = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_key(&mut self) -> &mut ::std::string::String { - if self.key.is_none() { - self.key.set_default(); - } - self.key.as_mut().unwrap() - } - - // Take field - pub fn take_key(&mut self) -> ::std::string::String { - self.key.take().unwrap_or_else(|| ::std::string::String::new()) - } - - pub fn get_key(&self) -> &str { - match self.key.as_ref() { - Some(v) => &v, - None => "", - } - } - - // optional bytes value = 2; - - pub fn clear_value(&mut self) { - self.value.clear(); - } - - pub fn has_value(&self) -> bool { - self.value.is_some() - } - - // Param is passed by value, moved - pub fn set_value(&mut self, v: ::std::vec::Vec) { - self.value = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { - if self.value.is_none() { - self.value.set_default(); - } - self.value.as_mut().unwrap() - } - - // Take field - pub fn take_value(&mut self) -> ::std::vec::Vec { - self.value.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub fn get_value(&self) -> &[u8] { - match self.value.as_ref() { - Some(v) => &v, - None => &[], - } - } - - // optional string author = 3; - - pub fn clear_author(&mut self) { - self.author.clear(); - } - - pub fn has_author(&self) -> bool { - self.author.is_some() - } - - // Param is passed by value, moved - pub fn set_author(&mut self, v: ::std::string::String) { - self.author = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_author(&mut self) -> &mut ::std::string::String { - if self.author.is_none() { - self.author.set_default(); - } - self.author.as_mut().unwrap() - } - - // Take field - pub fn take_author(&mut self) -> ::std::string::String { - self.author.take().unwrap_or_else(|| ::std::string::String::new()) - } - - pub fn get_author(&self) -> &str { - match self.author.as_ref() { - Some(v) => &v, - None => "", - } - } - - // optional bytes signature = 4; - - pub fn clear_signature(&mut self) { - self.signature.clear(); - } - - pub fn has_signature(&self) -> bool { - self.signature.is_some() - } - - // Param is passed by value, moved - pub fn set_signature(&mut self, v: ::std::vec::Vec) { - self.signature = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { - if self.signature.is_none() { - self.signature.set_default(); - } - self.signature.as_mut().unwrap() - } - - // Take field - pub fn take_signature(&mut self) -> ::std::vec::Vec { - self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub fn get_signature(&self) -> &[u8] { - match self.signature.as_ref() { - Some(v) => &v, - None => &[], - } - } - - // optional string timeReceived = 5; - - pub fn clear_timeReceived(&mut self) { - self.timeReceived.clear(); - } - - pub fn has_timeReceived(&self) -> bool { - self.timeReceived.is_some() - } - - // Param is passed by value, moved - pub fn set_timeReceived(&mut self, v: ::std::string::String) { - self.timeReceived = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_timeReceived(&mut self) -> &mut ::std::string::String { - if self.timeReceived.is_none() { - self.timeReceived.set_default(); - } - self.timeReceived.as_mut().unwrap() - } - - // Take field - pub fn take_timeReceived(&mut self) -> ::std::string::String { - self.timeReceived.take().unwrap_or_else(|| ::std::string::String::new()) - } - - pub fn get_timeReceived(&self) -> &str { - match self.timeReceived.as_ref() { - Some(v) => &v, - None => "", - } - } -} - -impl ::protobuf::Message for Record { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.key)?; - }, - 2 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.value)?; - }, - 3 => { - ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.author)?; - }, - 4 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.signature)?; - }, - 5 => { - ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.timeReceived)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.key.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(ref v) = self.value.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(ref v) = self.author.as_ref() { - my_size += ::protobuf::rt::string_size(3, &v); - } - if let Some(ref v) = self.signature.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - if let Some(ref v) = self.timeReceived.as_ref() { - my_size += ::protobuf::rt::string_size(5, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.key.as_ref() { - os.write_string(1, &v)?; - } - if let Some(ref v) = self.value.as_ref() { - os.write_bytes(2, &v)?; - } - if let Some(ref v) = self.author.as_ref() { - os.write_string(3, &v)?; - } - if let Some(ref v) = self.signature.as_ref() { - os.write_bytes(4, &v)?; - } - if let Some(ref v) = self.timeReceived.as_ref() { - os.write_string(5, &v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> Record { - Record::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "key", - |m: &Record| { &m.key }, - |m: &mut Record| { &mut m.key }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "value", - |m: &Record| { &m.value }, - |m: &mut Record| { &mut m.value }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "author", - |m: &Record| { &m.author }, - |m: &mut Record| { &mut m.author }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "signature", - |m: &Record| { &m.signature }, - |m: &mut Record| { &mut m.signature }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "timeReceived", - |m: &Record| { &m.timeReceived }, - |m: &mut Record| { &mut m.timeReceived }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Record", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static Record { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Record, - }; - unsafe { - instance.get(Record::new) - } - } -} - -impl ::protobuf::Clear for Record { - fn clear(&mut self) { - self.clear_key(); - self.clear_value(); - self.clear_author(); - self.clear_signature(); - self.clear_timeReceived(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Record { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Record { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x0crecord.proto\x12\trecord.pb\"\x8a\x01\n\x06Record\x12\x10\n\x03key\ - \x18\x01\x20\x01(\tR\x03key\x12\x14\n\x05value\x18\x02\x20\x01(\x0cR\x05\ - value\x12\x16\n\x06author\x18\x03\x20\x01(\tR\x06author\x12\x1c\n\tsigna\ - ture\x18\x04\x20\x01(\x0cR\tsignature\x12\"\n\x0ctimeReceived\x18\x05\ - \x20\x01(\tR\x0ctimeReceivedJ\xac\x05\n\x06\x12\x04\0\0\x14\x01\n\x08\n\ - \x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\x12\x03\x01\x08\x11\nX\n\x02\ - \x04\0\x12\x04\x05\0\x14\x01\x1aL\x20Record\x20represents\x20a\x20dht\ - \x20record\x20that\x20contains\x20a\x20value\n\x20for\x20a\x20key\x20val\ - ue\x20pair\n\n\n\n\x03\x04\0\x01\x12\x03\x05\x08\x0e\n2\n\x04\x04\0\x02\ - \0\x12\x03\x07\x08\x20\x1a%\x20The\x20key\x20that\x20references\x20this\ - \x20record\n\n\x0c\n\x05\x04\0\x02\0\x04\x12\x03\x07\x08\x10\n\x0c\n\x05\ - \x04\0\x02\0\x05\x12\x03\x07\x11\x17\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\ - \x07\x18\x1b\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x07\x1e\x1f\n6\n\x04\ - \x04\0\x02\x01\x12\x03\n\x08!\x1a)\x20The\x20actual\x20value\x20this\x20\ - record\x20is\x20storing\n\n\x0c\n\x05\x04\0\x02\x01\x04\x12\x03\n\x08\ - \x10\n\x0c\n\x05\x04\0\x02\x01\x05\x12\x03\n\x11\x16\n\x0c\n\x05\x04\0\ - \x02\x01\x01\x12\x03\n\x17\x1c\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\n\ - \x1f\x20\n-\n\x04\x04\0\x02\x02\x12\x03\r\x08#\x1a\x20\x20hash\x20of\x20\ - the\x20authors\x20public\x20key\n\n\x0c\n\x05\x04\0\x02\x02\x04\x12\x03\ - \r\x08\x10\n\x0c\n\x05\x04\0\x02\x02\x05\x12\x03\r\x11\x17\n\x0c\n\x05\ - \x04\0\x02\x02\x01\x12\x03\r\x18\x1e\n\x0c\n\x05\x04\0\x02\x02\x03\x12\ - \x03\r!\"\n7\n\x04\x04\0\x02\x03\x12\x03\x10\x08%\x1a*\x20A\x20PKI\x20si\ - gnature\x20for\x20the\x20key+value+author\n\n\x0c\n\x05\x04\0\x02\x03\ - \x04\x12\x03\x10\x08\x10\n\x0c\n\x05\x04\0\x02\x03\x05\x12\x03\x10\x11\ - \x16\n\x0c\n\x05\x04\0\x02\x03\x01\x12\x03\x10\x17\x20\n\x0c\n\x05\x04\0\ - \x02\x03\x03\x12\x03\x10#$\n<\n\x04\x04\0\x02\x04\x12\x03\x13\x08)\x1a/\ - \x20Time\x20the\x20record\x20was\x20received,\x20set\x20by\x20receiver\n\ - \n\x0c\n\x05\x04\0\x02\x04\x04\x12\x03\x13\x08\x10\n\x0c\n\x05\x04\0\x02\ - \x04\x05\x12\x03\x13\x11\x17\n\x0c\n\x05\x04\0\x02\x04\x01\x12\x03\x13\ - \x18$\n\x0c\n\x05\x04\0\x02\x04\x03\x12\x03\x13'(\ -"; - -static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, -}; - -fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { - ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() -} - -pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - unsafe { - file_descriptor_proto_lazy.get(|| { - parse_descriptor_proto() - }) - } -}