pallet_stateful_storage_runtime_api/
lib.rs

1#![cfg_attr(not(feature = "std"), no_std)]
2#![allow(clippy::too_many_arguments)]
3#![allow(clippy::unnecessary_mut_passed)]
4#![allow(rustdoc::bare_urls)]
5// Strong Documentation Lints
6#![deny(
7	rustdoc::broken_intra_doc_links,
8	rustdoc::missing_crate_level_docs,
9	rustdoc::invalid_codeblock_attributes,
10	missing_docs
11)]
12
13//! Runtime API definition for [Stateful  Storage](../pallet_stateful_storage/index.html)
14//!
15//! This api must be implemented by the node runtime.
16//! Runtime APIs Provide:
17//! - An interface between the runtime and Custom RPCs.
18//! - Runtime interfaces for end users beyond just State Queries
19
20use common_primitives::{
21	msa::MessageSourceId,
22	schema::SchemaId,
23	stateful_storage::{ItemizedStoragePageResponse, PaginatedStorageResponse},
24};
25use sp_runtime::DispatchError;
26extern crate alloc;
27use alloc::vec::Vec;
28
29// Here we declare the runtime API. It is implemented it the `impl` block in
30// runtime files (the `runtime` folder)
31sp_api::decl_runtime_apis! {
32
33	/// Runtime Version for Stateful Storage
34	/// - MUST be incremented if anything changes
35	/// - See: https://paritytech.github.io/polkadot/doc/polkadot_primitives/runtime_api/index.html
36	#[api_version(1)]
37
38	/// Runtime APIs for [Stateful Storage](../pallet_stateful_storage/index.html)
39	pub trait StatefulStorageRuntimeApi
40	{
41		/// Retrieve the paginated storage for a particular msa and schema
42		fn get_paginated_storage(msa_id: MessageSourceId, schema_id: SchemaId) -> Result<Vec<PaginatedStorageResponse>, DispatchError>;
43		/// Retrieve the itemized storage for a particular msa and schema
44		fn get_itemized_storage(msa_id: MessageSourceId, schema_id: SchemaId) -> Result<ItemizedStoragePageResponse, DispatchError>;
45	}
46}