Class UnixFSTransactionProgramBuilder
java.lang.Object
dev.getelements.elements.rt.transact.unix.UnixFSTransactionProgramBuilder
Used to compile a set of instructions into a
UnixFSTransactionProgram used for committing the requested
transactions to disk. This does no checking of the underlying database, and assumes that the calling code has
properly completed all pre-checks while building the code.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapplyChangeToResourceContents(UnixFSTransactionProgramExecutionPhase executionPhase, ResourceId resourceId) Applies the contents change ot the resource.applyChangeToTasks(UnixFSTransactionProgramExecutionPhase executionPhase, ResourceId resourceId) Applies the suppliedResourceIdchanges to the data store for the associated tasks.applyReversePathChangeToResource(UnixFSTransactionProgramExecutionPhase executionPhase, ResourceId resourceId) Applies the suppliedResourceIdchanges to the data store.applyReversePathChangeToResource(UnixFSTransactionProgramExecutionPhase executionPhase, Path path) Applies the changes for the suppliedPathto the data store.cleanupResource(UnixFSTransactionProgramExecutionPhase executionPhase, ResourceId resourceId) Cleans up the suppliedResourceIdchanges from the data store.cleanupResource(UnixFSTransactionProgramExecutionPhase executionPhase, Path path) Cleans up the suppliedPathchanges from the data store.cleanupTasksForResource(UnixFSTransactionProgramExecutionPhase executionPhase, ResourceId resourceId) Cleans up the tasks for the suppliedResourceId.compile(UnixFSTransactionProgramExecutionPhase... executionPhases) Compiles this program, setting the header values as well as writing the bytecode toByteBuffercontaining the program's instructions.Gets theByteBufferto store the program contents.Gets theUnixFSChecksumAlgorithmused to commit the program.Gets the revision to write.Gets the transaction ID.withByteBuffer(ByteBuffer byteBuffer) Specifies theByteBufferwhich will hold the program's code.withChecksumAlgorithm(UnixFSChecksumAlgorithm checksumAlgorithm) Specifies theUnixFSChecksumAlgorithmto use to guarantee the program's integrity.withNodeId(NodeId nodeId) Specifies theNodeIdto associate with the program.withTransactionId(String transactionId) Gets the id for the currently running transaction.
-
Constructor Details
-
UnixFSTransactionProgramBuilder
public UnixFSTransactionProgramBuilder()
-
-
Method Details
-
withNodeId
- Parameters:
nodeId- theNodeId- Returns:
- this instance
-
withTransactionId
Gets the id for the currently running transaction.- Parameters:
transactionId- the transaction id.- Returns:
- this instance
-
withByteBuffer
Specifies theByteBufferwhich will hold the program's code.- Parameters:
byteBuffer- theByteBufferto hold the program's code.- Returns:
- this instance
-
withChecksumAlgorithm
public UnixFSTransactionProgramBuilder withChecksumAlgorithm(UnixFSChecksumAlgorithm checksumAlgorithm) Specifies theUnixFSChecksumAlgorithmto use to guarantee the program's integrity.- Parameters:
checksumAlgorithm- theUnixFSChecksumAlgorithmto use- Returns:
- this instance
-
applyReversePathChangeToResource
public UnixFSTransactionProgramBuilder applyReversePathChangeToResource(UnixFSTransactionProgramExecutionPhase executionPhase, Path path) Applies the changes for the suppliedPathto the data store.- Parameters:
executionPhase- the execution phase to usepath- thePathto apply- Returns:
- this instance
-
applyChangeToResourceContents
public UnixFSTransactionProgramBuilder applyChangeToResourceContents(UnixFSTransactionProgramExecutionPhase executionPhase, ResourceId resourceId) Applies the contents change ot the resource.- Parameters:
executionPhase- the execution phase to useresourceId- theResourceIdto apply- Returns:
- this instance
-
applyReversePathChangeToResource
public UnixFSTransactionProgramBuilder applyReversePathChangeToResource(UnixFSTransactionProgramExecutionPhase executionPhase, ResourceId resourceId) Applies the suppliedResourceIdchanges to the data store.- Parameters:
executionPhase- the execution phase to useresourceId- theResourceIdto apply- Returns:
- this instance
-
applyChangeToTasks
public UnixFSTransactionProgramBuilder applyChangeToTasks(UnixFSTransactionProgramExecutionPhase executionPhase, ResourceId resourceId) Applies the suppliedResourceIdchanges to the data store for the associated tasks.- Parameters:
executionPhase- the execution phase to useresourceId- thePathto apply- Returns:
- this instance
-
cleanupResource
public UnixFSTransactionProgramBuilder cleanupResource(UnixFSTransactionProgramExecutionPhase executionPhase, Path path) Cleans up the suppliedPathchanges from the data store.- Parameters:
executionPhase- the execution phase to usepath- thePathto apply- Returns:
- this instance
-
cleanupResource
public UnixFSTransactionProgramBuilder cleanupResource(UnixFSTransactionProgramExecutionPhase executionPhase, ResourceId resourceId) Cleans up the suppliedResourceIdchanges from the data store.- Parameters:
executionPhase- the execution phase to useresourceId- thePathto apply- Returns:
- this instance
-
cleanupTasksForResource
public UnixFSTransactionProgramBuilder cleanupTasksForResource(UnixFSTransactionProgramExecutionPhase executionPhase, ResourceId resourceId) Cleans up the tasks for the suppliedResourceId.- Parameters:
executionPhase- the execution phaseresourceId- theResourceId- Returns:
- this instance
-
compile
Compiles this program, setting the header values as well as writing the bytecode toByteBuffercontaining the program's instructions. This does clear the checksum header, however, it does does not calculate the final checksum as that is part of the committing process.- Returns:
- a freshly compiled instance of
UnixFSTransactionProgram
-
getNodeId
Gets the revision to write.- Returns:
- the node id
-
getByteBuffer
Gets theByteBufferto store the program contents.- Returns:
- the
ByteBuffer
-
getTransactionId
Gets the transaction ID.- Returns:
- the transaction id
-
getChecksumAlgorithm
Gets theUnixFSChecksumAlgorithmused to commit the program.- Returns:
- the
UnixFSChecksumAlgorithm
-