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 [StatefulStorage](../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::{IntentId, SchemaId},
23	stateful_storage::{
24		ItemizedStoragePageResponse, ItemizedStoragePageResponseV2, PaginatedStorageResponse,
25		PaginatedStorageResponseV2,
26	},
27};
28use sp_runtime::DispatchError;
29extern crate alloc;
30use alloc::vec::Vec;
31
32// Here we declare the runtime API. It is implemented it the `impl` block in
33// runtime files (the `runtime` folder)
34sp_api::decl_runtime_apis! {
35
36	/// Runtime Version for Stateful Storage
37	/// - MUST be incremented if anything changes
38	/// - See: https://paritytech.github.io/polkadot/doc/polkadot_primitives/runtime_api/index.html
39	#[api_version(1)]
40
41	/// Runtime APIs for [Stateful Storage](../pallet_stateful_storage/index.html)
42	pub trait StatefulStorageRuntimeApi
43	{
44		/// Retrieve the paginated storage for a particular msa and schema
45		#[deprecated(note = "Use get_paginated_storage_v2 instead")]
46		fn get_paginated_storage(msa_id: MessageSourceId, schema_id: SchemaId) -> Result<Vec<PaginatedStorageResponse>, DispatchError>;
47		/// Retrieve the itemized storage for a particular msa and schema
48		#[deprecated(note = "Use get_itemized_storage_v2 instead")]
49		fn get_itemized_storage(msa_id: MessageSourceId, schema_id: SchemaId) -> Result<ItemizedStoragePageResponse, DispatchError>;
50
51		/// Retrieve the paginated storage for a particular msa and schema
52		#[api_version(2)]
53		fn get_paginated_storage_v2(msa_id: MessageSourceId, intent_id: IntentId) -> Result<Vec<PaginatedStorageResponseV2>, DispatchError>;
54		/// Retrieve the itemized storage for a particular msa and schema
55		#[api_version(2)]
56		fn get_itemized_storage_v2(msa_id: MessageSourceId, intent_id: IntentId) -> Result<ItemizedStoragePageResponseV2, DispatchError>;
57	}
58}