#[non_exhaustive]pub struct ApprovalThresholdPolicy {
pub threshold_percentage: Option<i32>,
pub proposal_duration_in_hours: Option<i32>,
pub threshold_comparator: Option<ThresholdComparator>,
}
Expand description
A policy type that defines the voting rules for the network. The rules decide if a proposal is approved. Approval may be based on criteria such as the percentage of YES
votes and the duration of the proposal. The policy applies to all proposals and is specified when the network is created.
Applies only to Hyperledger Fabric.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.threshold_percentage: Option<i32>
The percentage of votes among all members that must be YES
for a proposal to be approved. For example, a ThresholdPercentage
value of 50
indicates 50%. The ThresholdComparator
determines the precise comparison. If a ThresholdPercentage
value of 50
is specified on a network with 10 members, along with a ThresholdComparator
value of GREATER_THAN
, this indicates that 6 YES
votes are required for the proposal to be approved.
proposal_duration_in_hours: Option<i32>
The duration from the time that a proposal is created until it expires. If members cast neither the required number of YES
votes to approve the proposal nor the number of NO
votes required to reject it before the duration expires, the proposal is EXPIRED
and ProposalActions
aren't carried out.
threshold_comparator: Option<ThresholdComparator>
Determines whether the vote percentage must be greater than the ThresholdPercentage
or must be greater than or equal to the ThresholdPercentage
to be approved.
Implementations§
source§impl ApprovalThresholdPolicy
impl ApprovalThresholdPolicy
sourcepub fn threshold_percentage(&self) -> Option<i32>
pub fn threshold_percentage(&self) -> Option<i32>
The percentage of votes among all members that must be YES
for a proposal to be approved. For example, a ThresholdPercentage
value of 50
indicates 50%. The ThresholdComparator
determines the precise comparison. If a ThresholdPercentage
value of 50
is specified on a network with 10 members, along with a ThresholdComparator
value of GREATER_THAN
, this indicates that 6 YES
votes are required for the proposal to be approved.
sourcepub fn proposal_duration_in_hours(&self) -> Option<i32>
pub fn proposal_duration_in_hours(&self) -> Option<i32>
The duration from the time that a proposal is created until it expires. If members cast neither the required number of YES
votes to approve the proposal nor the number of NO
votes required to reject it before the duration expires, the proposal is EXPIRED
and ProposalActions
aren't carried out.
sourcepub fn threshold_comparator(&self) -> Option<&ThresholdComparator>
pub fn threshold_comparator(&self) -> Option<&ThresholdComparator>
Determines whether the vote percentage must be greater than the ThresholdPercentage
or must be greater than or equal to the ThresholdPercentage
to be approved.
source§impl ApprovalThresholdPolicy
impl ApprovalThresholdPolicy
sourcepub fn builder() -> ApprovalThresholdPolicyBuilder
pub fn builder() -> ApprovalThresholdPolicyBuilder
Creates a new builder-style object to manufacture ApprovalThresholdPolicy
.
Trait Implementations§
source§impl Clone for ApprovalThresholdPolicy
impl Clone for ApprovalThresholdPolicy
source§fn clone(&self) -> ApprovalThresholdPolicy
fn clone(&self) -> ApprovalThresholdPolicy
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ApprovalThresholdPolicy
impl Debug for ApprovalThresholdPolicy
source§impl PartialEq for ApprovalThresholdPolicy
impl PartialEq for ApprovalThresholdPolicy
source§fn eq(&self, other: &ApprovalThresholdPolicy) -> bool
fn eq(&self, other: &ApprovalThresholdPolicy) -> bool
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for ApprovalThresholdPolicy
Auto Trait Implementations§
impl Freeze for ApprovalThresholdPolicy
impl RefUnwindSafe for ApprovalThresholdPolicy
impl Send for ApprovalThresholdPolicy
impl Sync for ApprovalThresholdPolicy
impl Unpin for ApprovalThresholdPolicy
impl UnwindSafe for ApprovalThresholdPolicy
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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