Class EncryptContainerOperation

  • All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable, Formatable, TypedFormat, Loggable, Undoable

    public class EncryptContainerOperation
    extends java.lang.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:
    Undoable, Serialized Form
    Format IDLOGOP_ENCRYPT_CONTAINER the formatId is written by FormatIdOutputStream when this object is written out by writeObject
    Purpose
    to record enctyption of container with a new encryption key.
    Upgrade
    Disk LayoutcontainerId(ContainerKey) the id of the container this operation applies to
    • Method Detail

      • writeExternal

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

        public void readExternal​(java.io.ObjectInput in)
                          throws java.io.IOException,
                                 java.lang.ClassNotFoundException
        Specified by:
        readExternal in interface java.io.Externalizable
        Throws:
        java.io.IOException
        java.lang.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
      • 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
      • toString

        public java.lang.String toString()
        debug
        Overrides:
        toString in class java.lang.Object