pub struct DeRecProtocolConfig {Show 13 fields
pub threshold: Option<usize>,
pub max_subshares: Option<u64>,
pub timeouts: Option<TimeoutsConfig>,
pub parameter_range: Option<ParameterRange>,
pub auto_accept: Option<AutoAcceptPolicy>,
pub auto_respond_on_failure: Option<bool>,
pub auto_reply_to: Option<bool>,
pub unpair_ack: Option<UnpairAck>,
pub unsafe_connection: Option<bool>,
pub communication_info: Option<HashMap<String, String>>,
pub own_transports: Option<Vec<TransportProtocol>>,
pub replica_id: Option<u64>,
pub min_protocol_version: Option<ProtocolVersion>,
}Expand description
Every data setting of a DeRecProtocolBuilder,
each one optional, applied in one call by
with_config.
A field left None is not applied: the builder keeps what it already
holds. A field that is set is applied through the matching with_*
setter and validated by
build under exactly
the rules that setter documents. Stores, the delivery transport and the
secret_id are not settings and are not carried here.
Configs layer: apply a general config, then a per-user one, then any
individual setter, and the last write wins per field. See
with_config.
§Canonical JSON
With the serde feature the struct serializes to, and deserializes from,
one JSON shape — the format for config files and user records, and the
one every SDK accepts:
{
"threshold": 3,
"max_subshares": "12",
"timeouts": {
"inbound_message_secs": 300,
"sharing_round_secs": 60,
"unpair_ack_secs": 60,
"get_share_response_secs": 300,
"pairing_secs": 30,
"expired_channels": { "enabled": true, "timeout_in_secs": 300 }
},
"parameter_range": { "min_share_size": 1, "max_share_size": 4096 },
"auto_accept": { "pairing": true, "store_share": true },
"auto_respond_on_failure": false,
"auto_reply_to": false,
"unpair_ack": "required",
"unsafe_connection": false,
"communication_info": { "name": "alice" },
"own_transports": [{ "uri": "https://me.example.com/derec", "protocol": "https" }],
"replica_id": "9007199254740993",
"min_protocol_version": { "major": 0, "minor": 1 }
}- Keys are
snake_case, and every key is optional: an absent key or anullvalue leaves that setting unset. - Unknown keys are rejected, at every level, so a misspelled key fails to parse instead of being ignored.
replica_idandmax_subsharesareu64values written as decimal strings, which survive JSON encoders whose numbers aref64.thresholdis a JSON number.timeoutscarries whole seconds; seeTimeoutsConfig.parameter_rangemirrorsderec_proto::ParameterRangewithsnake_casenames. Each bound is a JSON number or a decimal string, and an absent bound is0(“no bound”).auto_accepthas one boolean per flow, named as onAutoAcceptPolicy; an absent flow isfalse.unpair_ackis"required"or"not_required", or the discriminant0or1.- Each
own_transportsentry is{uri, protocol}, whereprotocolis"https"or"grpc"(any case) or its discriminant0or1. min_protocol_versionis{major, minor}, both JSON numbers.
Serializing writes only the fields that are set, names rather than
discriminants, and every flow of auto_accept and every bound of
parameter_range.
Fields§
§threshold: Option<usize>See with_threshold.
See with_max_subshares.
timeouts: Option<TimeoutsConfig>See with_timeouts.
Merged per field; see TimeoutsConfig.
parameter_range: Option<ParameterRange>See with_parameter_range.
auto_accept: Option<AutoAcceptPolicy>See with_auto_accept.
auto_respond_on_failure: Option<bool>§auto_reply_to: Option<bool>See with_auto_reply_to.
unpair_ack: Option<UnpairAck>See with_unpair_ack.
unsafe_connection: Option<bool>§communication_info: Option<HashMap<String, String>>§own_transports: Option<Vec<TransportProtocol>>See with_own_transports.
An unknown protocol discriminant is rejected when the endpoint is
parsed; structural checks (URI length, control characters, scheme)
run later, at build().
replica_id: Option<u64>See with_replica_id.
min_protocol_version: Option<ProtocolVersion>Trait Implementations§
Source§impl Clone for DeRecProtocolConfig
impl Clone for DeRecProtocolConfig
Source§impl Debug for DeRecProtocolConfig
impl Debug for DeRecProtocolConfig
Source§impl Default for DeRecProtocolConfig
impl Default for DeRecProtocolConfig
Source§impl<'de> Deserialize<'de> for DeRecProtocolConfig
impl<'de> Deserialize<'de> for DeRecProtocolConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for DeRecProtocolConfig
impl PartialEq for DeRecProtocolConfig
Source§impl Serialize for DeRecProtocolConfig
impl Serialize for DeRecProtocolConfig
impl StructuralPartialEq for DeRecProtocolConfig
Auto Trait Implementations§
impl Forget for DeRecProtocolConfig
impl Freeze for DeRecProtocolConfig
impl Move for DeRecProtocolConfig
impl RefUnwindSafe for DeRecProtocolConfig
impl Send for DeRecProtocolConfig
impl Sync for DeRecProtocolConfig
impl Unpin for DeRecProtocolConfig
impl UnsafeUnpin for DeRecProtocolConfig
impl UnwindSafe for DeRecProtocolConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more