rebane ImageIndex to ImageIndexWriter
This commit is contained in:
		@ -19,7 +19,7 @@ pub struct ImageIndexHeader {
 | 
			
		||||
 | 
			
		||||
// split image into fixed size chunks
 | 
			
		||||
 | 
			
		||||
pub struct ImageIndex<'a> {
 | 
			
		||||
pub struct ImageIndexWriter<'a> {
 | 
			
		||||
    store: &'a mut ChunkStore,
 | 
			
		||||
    chunk_size: usize,
 | 
			
		||||
    size: usize,
 | 
			
		||||
@ -28,7 +28,7 @@ pub struct ImageIndex<'a> {
 | 
			
		||||
    ctime: u64,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl <'a> ImageIndex<'a> {
 | 
			
		||||
impl <'a> ImageIndexWriter<'a> {
 | 
			
		||||
 | 
			
		||||
    pub fn create(store: &'a mut ChunkStore, path: &Path, size: usize) -> Result<Self, Error> {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -38,7 +38,7 @@ fn backup_file(param: Value, _info: &ApiMethod) -> Result<Value, Error> {
 | 
			
		||||
    if stat.st_size <= 0 { bail!("got strange file size '{}'", stat.st_size); }
 | 
			
		||||
    let size = stat.st_size as usize;
 | 
			
		||||
 | 
			
		||||
    let mut index = ImageIndex::create(&mut chunk_store, "test1.idx".as_ref(), size)?;
 | 
			
		||||
    let mut index = ImageIndexWriter::create(&mut chunk_store, "test1.idx".as_ref(), size)?;
 | 
			
		||||
 | 
			
		||||
    tools::file_chunker(file, 64*1024, |pos, chunk| {
 | 
			
		||||
        index.add_chunk(pos, chunk)?;
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user