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 suppliedResourceId
changes to the data store for the associated tasks.applyReversePathChangeToResource
(UnixFSTransactionProgramExecutionPhase executionPhase, ResourceId resourceId) Applies the suppliedResourceId
changes to the data store.applyReversePathChangeToResource
(UnixFSTransactionProgramExecutionPhase executionPhase, Path path) Applies the changes for the suppliedPath
to the data store.cleanupResource
(UnixFSTransactionProgramExecutionPhase executionPhase, ResourceId resourceId) Cleans up the suppliedResourceId
changes from the data store.cleanupResource
(UnixFSTransactionProgramExecutionPhase executionPhase, Path path) Cleans up the suppliedPath
changes 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 toByteBuffer
containing the program's instructions.Gets theByteBuffer
to store the program contents.Gets theUnixFSChecksumAlgorithm
used to commit the program.Gets the revision to write.Gets the transaction ID.withByteBuffer
(ByteBuffer byteBuffer) Specifies theByteBuffer
which will hold the program's code.withChecksumAlgorithm
(UnixFSChecksumAlgorithm checksumAlgorithm) Specifies theUnixFSChecksumAlgorithm
to use to guarantee the program's integrity.withNodeId
(NodeId nodeId) Specifies theNodeId
to 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 theByteBuffer
which will hold the program's code.- Parameters:
byteBuffer
- theByteBuffer
to hold the program's code.- Returns:
- this instance
-
withChecksumAlgorithm
public UnixFSTransactionProgramBuilder withChecksumAlgorithm(UnixFSChecksumAlgorithm checksumAlgorithm) Specifies theUnixFSChecksumAlgorithm
to use to guarantee the program's integrity.- Parameters:
checksumAlgorithm
- theUnixFSChecksumAlgorithm
to use- Returns:
- this instance
-
applyReversePathChangeToResource
public UnixFSTransactionProgramBuilder applyReversePathChangeToResource(UnixFSTransactionProgramExecutionPhase executionPhase, Path path) Applies the changes for the suppliedPath
to the data store.- Parameters:
executionPhase
- the execution phase to usepath
- thePath
to 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
- theResourceId
to apply- Returns:
- this instance
-
applyReversePathChangeToResource
public UnixFSTransactionProgramBuilder applyReversePathChangeToResource(UnixFSTransactionProgramExecutionPhase executionPhase, ResourceId resourceId) Applies the suppliedResourceId
changes to the data store.- Parameters:
executionPhase
- the execution phase to useresourceId
- theResourceId
to apply- Returns:
- this instance
-
applyChangeToTasks
public UnixFSTransactionProgramBuilder applyChangeToTasks(UnixFSTransactionProgramExecutionPhase executionPhase, ResourceId resourceId) Applies the suppliedResourceId
changes to the data store for the associated tasks.- Parameters:
executionPhase
- the execution phase to useresourceId
- thePath
to apply- Returns:
- this instance
-
cleanupResource
public UnixFSTransactionProgramBuilder cleanupResource(UnixFSTransactionProgramExecutionPhase executionPhase, Path path) Cleans up the suppliedPath
changes from the data store.- Parameters:
executionPhase
- the execution phase to usepath
- thePath
to apply- Returns:
- this instance
-
cleanupResource
public UnixFSTransactionProgramBuilder cleanupResource(UnixFSTransactionProgramExecutionPhase executionPhase, ResourceId resourceId) Cleans up the suppliedResourceId
changes from the data store.- Parameters:
executionPhase
- the execution phase to useresourceId
- thePath
to 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 toByteBuffer
containing 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 theByteBuffer
to store the program contents.- Returns:
- the
ByteBuffer
-
getTransactionId
Gets the transaction ID.- Returns:
- the transaction id
-
getChecksumAlgorithm
Gets theUnixFSChecksumAlgorithm
used to commit the program.- Returns:
- the
UnixFSChecksumAlgorithm
-