pub struct Package { /* private fields */ }
Expand description
Entity definition, metadata, and security container.
Implementations§
Source§impl Package
impl Package
Sourcepub fn new(
versions: EntityVersions,
disabled_versions: BTreeSet<EntityVersionKey>,
groups: Groups,
lock_status: PackageStatus,
) -> Self
pub fn new( versions: EntityVersions, disabled_versions: BTreeSet<EntityVersionKey>, groups: Groups, lock_status: PackageStatus, ) -> Self
Create new Package
(with no versions) from given access key.
Sourcepub fn enable_version(&mut self, entity_addr: EntityAddr) -> Result<(), Error>
pub fn enable_version(&mut self, entity_addr: EntityAddr) -> Result<(), Error>
Enable the entity version corresponding to the given hash (if it exists).
Sourcepub fn groups_mut(&mut self) -> &mut Groups
pub fn groups_mut(&mut self) -> &mut Groups
Get the mutable group definitions for this entity.
Sourcepub fn add_group(&mut self, group: Group, urefs: BTreeSet<URef>)
pub fn add_group(&mut self, group: Group, urefs: BTreeSet<URef>)
Adds new group to this entity.
Sourcepub fn lookup_entity_hash(
&self,
entity_version_key: EntityVersionKey,
) -> Option<&EntityAddr>
pub fn lookup_entity_hash( &self, entity_version_key: EntityVersionKey, ) -> Option<&EntityAddr>
Lookup the entity hash for a given entity version (if present)
Sourcepub fn is_version_missing(&self, entity_version_key: EntityVersionKey) -> bool
pub fn is_version_missing(&self, entity_version_key: EntityVersionKey) -> bool
Checks if the given entity version exists.
Sourcepub fn is_version_enabled(&self, entity_version_key: EntityVersionKey) -> bool
pub fn is_version_enabled(&self, entity_version_key: EntityVersionKey) -> bool
Checks if the given entity version exists and is available for use.
Sourcepub fn is_entity_enabled(&self, entity_hash: &EntityAddr) -> bool
pub fn is_entity_enabled(&self, entity_hash: &EntityAddr) -> bool
Returns true
if the given entity hash exists and is enabled.
Sourcepub fn insert_entity_version(
&mut self,
protocol_version_major: u32,
entity_hash: EntityAddr,
) -> EntityVersionKey
pub fn insert_entity_version( &mut self, protocol_version_major: u32, entity_hash: EntityAddr, ) -> EntityVersionKey
Insert a new entity version; the next sequential version number will be issued.
Sourcepub fn disable_entity_version(
&mut self,
entity_hash: EntityAddr,
) -> Result<(), Error>
pub fn disable_entity_version( &mut self, entity_hash: EntityAddr, ) -> Result<(), Error>
Disable the entity version corresponding to the given hash (if it exists).
Sourcepub fn versions(&self) -> &EntityVersions
pub fn versions(&self) -> &EntityVersions
Returns reference to all of this entity’s versions.
Sourcepub fn enabled_versions(&self) -> EntityVersions
pub fn enabled_versions(&self) -> EntityVersions
Returns all of this entity’s enabled entity versions.
Sourcepub fn versions_mut(&mut self) -> &mut EntityVersions
pub fn versions_mut(&mut self) -> &mut EntityVersions
Returns mutable reference to all of this entity’s versions (enabled and disabled).
Sourcepub fn take_versions(self) -> EntityVersions
pub fn take_versions(self) -> EntityVersions
Consumes the object and returns all of this entity’s versions (enabled and disabled).
Sourcepub fn disabled_versions(&self) -> &BTreeSet<EntityVersionKey>
pub fn disabled_versions(&self) -> &BTreeSet<EntityVersionKey>
Returns all of this entity’s disabled versions.
Sourcepub fn disabled_versions_mut(&mut self) -> &mut BTreeSet<EntityVersionKey>
pub fn disabled_versions_mut(&mut self) -> &mut BTreeSet<EntityVersionKey>
Returns mut reference to all of this entity’s disabled versions.
Sourcepub fn remove_group(&mut self, group: &Group) -> bool
pub fn remove_group(&mut self, group: &Group) -> bool
Removes a group from this entity (if it exists).
Sourcepub fn next_entity_version_for(&self, protocol_version: u32) -> EntityVersion
pub fn next_entity_version_for(&self, protocol_version: u32) -> EntityVersion
Gets the next available entity version for the given protocol version
pub fn current_entity_version_for( &self, protocol_version: u32, ) -> EntityVersionKey
Sourcepub fn current_entity_version(&self) -> Option<EntityVersionKey>
pub fn current_entity_version(&self) -> Option<EntityVersionKey>
Return the entity version key for the newest enabled entity version.
Sourcepub fn current_entity_hash(&self) -> Option<EntityAddr>
pub fn current_entity_hash(&self) -> Option<EntityAddr>
Return the entity hash for the newest enabled entity version.
Sourcepub fn get_lock_status(&self) -> PackageStatus
pub fn get_lock_status(&self) -> PackageStatus
Return the package status itself
Trait Implementations§
Source§impl DataSize for Package
impl DataSize for Package
Source§const IS_DYNAMIC: bool = true
const IS_DYNAMIC: bool = true
true
, the type has a heap size that can vary at runtime, depending on the actual value.Source§const STATIC_HEAP_SIZE: usize = 0usize
const STATIC_HEAP_SIZE: usize = 0usize
IS_DYNAMIC
is false, this is
the total amount of heap memory occupied by the value. Otherwise this is a lower bound.Source§fn estimate_heap_size(&self) -> usize
fn estimate_heap_size(&self) -> usize
Source§impl<'de> Deserialize<'de> for Package
impl<'de> Deserialize<'de> for Package
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 From<ContractPackage> for Package
impl From<ContractPackage> for Package
Source§fn from(value: ContractPackage) -> Self
fn from(value: ContractPackage) -> Self
Source§impl From<Package> for StoredValue
impl From<Package> for StoredValue
Source§fn from(value: Package) -> StoredValue
fn from(value: Package) -> StoredValue
Source§impl JsonSchema for Package
impl JsonSchema for Package
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read moreSource§impl ToBytes for Package
impl ToBytes for Package
Source§fn serialized_length(&self) -> usize
fn serialized_length(&self) -> usize
Vec<u8>
which would be returned from a successful call to
to_bytes()
or into_bytes()
. The data is not actually serialized, so this call is
relatively cheap.Source§impl TryFrom<StoredValue> for Package
impl TryFrom<StoredValue> for Package
Source§type Error = TypeMismatch
type Error = TypeMismatch
impl Eq for Package
impl StructuralPartialEq for Package
Auto Trait Implementations§
impl Freeze for Package
impl RefUnwindSafe for Package
impl Send for Package
impl Sync for Package
impl Unpin for Package
impl UnwindSafe for Package
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> 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
key
and return true
if they are equal.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
key
and return true
if they are equal.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