Trait gear_common::code_storage::CodeStorage
source · pub trait CodeStorage {
type InstrumentedCodeStorage: MapStorage<Key = CodeId, Value = InstrumentedCode>;
type InstrumentedLenStorage: MapStorage<Key = CodeId, Value = u32>;
type OriginalCodeStorage: MapStorage<Key = CodeId, Value = Vec<u8>>;
type MetadataStorage: MapStorage<Key = CodeId, Value = CodeMetadata>;
// Provided methods
fn reset() { ... }
fn add_code(
code_and_id: CodeAndId,
metadata: CodeMetadata,
) -> Result<(), Error> { ... }
fn update_code(code_and_id: InstrumentedCodeAndId) { ... }
fn exists(code_id: CodeId) -> bool { ... }
fn remove_code(code_id: CodeId) -> bool { ... }
fn get_code(code_id: CodeId) -> Option<InstrumentedCode> { ... }
fn get_code_len(code_id: CodeId) -> Option<u32> { ... }
fn get_original_code(code_id: CodeId) -> Option<Vec<u8>> { ... }
fn get_metadata(code_id: CodeId) -> Option<CodeMetadata> { ... }
}
Expand description
Trait to work with program binary codes in a storage.
Required Associated Types§
type InstrumentedCodeStorage: MapStorage<Key = CodeId, Value = InstrumentedCode>
type InstrumentedLenStorage: MapStorage<Key = CodeId, Value = u32>
type OriginalCodeStorage: MapStorage<Key = CodeId, Value = Vec<u8>>
type MetadataStorage: MapStorage<Key = CodeId, Value = CodeMetadata>
Provided Methods§
fn add_code(code_and_id: CodeAndId, metadata: CodeMetadata) -> Result<(), Error>
sourcefn update_code(code_and_id: InstrumentedCodeAndId)
fn update_code(code_and_id: InstrumentedCodeAndId)
Update the corresponding code in the storage.
fn exists(code_id: CodeId) -> bool
sourcefn remove_code(code_id: CodeId) -> bool
fn remove_code(code_id: CodeId) -> bool
Returns true if the code associated with given id was removed.
If there is no code for the given id then false is returned.
fn get_code(code_id: CodeId) -> Option<InstrumentedCode>
fn get_code_len(code_id: CodeId) -> Option<u32>
fn get_original_code(code_id: CodeId) -> Option<Vec<u8>>
fn get_metadata(code_id: CodeId) -> Option<CodeMetadata>
Object Safety§
This trait is not object safe.