summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/filetransfer/LocalChunkSource.java
blob: c6f5fc32e8f1c1691d480efeca91b4f4ace2e93b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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;
		}
	}

}