diem_types/
move_resource.rs

1// Copyright (c) The Diem Core Contributors
2// SPDX-License-Identifier: Apache-2.0
3
4// Copyright 2021 Conflux Foundation. All rights reserved.
5// Conflux is free software and distributed under GNU General Public License.
6// See http://www.gnu.org/licenses/
7
8use crate::{access_path::AccessPath, transaction::Version};
9use anyhow::Result;
10
11// TODO combine with ConfigStorage
12pub trait MoveStorage {
13    /// Returns a vector of Move resources as serialized byte array
14    /// Order of resources returned matches the order of `access_path`
15    fn batch_fetch_resources(
16        &self, access_paths: Vec<AccessPath>,
17    ) -> Result<Vec<Vec<u8>>>;
18
19    /// Returns a vector of Move resources as serialized byte array from a
20    /// specified version of the database
21    /// Order of resources returned matches the order of `access_path`
22    fn batch_fetch_resources_by_version(
23        &self, access_paths: Vec<AccessPath>, version: Version,
24    ) -> Result<Vec<Vec<u8>>>;
25
26    /// Get the version on the latest transaction info.
27    fn fetch_synced_version(&self) -> Result<Version>;
28}