pub trait ImportExportBlocks {
fn export_blocks<'a>(
&self,
destination: Box<dyn Write + 'a>,
from: BlockId,
to: BlockId,
format: Option<DataFormat>
) -> Result<(), String>;
fn import_blocks<'a>(
&self,
source: Box<dyn Read + 'a>,
format: Option<DataFormat>
) -> Result<(), String>;
}
Expand description
Provides a method for importing/exporting blocks
Required methods
Export blocks to destination, with the given from, to and format argument. destination could be a file or stdout. If the format is hex, each block is written on a new line. For binary exports, all block data is written to the same line.
fn import_blocks<'a>(
&self,
source: Box<dyn Read + 'a>,
format: Option<DataFormat>
) -> Result<(), String>
fn import_blocks<'a>(
&self,
source: Box<dyn Read + 'a>,
format: Option<DataFormat>
) -> Result<(), String>
Import blocks from destination, with the given format argument Source could be a file or stdout. For hex format imports, it attempts to read the blocks on a line by line basis. For binary format imports, reads the 8 byte RLP header in order to decode the block length to be read.