pub trait PausedProgramStorage: ProgramStorage {
    type PausedProgramMap: MapStorage<Key = ProgramId, Value = (Self::BlockNumber, H256)>;
    type CodeStorage: CodeStorage;
    type NonceStorage: ValueStorage<Value = SessionId>;
    type ResumeSessions: MapStorage<Key = SessionId, Value = ResumeSession<Self::AccountId, Self::BlockNumber>>;

    // Provided methods
    fn reset() { ... }
    fn paused_program_exists(program_id: &ProgramId) -> bool { ... }
    fn pause_program(
        program_id: ProgramId,
        block_number: Self::BlockNumber
    ) -> Result<GasReservationMap, Self::Error> { ... }
    fn resume_session_init(
        user: Self::AccountId,
        end_block: Self::BlockNumber,
        program_id: ProgramId,
        allocations: BTreeSet<WasmPage>,
        code_hash: CodeId
    ) -> Result<SessionId, Self::Error> { ... }
    fn resume_session_page_count(session_id: &SessionId) -> Option<u32> { ... }
    fn resume_session_push(
        session_id: SessionId,
        user: Self::AccountId,
        memory_pages: Vec<(GearPage, PageBuf)>
    ) -> Result<(), Self::Error> { ... }
    fn resume_session_commit(
        session_id: SessionId,
        user: Self::AccountId,
        expiration_block: Self::BlockNumber
    ) -> Result<ResumeResult<Self::BlockNumber>, Self::Error> { ... }
    fn remove_resume_session(session_id: SessionId) -> Result<(), Self::Error> { ... }
}
Expand description

Trait to pause/resume programs.

Required Associated Types§

Provided Methods§

source

fn reset()

Attempt to remove all items from all the associated maps.

source

fn paused_program_exists(program_id: &ProgramId) -> bool

Does the paused program (explicitly) exist in storage?

source

fn pause_program( program_id: ProgramId, block_number: Self::BlockNumber ) -> Result<GasReservationMap, Self::Error>

Pause an active program with the given key program_id.

Return corresponding map with gas reservations if the program was paused.

source

fn resume_session_init( user: Self::AccountId, end_block: Self::BlockNumber, program_id: ProgramId, allocations: BTreeSet<WasmPage>, code_hash: CodeId ) -> Result<SessionId, Self::Error>

Create a session for program resume. Returns the session id on success.

source

fn resume_session_page_count(session_id: &SessionId) -> Option<u32>

Get the count of uploaded memory pages of the specified session.

source

fn resume_session_push( session_id: SessionId, user: Self::AccountId, memory_pages: Vec<(GearPage, PageBuf)> ) -> Result<(), Self::Error>

Append program memory pages to the session data.

source

fn resume_session_commit( session_id: SessionId, user: Self::AccountId, expiration_block: Self::BlockNumber ) -> Result<ResumeResult<Self::BlockNumber>, Self::Error>

Finish program resume session with the given key session_id.

source

fn remove_resume_session(session_id: SessionId) -> Result<(), Self::Error>

Remove all data created by a call to resume_session_init.

Object Safety§

This trait is not object safe.

Implementors§