Skip to main content

GovernanceData

Struct GovernanceData 

Source
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

Source

pub fn new(owner_key: PublicKey) -> Self

Source

pub fn roles_update_remove_confirm( &self, old_owner_key: &PublicKey, new_owner_key: &PublicKey, ) -> RolesUpdateConfirm

Source

pub fn roles_update_remove_fact( &self, remove_members: Option<HashSet<String>>, remove_schemas: Option<HashSet<SchemaType>>, ) -> RolesUpdateRemove

Source

pub fn remove_schema(&mut self, remove_schemas: HashSet<SchemaType>)

Source

pub fn add_schema(&mut self, add_schema: HashSet<SchemaType>)

Source

pub fn remove_member_role(&mut self, remove_members: &Vec<MemberName>)

Source

pub fn update_name_role(&mut self, old_name: String)

Source

pub fn to_value_wrapper(&self) -> ValueWrapper

Source

pub fn check_basic_gov(&self) -> bool

Source

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 the Schema.
§Returns
§Errors
  • GovernanceError - If the schema is not found.
Source

pub fn has_this_role(&self, data: HashThisRole) -> bool

Check if the user has a role.

§Arguments
  • user - The user id.
  • [Roles] - The role.
  • schema - The schema id from Schema.
  • Namespace - The namespace.
Source

pub fn get_signers( &self, role: RoleTypes, schema_id: &SchemaType, namespace: Namespace, ) -> (HashSet<PublicKey>, bool)

Gets the signers for the request stage.

§Arguments
  • [Roles] - The role.
  • schema_id - The schema id from Schema.
  • Namespace - The namespace.
§Returns
  • (HashSet<PublicKey>, bool) - The set of key identifiers and a flag indicating if the user is not a member.
Source

pub fn get_witnesses( &self, data: WitnessesData, ) -> Result<HashSet<PublicKey>, GovernanceError>

Source

pub fn get_quorum_and_signers( &self, role: ProtocolTypes, schema_id: &SchemaType, namespace: Namespace, ) -> Result<(HashSet<PublicKey>, Quorum), GovernanceError>

Get the quorum and signers for the role and schema.

§Arguments
  • [Roles] - The role.
  • schema_id - The schema id from Schema.
  • Namespace - The namespace.
§Returns
  • (HashSet<PublicKey>, Quorum) - The set of key identifiers and the quorum.
Source

pub fn schemas_name( &self, role: ProtocolTypes, key: &PublicKey, ) -> BTreeSet<SchemaType>

Source

pub fn schemas_namespace( &self, role: ProtocolTypes, key: &PublicKey, ) -> BTreeMap<SchemaType, Vec<Namespace>>

Source

pub fn schema_creators_namespace( &self, schema_namespaces: BTreeMap<SchemaType, Vec<Namespace>>, ) -> BTreeMap<SchemaType, BTreeMap<PublicKey, BTreeSet<Namespace>>>

Source

pub fn governance_issuers(&self) -> (BTreeSet<PublicKey>, bool)

Source

pub fn schema_issuers_namespace( &self, schema_namespaces: BTreeMap<SchemaType, Vec<Namespace>>, ) -> BTreeMap<SchemaType, (BTreeMap<PublicKey, BTreeSet<Namespace>>, bool)>

Source

pub fn schemas( &self, role: ProtocolTypes, key: &PublicKey, ) -> BTreeMap<SchemaType, Schema>

Source

pub fn schemas_init_value( &self, role: ProtocolTypes, key: &PublicKey, ) -> BTreeMap<SchemaType, ValueWrapper>

Source

pub fn is_member(&self, key: &PublicKey) -> bool

Check if the key is a member.

Trait Implementations§

Source§

impl BorshDeserialize for GovernanceData

Source§

fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>

Source§

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>

Deserialize this instance from a slice of bytes.
Source§

fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>
where R: Read,

Source§

impl BorshSerialize for GovernanceData

Source§

fn serialize<__W: Write>(&self, writer: &mut __W) -> Result<(), Error>

Source§

impl Clone for GovernanceData

Source§

fn clone(&self) -> GovernanceData

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GovernanceData

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for GovernanceData

Source§

fn default() -> GovernanceData

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for GovernanceData

Source§

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

Source§

fn eq(&self, other: &GovernanceData) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for GovernanceData

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TryFrom<ValueWrapper> for GovernanceData

Source§

type Error = GovernanceError

The type returned in the event of a conversion error.
Source§

fn try_from(value: ValueWrapper) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Eq for GovernanceData

Source§

impl StructuralPartialEq for GovernanceData

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

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
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,