Class FileCheckpointer
java.lang.Object
org.hyperledger.fabric.client.FileCheckpointer
- All Implemented Interfaces:
AutoCloseable, Checkpoint, Checkpointer
Checkpointer implementation backed by persistent file storage.
It can be used to checkpoint progress after successfully processing events, allowing eventing to be resumed from this point.
-
Constructor Summary
ConstructorsConstructorDescriptionFileCheckpointer(Path path) To create a checkpointer instance backed by persistent file storage. -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckpointBlock(long blockNumber) Checkpoint a successfully processed block.voidCheckpoint a chaincode event.voidcheckpointTransaction(long blockNumber, String transactionID) Checkpoint a transaction within a block.voidclose()Releases the resources and closes the file channel.The block number in which the next event is expected.Transaction Id of the last successfully processed event within the current block.voidsync()Commits file changes to the storage device.
-
Constructor Details
-
FileCheckpointer
To create a checkpointer instance backed by persistent file storage.- Parameters:
path- Path of the file which has to store the checkpointer state.- Throws:
IOException- if the file cannot be opened, is unwritable, or contains invalid checkpointer state data.
-
-
Method Details
-
checkpointBlock
Description copied from interface:CheckpointerCheckpoint a successfully processed block.Note that the block number is an unsigned 64-bit integer, with the sign bit used to hold the top bit of the number.
- Specified by:
checkpointBlockin interfaceCheckpointer- Parameters:
blockNumber- a ledger block number.- Throws:
IOException- if an I/O error occurs.
-
checkpointTransaction
Description copied from interface:CheckpointerCheckpoint a transaction within a block.- Specified by:
checkpointTransactionin interfaceCheckpointer- Parameters:
blockNumber- a ledger block number.transactionID- transaction id within the block.- Throws:
IOException- if an I/O error occurs.
-
checkpointChaincodeEvent
Description copied from interface:CheckpointerCheckpoint a chaincode event.- Specified by:
checkpointChaincodeEventin interfaceCheckpointer- Parameters:
event- a chaincode event.- Throws:
IOException- if an I/O error occurs.
-
getBlockNumber
Description copied from interface:CheckpointThe block number in which the next event is expected.- Specified by:
getBlockNumberin interfaceCheckpoint- Returns:
- A ledger block number.
-
getTransactionId
Description copied from interface:CheckpointTransaction Id of the last successfully processed event within the current block.- Specified by:
getTransactionIdin interfaceCheckpoint- Returns:
- A transaction Id.
-
close
Releases the resources and closes the file channel.- Specified by:
closein interfaceAutoCloseable- Throws:
IOException- if an I/O error occurs.
-
sync
Commits file changes to the storage device.- Throws:
IOException- if an I/O error occurs.
-