public class SplitFileInserterSegmentStorage
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
SplitFileInserterSegmentStorage.MissingKeyException |
Constructor and Description |
---|
SplitFileInserterSegmentStorage(SplitFileInserterStorage parent,
java.io.DataInputStream dis,
int segNo,
int keyLength,
byte splitfileCryptoAlgorithm,
byte[] splitfileCryptoKey,
java.util.Random random,
int maxRetries,
int consecutiveRNFsCountAsSuccess,
KeysFetchingLocally keysFetching)
Create a segment from the fixed settings stored in the RAF by writeFixedSettings().
|
SplitFileInserterSegmentStorage(SplitFileInserterStorage parent,
int segNo,
boolean persistent,
int dataBlocks,
int checkBlocks,
int crossCheckBlocks,
int keyLength,
byte splitfileCryptoAlgorithm,
byte[] splitfileCryptoKey,
java.util.Random random,
int maxRetries,
int consecutiveRNFsCountAsSuccess,
KeysFetchingLocally keysFetching) |
Modifier and Type | Method and Description |
---|---|
boolean |
cancel()
Caller must check hasCompletedOrFailed() explicitly after calling cancel() on all
segments.
|
void |
checkKeys()
Called on startup to check which keys we actually have.
|
freenet.client.async.SplitFileInserterSegmentStorage.BlockInsert |
chooseBlock() |
int |
countSendableKeys() |
ClientCHKBlock |
encodeBlock(int blockNo) |
boolean |
hasCompletedOrFailed() |
boolean |
hasEncoded()
Has the segment encoded all check blocks and cross-check blocks?
|
boolean |
hasKeys() |
boolean |
hasSucceeded()
Has the segment completed all inserts?
Should not change once we reach this state, but might be possible in case of disk errors
causing losing keys etc.
|
boolean |
isFinishedEncoding() |
void |
onFailure(int blockNo,
InsertException e) |
void |
onInsertedBlock(int blockNo,
ClientCHK key)
Called when a block insert succeeds
|
byte[] |
readCheckBlock(int checkBlockNo) |
byte[] |
readDataBlock(int blockNo) |
void |
readStatus() |
void |
startEncode(short prio) |
int |
storedKeysLength() |
long |
storedStatusLength() |
void |
storeStatus(boolean force) |
java.lang.String |
toString() |
void |
writeFixedSettings(java.io.DataOutputStream dos) |
public SplitFileInserterSegmentStorage(SplitFileInserterStorage parent, int segNo, boolean persistent, int dataBlocks, int checkBlocks, int crossCheckBlocks, int keyLength, byte splitfileCryptoAlgorithm, byte[] splitfileCryptoKey, java.util.Random random, int maxRetries, int consecutiveRNFsCountAsSuccess, KeysFetchingLocally keysFetching)
public SplitFileInserterSegmentStorage(SplitFileInserterStorage parent, java.io.DataInputStream dis, int segNo, int keyLength, byte splitfileCryptoAlgorithm, byte[] splitfileCryptoKey, java.util.Random random, int maxRetries, int consecutiveRNFsCountAsSuccess, KeysFetchingLocally keysFetching) throws java.io.IOException, StorageFormatException
java.io.IOException
StorageFormatException
public void storeStatus(boolean force)
public void readStatus() throws java.io.IOException, ChecksumFailedException, StorageFormatException
java.io.IOException
ChecksumFailedException
StorageFormatException
public long storedStatusLength()
public void writeFixedSettings(java.io.DataOutputStream dos) throws java.io.IOException
java.io.IOException
public boolean hasKeys()
public void checkKeys()
public int storedKeysLength()
public byte[] readDataBlock(int blockNo) throws java.io.IOException
java.io.IOException
public byte[] readCheckBlock(int checkBlockNo) throws java.io.IOException
java.io.IOException
public void startEncode(short prio)
public boolean isFinishedEncoding()
public ClientCHKBlock encodeBlock(int blockNo) throws java.io.IOException
java.io.IOException
public boolean hasSucceeded()
public boolean hasEncoded()
public void onInsertedBlock(int blockNo, ClientCHK key)
public void onFailure(int blockNo, InsertException e)
public boolean hasCompletedOrFailed()
public boolean cancel()
public freenet.client.async.SplitFileInserterSegmentStorage.BlockInsert chooseBlock()
public int countSendableKeys()
public java.lang.String toString()
toString
in class java.lang.Object