public class SplitFileInserterStorage
extends java.lang.Object
Constructor and Description |
---|
SplitFileInserterStorage(LockableRandomAccessBuffer raf,
LockableRandomAccessBuffer originalData,
SplitFileInserterStorageCallback callback,
java.util.Random random,
MemoryLimitedJobRunner memoryLimitedJobRunner,
PersistentJobRunner jobRunner,
Ticker ticker,
KeysFetchingLocally keysFetching,
FilenameGenerator persistentFG,
PersistentFileTracker persistentFileTracker,
MasterSecret masterKey)
Create a splitfile insert from stored data.
|
SplitFileInserterStorage(LockableRandomAccessBuffer originalData,
long decompressedLength,
SplitFileInserterStorageCallback callback,
Compressor.COMPRESSOR_TYPE compressionCodec,
ClientMetadata meta,
boolean isMetadata,
ArchiveManager.ARCHIVE_TYPE archiveType,
LockableRandomAccessBufferFactory rafFactory,
boolean persistent,
InsertContext ctx,
byte splitfileCryptoAlgorithm,
byte[] splitfileCryptoKey,
byte[] hashThisLayerOnly,
HashResult[] hashes,
BucketFactory bf,
ChecksumChecker checker,
java.util.Random random,
MemoryLimitedJobRunner memoryLimitedJobRunner,
PersistentJobRunner jobRunner,
Ticker ticker,
KeysFetchingLocally keysFetching,
boolean topDontCompress,
int topRequiredBlocks,
int topTotalBlocks,
long origDataSize,
long origCompressedDataSize)
Create a SplitFileInserterStorage.
|
Modifier and Type | Method and Description |
---|---|
void |
addFailure(InsertException e) |
freenet.client.async.SplitFileInserterSegmentStorage.BlockInsert |
chooseBlock()
Choose a block to insert.
|
void |
clearCooldown() |
long |
countAllKeys() |
int |
countEncodedCrossSegments() |
int |
countEncodedSegments() |
long |
countSendableKeys() |
void |
failFatalErrorInBlock() |
void |
failOnDiskError(java.io.IOException e) |
void |
failTooManyRetriesInBlock() |
long |
getOffsetSegmentStatus(int segNo) |
freenet.client.async.SplitFileInserterStorage.Status |
getStatus() |
int |
getTotalBlockCount() |
long |
getWakeupTime(ClientContext context,
long now) |
boolean |
hasFinished() |
boolean |
hasSplitfileKey() |
protected boolean |
isFinishing() |
void |
lazyWriteMetadata() |
boolean |
noBlocksToSend() |
void |
onFinishedEncoding(SplitFileInserterCrossSegmentStorage completed)
Called when a cross-segment finishes encoding blocks.
|
void |
onFinishedEncoding(SplitFileInserterSegmentStorage completed)
Called when a segment finishes encoding blocks.
|
void |
onHasKeys(SplitFileInserterSegmentStorage splitFileInserterSegmentStorage) |
void |
onResume(ClientContext context) |
byte[] |
readCheckBlock(int segNo,
int checkBlockNo) |
byte[] |
readSegmentCheckBlock(int segNo,
int checkBlockNo) |
byte[] |
readSegmentDataBlock(int segNo,
int blockNo) |
void |
segmentSucceeded(SplitFileInserterSegmentStorage completedSegment)
Called when a segment completes.
|
void |
start() |
int |
totalCrossCheckBlocks() |
void |
writeSegmentCheckBlock(int segNo,
int checkBlockNo,
byte[] buf) |
public SplitFileInserterStorage(LockableRandomAccessBuffer originalData, long decompressedLength, SplitFileInserterStorageCallback callback, Compressor.COMPRESSOR_TYPE compressionCodec, ClientMetadata meta, boolean isMetadata, ArchiveManager.ARCHIVE_TYPE archiveType, LockableRandomAccessBufferFactory rafFactory, boolean persistent, InsertContext ctx, byte splitfileCryptoAlgorithm, byte[] splitfileCryptoKey, byte[] hashThisLayerOnly, HashResult[] hashes, BucketFactory bf, ChecksumChecker checker, java.util.Random random, MemoryLimitedJobRunner memoryLimitedJobRunner, PersistentJobRunner jobRunner, Ticker ticker, KeysFetchingLocally keysFetching, boolean topDontCompress, int topRequiredBlocks, int topTotalBlocks, long origDataSize, long origCompressedDataSize) throws java.io.IOException, InsertException
originalData
- The original data as a RandomAccessBuffer. We need to be able
to read single blocks.rafFactory
- A factory (persistent or not as appropriate) used to create
the temporary RAF storing check blocks etc.bf
- A temporary Bucket factory used for temporarily storing the
cross-segment settings.topRequiredBlocks
- The minimum number of blocks needed to fetch the content, so far.
We will add to this for the final metadata.java.io.IOException
InsertException
public SplitFileInserterStorage(LockableRandomAccessBuffer raf, LockableRandomAccessBuffer originalData, SplitFileInserterStorageCallback callback, java.util.Random random, MemoryLimitedJobRunner memoryLimitedJobRunner, PersistentJobRunner jobRunner, Ticker ticker, KeysFetchingLocally keysFetching, FilenameGenerator persistentFG, PersistentFileTracker persistentFileTracker, MasterSecret masterKey) throws java.io.IOException, StorageFormatException, ChecksumFailedException, ResumeFailedException
raf
- The file the insert was stored to. Caller must resume it before calling constructor.originalData
- The original data to be inserted. Caller must resume it before calling constructor.callback
- The parent callback (e.g. SplitFileInserter).random
- memoryLimitedJobRunner
- jobRunner
- ticker
- keysFetching
- persistentFG
- persistentFileTracker
- masterKey
- java.io.IOException
StorageFormatException
ChecksumFailedException
ResumeFailedException
public void start()
public int countEncodedSegments()
public int countEncodedCrossSegments()
public void onFinishedEncoding(SplitFileInserterCrossSegmentStorage completed)
completed
- public void onFinishedEncoding(SplitFileInserterSegmentStorage completed)
completed
- public void onHasKeys(SplitFileInserterSegmentStorage splitFileInserterSegmentStorage)
public boolean hasSplitfileKey()
public byte[] readCheckBlock(int segNo, int checkBlockNo) throws java.io.IOException
java.io.IOException
public byte[] readSegmentDataBlock(int segNo, int blockNo) throws java.io.IOException
java.io.IOException
public void writeSegmentCheckBlock(int segNo, int checkBlockNo, byte[] buf) throws java.io.IOException
java.io.IOException
public byte[] readSegmentCheckBlock(int segNo, int checkBlockNo) throws java.io.IOException
java.io.IOException
public int totalCrossCheckBlocks()
public void segmentSucceeded(SplitFileInserterSegmentStorage completedSegment)
public void addFailure(InsertException e)
public void failOnDiskError(java.io.IOException e)
public void failFatalErrorInBlock()
public void failTooManyRetriesInBlock()
public boolean hasFinished()
public freenet.client.async.SplitFileInserterStorage.Status getStatus()
public void lazyWriteMetadata()
protected boolean isFinishing()
public long getOffsetSegmentStatus(int segNo)
public void onResume(ClientContext context) throws ResumeFailedException
ResumeFailedException
public freenet.client.async.SplitFileInserterSegmentStorage.BlockInsert chooseBlock()
public boolean noBlocksToSend()
public long countAllKeys()
public long countSendableKeys()
public int getTotalBlockCount()
public void clearCooldown()
public long getWakeupTime(ClientContext context, long now)