pub struct GovernanceData {
pub version: u64,
pub members: BTreeMap<MemberName, PublicKey>,
pub roles_gov: RolesGov,
pub policies_gov: PolicyGov,
pub schemas: BTreeMap<SchemaType, Schema>,
pub roles_schema: BTreeMap<SchemaType, RolesSchema>,
pub roles_tracker_schemas: RolesTrackerSchemas,
pub policies_schema: BTreeMap<SchemaType, PolicySchema>,
}Fields§
§version: u64§members: BTreeMap<MemberName, PublicKey>§roles_gov: RolesGov§policies_gov: PolicyGov§schemas: BTreeMap<SchemaType, Schema>§roles_schema: BTreeMap<SchemaType, RolesSchema>§roles_tracker_schemas: RolesTrackerSchemas§policies_schema: BTreeMap<SchemaType, PolicySchema>Implementations§
Source§impl GovernanceData
impl GovernanceData
pub fn new(owner_key: PublicKey) -> Self
pub fn roles_update_remove_confirm( &self, old_owner_key: &PublicKey, new_owner_key: &PublicKey, ) -> RolesUpdateConfirm
pub fn roles_update_remove_fact( &self, remove_members: Option<HashSet<String>>, remove_schemas: Option<HashSet<SchemaType>>, ) -> RolesUpdateRemove
pub fn remove_schema(&mut self, remove_schemas: HashSet<SchemaType>)
pub fn add_schema(&mut self, add_schema: HashSet<SchemaType>)
pub fn remove_member_role(&mut self, remove_members: &Vec<MemberName>)
pub fn update_name_role(&mut self, old_name: String)
pub fn to_value_wrapper(&self) -> ValueWrapper
pub fn check_basic_gov(&self) -> bool
Sourcepub fn get_init_state(
&self,
schema_id: &SchemaType,
) -> Result<ValueWrapper, GovernanceError>
pub fn get_init_state( &self, schema_id: &SchemaType, ) -> Result<ValueWrapper, GovernanceError>
Get the initial state for GovernanceData model
§Arguments
schema_id- The identifier of theSchema.
§Returns
ValueWrapper- The initial state.
§Errors
GovernanceError- If the schema is not found.
Sourcepub fn has_this_role(&self, data: HashThisRole) -> bool
pub fn has_this_role(&self, data: HashThisRole) -> bool
Sourcepub fn get_signers(
&self,
role: RoleTypes,
schema_id: &SchemaType,
namespace: Namespace,
) -> (HashSet<PublicKey>, bool)
pub fn get_signers( &self, role: RoleTypes, schema_id: &SchemaType, namespace: Namespace, ) -> (HashSet<PublicKey>, bool)
pub fn get_witnesses( &self, data: WitnessesData, ) -> Result<HashSet<PublicKey>, GovernanceError>
Sourcepub fn get_quorum_and_signers(
&self,
role: ProtocolTypes,
schema_id: &SchemaType,
namespace: Namespace,
) -> Result<(HashSet<PublicKey>, Quorum), GovernanceError>
pub fn get_quorum_and_signers( &self, role: ProtocolTypes, schema_id: &SchemaType, namespace: Namespace, ) -> Result<(HashSet<PublicKey>, Quorum), GovernanceError>
pub fn schemas_name( &self, role: ProtocolTypes, key: &PublicKey, ) -> BTreeSet<SchemaType>
pub fn schemas_namespace( &self, role: ProtocolTypes, key: &PublicKey, ) -> BTreeMap<SchemaType, Vec<Namespace>>
pub fn schema_creators_namespace( &self, schema_namespaces: BTreeMap<SchemaType, Vec<Namespace>>, ) -> BTreeMap<SchemaType, BTreeMap<PublicKey, BTreeSet<Namespace>>>
pub fn governance_issuers(&self) -> (BTreeSet<PublicKey>, bool)
pub fn schema_issuers_namespace( &self, schema_namespaces: BTreeMap<SchemaType, Vec<Namespace>>, ) -> BTreeMap<SchemaType, (BTreeMap<PublicKey, BTreeSet<Namespace>>, bool)>
pub fn schemas( &self, role: ProtocolTypes, key: &PublicKey, ) -> BTreeMap<SchemaType, Schema>
pub fn schemas_init_value( &self, role: ProtocolTypes, key: &PublicKey, ) -> BTreeMap<SchemaType, ValueWrapper>
Trait Implementations§
Source§impl BorshDeserialize for GovernanceData
impl BorshDeserialize for GovernanceData
fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for GovernanceData
impl BorshSerialize for GovernanceData
Source§impl Clone for GovernanceData
impl Clone for GovernanceData
Source§fn clone(&self) -> GovernanceData
fn clone(&self) -> GovernanceData
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GovernanceData
impl Debug for GovernanceData
Source§impl Default for GovernanceData
impl Default for GovernanceData
Source§fn default() -> GovernanceData
fn default() -> GovernanceData
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for GovernanceData
impl<'de> Deserialize<'de> for GovernanceData
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for GovernanceData
impl PartialEq for GovernanceData
Source§impl Serialize for GovernanceData
impl Serialize for GovernanceData
Source§impl TryFrom<ValueWrapper> for GovernanceData
impl TryFrom<ValueWrapper> for GovernanceData
Source§type Error = GovernanceError
type Error = GovernanceError
The type returned in the event of a conversion error.
impl Eq for GovernanceData
impl StructuralPartialEq for GovernanceData
Auto Trait Implementations§
impl Freeze for GovernanceData
impl RefUnwindSafe for GovernanceData
impl Send for GovernanceData
impl Sync for GovernanceData
impl Unpin for GovernanceData
impl UnsafeUnpin for GovernanceData
impl UnwindSafe for GovernanceData
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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>
Converts
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>
Converts
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