pub struct OnDiskStateView { /* private fields */ }

Implementations§

source§

impl OnDiskStateView

source

pub fn create<P: Into<PathBuf>>(build_dir: P, storage_dir: P) -> Result<Self>

Create an OnDiskStateView that reads/writes resource data and modules in storage_dir.

source

pub fn interface_files_dir(&self) -> Result<String>

source

pub fn build_dir(&self) -> &PathBuf

source

pub fn struct_layouts_dir(&self) -> PathBuf

source

pub fn is_resource_path(&self, p: &Path) -> bool

source

pub fn is_event_path(&self, p: &Path) -> bool

source

pub fn is_module_path(&self, p: &Path) -> bool

source

pub fn get_module_id(&self, p: &Path) -> Option<ModuleId>

Extract a module ID from a path

source

pub fn get_resource_bytes( &self, addr: AccountAddress, tag: StructTag ) -> Result<Option<Vec<u8>>>

Read the resource bytes stored on-disk at addr/tag

source

pub fn has_module(&self, module_id: &ModuleId) -> bool

Check if a module at addr/module_id exists

source

pub fn resolve_function( &self, module_id: &ModuleId, idx: u16 ) -> Result<Option<Identifier>>

Return the name of the function at idx in module_id

source

pub fn view_resource( &self, resource_path: &Path ) -> Result<Option<AnnotatedMoveStruct>>

Returns a deserialized representation of the resource value stored at resource_path. Returns Err if the path does not hold a resource value or the resource cannot be deserialized

source

pub fn view_events(&self, events_path: &Path) -> Result<Vec<AnnotatedMoveValue>>

source

pub fn view_module(module_path: &Path) -> Result<Option<String>>

source

pub fn view_script(script_path: &Path) -> Result<Option<String>>

source

pub fn delete_resource(&self, addr: AccountAddress, tag: StructTag) -> Result<()>

Delete resource stored on disk at the path addr/tag

source

pub fn save_resource( &self, addr: AccountAddress, tag: StructTag, bcs_bytes: &[u8] ) -> Result<()>

source

pub fn save_event( &self, event_key: &[u8], event_sequence_number: u64, event_type: TypeTag, event_data: Vec<u8> ) -> Result<()>

source

pub fn save_module(&self, module_id: &ModuleId, module_bytes: &[u8]) -> Result<()>

Save module on disk under the path module.address()/module.name()

source

pub fn save_layout_yaml( &self, id: StructTag, layout: &MoveStructLayout ) -> Result<()>

Save the YAML encoding layout on disk under build_dir/layouts/id.

source

pub fn save_modules<'a>( &self, modules: impl IntoIterator<Item = &'a (ModuleIdWithNamedAddress, Vec<u8>)>, named_address_values: BTreeMap<String, AddressBytes> ) -> Result<()>

Save all the modules in the local cache, re-generate mv_interfaces if required.

source

pub fn delete_module(&self, id: &ModuleId) -> Result<()>

source

pub fn resource_paths(&self) -> impl Iterator<Item = PathBuf> + '_

source

pub fn module_paths(&self) -> impl Iterator<Item = PathBuf> + '_

source

pub fn event_paths(&self) -> impl Iterator<Item = PathBuf> + '_

source

pub fn get_all_modules(&self) -> Result<Vec<CompiledModule>>

Build all modules in the self.storage_dir. Returns an Err if a module does not deserialize.

Trait Implementations§

source§

impl Debug for OnDiskStateView

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for OnDiskStateView

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl GetModule for OnDiskStateView

§

type Error = Error

source§

fn get_module_by_id( &self, id: &ModuleId ) -> Result<Option<CompiledModule>, Self::Error>

source§

impl ModuleResolver for OnDiskStateView

§

type Error = Error

source§

fn get_module( &self, module_id: &ModuleId ) -> Result<Option<Vec<u8>>, Self::Error>

source§

impl ResourceResolver for OnDiskStateView

§

type Error = Error

source§

fn get_resource( &self, address: &AccountAddress, struct_tag: &StructTag ) -> Result<Option<Vec<u8>>, Self::Error>

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<E, T> MoveResolver for Twhere T: ModuleResolver<Error = E> + ResourceResolver<Error = E> + ?Sized, E: Debug,

§

type Err = E

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more