Class EncryptContainerOperation

java.lang.Object
org.apache.derby.impl.store.raw.data.EncryptContainerOperation
All Implemented Interfaces:
Externalizable, Serializable, Formatable, TypedFormat, Loggable, Undoable

public class EncryptContainerOperation extends Object implements Undoable
Log operation to encrypt a container with a new encryption key or to encrypt an unencrypted container while configuring the database for encryption. Container is synced to the disk when encryption is is successful, there is nothing to do on a redo. If there is crash/error while configuring a database for encryption; original version of the container is put back during undo.
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • writeExternal

      public void writeExternal(ObjectOutput out) throws IOException
      Specified by:
      writeExternal in interface Externalizable
      Throws:
      IOException
    • readExternal

      public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
      Specified by:
      readExternal in interface Externalizable
      Throws:
      IOException
      ClassNotFoundException
    • getPreparedLog

      public ByteArray getPreparedLog()
      the default for prepared log is always null for all the operations that don't have optionalData. If an operation has optional data, the operation need to prepare the optional data for this method. Encrypt Operation has no optional data to write out
      Specified by:
      getPreparedLog in interface Loggable
    • releaseResource

      public void releaseResource(Transaction tran)
      Description copied from interface: Loggable
      Release any resource that was acquired for doMe for rollback or recovery redo. This resource is acquired in either generateUndo (if this is a compensation operation during run time rollback or recovery rollback) or in needsRedo (if this is during recovery redo). The run time transaction context should have all the resource already acquird for run time roll forward, so there is no need to releaseResource during run time roll forward. This method must be safe to be called multiple times.
      Specified by:
      releaseResource in interface Loggable
    • group

      public int group()
      A space operation is a RAWSTORE log record
      Specified by:
      group in interface Loggable
    • needsRedo

      public boolean needsRedo(Transaction xact) throws StandardException
      Check if this operation needs to be redone during recovery redo. Returns true if this op should be redone during recovery redo,
      Specified by:
      needsRedo in interface Loggable
      Parameters:
      xact - the transaction that is doing the rollback
      Returns:
      true, if this operation needs to be redone during recovery.
      Throws:
      StandardException - Standard Derby error policy
      See Also:
    • getTypeFormatId

      public int getTypeFormatId()
      Return my format identifier.
      Specified by:
      getTypeFormatId in interface TypedFormat
      Returns:
      The identifier. (A UUID stuffed in an array of 16 bytes).
    • doMe

      public final void doMe(Transaction tran, LogInstant instant, LimitObjectInput in) throws StandardException
      Containers are not encryped on a redo. Nothing to do in this method.
      Specified by:
      doMe in interface Loggable
      Parameters:
      tran - transaction doing the operation.
      instant - log instant for this operation.
      in - unused by this log operation.
      Throws:
      StandardException - Standard Derby error policy
    • undoMe

      public void undoMe(Transaction tran) throws StandardException
      Undo of encrytpion of the container. Original version of the container that existed before the start of the database encryption is put back.
      Parameters:
      tran - the transaction that is undoing this operation
      Throws:
      StandardException - Standard Derby error policy
    • generateUndo

      public Compensation generateUndo(Transaction tran, LimitObjectInput in) throws StandardException
      Generate a Compensation (EncryptContainerUndoOperation) that will rollback the changes made to the container during container encryption.
      Specified by:
      generateUndo in interface Undoable
      Parameters:
      tran - the transaction doing the compensating
      in - optional input; not used by this operation.
      Returns:
      the compensation operation that will rollback this change, or null if nothing to undo.
      Throws:
      StandardException - Standard Derby error policy
      See Also:
    • toString

      public String toString()
      debug
      Overrides:
      toString in class Object