diff options
author | Simon Rettberg | 2018-05-11 17:35:51 +0200 |
---|---|---|
committer | Simon Rettberg | 2018-05-11 17:35:51 +0200 |
commit | 8cf60948213a141b86e9a7128359545040f97276 (patch) | |
tree | 20662a196e92717b2b1147c586b946472e9471d1 /src/main/java/org/openslx/filetransfer/LocalChunkSource.java | |
parent | Do what the javadoc says... (diff) | |
download | master-sync-shared-8cf60948213a141b86e9a7128359545040f97276.tar.gz master-sync-shared-8cf60948213a141b86e9a7128359545040f97276.tar.xz master-sync-shared-8cf60948213a141b86e9a7128359545040f97276.zip |
Support copying existing chunks server side
Can speed up uploads if the storage backend is fast enough.
Diffstat (limited to 'src/main/java/org/openslx/filetransfer/LocalChunkSource.java')
-rw-r--r-- | src/main/java/org/openslx/filetransfer/LocalChunkSource.java | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/main/java/org/openslx/filetransfer/LocalChunkSource.java b/src/main/java/org/openslx/filetransfer/LocalChunkSource.java new file mode 100644 index 0000000..c6f5fc3 --- /dev/null +++ b/src/main/java/org/openslx/filetransfer/LocalChunkSource.java @@ -0,0 +1,42 @@ +package org.openslx.filetransfer; + +import java.util.ArrayList; +import java.util.List; + +public interface LocalChunkSource +{ + + public static class ChunkSource + { + public final List<SourceFile> sourceCandidates; + public final byte[] sha1sum; + + public ChunkSource( byte[] sha1sum ) + { + this.sha1sum = sha1sum; + this.sourceCandidates = new ArrayList<>(); + } + + public void addFile( String file, long offset, int size ) + { + this.sourceCandidates.add( new SourceFile( file, offset, size ) ); + } + } + + public List<ChunkSource> getCloneSources( List<byte[]> sums ); + + public static class SourceFile + { + public final String fileName; + public final long offset; + public final int chunkSize; + + public SourceFile( String file, long offset, int size ) + { + this.fileName = file; + this.offset = offset; + this.chunkSize = size; + } + } + +} |