Class Fork

  • All Implemented Interfaces:
    Access

    public final class Fork
    extends AbstractAccess
    A fork is a database access object, allowing both read and write operations.

    A fork represents the database state at the time it was created plus any changes to the database made using this fork.

    A fork allows to perform a transaction: a number of independent writes to the database, which then may be atomically applied (i.e. committed) to the database and change the database state.

    The Fork does not modify the index name upon address resolution.

    • Method Detail

      • newInstance

        public static Fork newInstance​(long nativeHandle,
                                       Cleaner cleaner)
        Creates a new owning Fork proxy.
        Parameters:
        nativeHandle - a handle of the native Fork object
        cleaner - a cleaner to perform any operations
      • newInstance

        public static Fork newInstance​(long nativeHandle,
                                       boolean owningHandle,
                                       Cleaner cleaner)
        Creates a new Fork proxy.
        Parameters:
        nativeHandle - a handle of the native Fork object
        owningHandle - whether a proxy owns the corresponding native object and is responsible to clean it up
        cleaner - a cleaner to destroy this fork and any dependent objects
      • getCleaner

        public Cleaner getCleaner()
        Description copied from class: AbstractAccess
        Returns the cleaner of this access. It is supposed to be used with collections and other objects depending on this access.
        Specified by:
        getCleaner in class AbstractAccess
      • createCheckpoint

        public void createCheckpoint()
        Creates in-memory checkpoint of the current state of this Fork. A checkpoint allows to restore the state of the Fork by reverting the changes made since the last checkpoint operation with rollback(). The changes made before the last checkpoint cannot be reverted, because each new checkpoint replaces the previous: checkpoints are not stacked.

        Creating a checkpoint will invalidate all collections that were instantiated with this fork.

        This operation is not intended to be used by services.

      • rollback

        public void rollback()
        Rollbacks changes to the latest checkpoint. If no checkpoints were created, rollbacks all changes made by this fork. Rollback affects only changes made with this particular Fork instance.

        Rollback will invalidate all collections that were created with this fork.

        This operation is not intended to be used by services.