CodeStorage

Trait CodeStorage 

Source
pub trait CodeStorage {
    type InstrumentedCodeMap: MapStorage<Key = CodeId, Value = InstrumentedCode>;
    type OriginalCodeMap: MapStorage<Key = CodeId, Value = Vec<u8>>;
    type CodeMetadataMap: MapStorage<Key = CodeId, Value = CodeMetadata>;

    // Provided methods
    fn reset() { ... }
    fn add_code(code_and_id: CodeAndId) -> Result<(), Error> { ... }
    fn update_instrumented_code_and_metadata(
        code_id: CodeId,
        instrumented_code_and_metadata: InstrumentedCodeAndMetadata,
    ) { ... }
    fn update_code_metadata(code_id: CodeId, metadata: CodeMetadata) { ... }
    fn original_code_exists(code_id: CodeId) -> bool { ... }
    fn instrumented_code_exists(code_id: CodeId) -> bool { ... }
    fn remove_code(code_id: CodeId) -> bool { ... }
    fn get_instrumented_code(code_id: CodeId) -> Option<InstrumentedCode> { ... }
    fn get_original_code(code_id: CodeId) -> Option<Vec<u8>> { ... }
    fn get_code_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) -> Result<(), Error>

Add the code to the storage.

Source

fn update_instrumented_code_and_metadata( code_id: CodeId, instrumented_code_and_metadata: InstrumentedCodeAndMetadata, )

Update the corresponding code and metadata in the storage.

Source

fn update_code_metadata(code_id: CodeId, metadata: CodeMetadata)

Update the corresponding metadata in the storage.

Source

fn original_code_exists(code_id: CodeId) -> bool

Returns true if the original code associated with given id exists.

Source

fn instrumented_code_exists(code_id: CodeId) -> bool

Returns true if the instrumented code associated with given id exists.

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_instrumented_code(code_id: CodeId) -> Option<InstrumentedCode>

Source

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

Source

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§