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§

Provided Methods§

source

fn reset()

Attempt to remove all items from all the associated maps.

source

fn add_code(code_and_id: CodeAndId, metadata: CodeMetadata) -> Result<(), Error>

source

fn update_code(code_and_id: InstrumentedCodeAndId)

Update the corresponding code in the storage.

source

fn exists(code_id: CodeId) -> bool

source

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.

source

fn get_code(code_id: CodeId) -> Option<InstrumentedCode>

source

fn get_code_len(code_id: CodeId) -> Option<u32>

source

fn get_original_code(code_id: CodeId) -> Option<Vec<u8>>

source

fn get_metadata(code_id: CodeId) -> Option<CodeMetadata>

Object Safety§

This trait is not object safe.

Implementors§