com.workday.elasticrypt.translog

EncryptedFileChannel

class EncryptedFileChannel extends FileChannel

Two issues here: (1) AESReader should only be instantiated for existent files - maybe there should be an open method? (2) AESWriter should only be instantiated on non-existent files - does ES guarantee that for translog?

In any case, to support both, we have to at least lazily open AESReader and AESWriter only as needed.... Simply using lazy here seems too easy.

Class representing an EncryptedFileChannel that creates an AESReader and an AESWriter and reads files and writes to disk. Extension of java.nio.channels.FileChannel that instantiates an AESReader and AESWriter to encrypt all reads and writes. Utilized in EncryptedRafReference and EncryptedTranslogStream.

Linear Supertypes
FileChannel, ScatteringByteChannel, GatheringByteChannel, SeekableByteChannel, ByteChannel, WritableByteChannel, ReadableByteChannel, AbstractInterruptibleChannel, InterruptibleChannel, Channel, Closeable, AutoCloseable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. EncryptedFileChannel
  2. FileChannel
  3. ScatteringByteChannel
  4. GatheringByteChannel
  5. SeekableByteChannel
  6. ByteChannel
  7. WritableByteChannel
  8. ReadableByteChannel
  9. AbstractInterruptibleChannel
  10. InterruptibleChannel
  11. Channel
  12. Closeable
  13. AutoCloseable
  14. AnyRef
  15. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new EncryptedFileChannel(file: File, pageSize: Int, keyProvider: KeyProvider, indexName: String)

    file

    File used

    pageSize

    number of 16-byte blocks per page

    keyProvider

    encryption key information getter

    indexName

    name of the index used to retrieve the key

  2. new EncryptedFileChannel(name: String, raf: RandomAccessFile, pageSize: Int, keyProvider: KeyProvider, indexName: String)

    name

    file name

    raf

    file pointer

    pageSize

    number of 16-byte blocks per page

    keyProvider

    encryption key information getter

    indexName

    name of index used to retrieve key

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. final def begin(): Unit

    Attributes
    protected[java.nio.channels.spi]
    Definition Classes
    AbstractInterruptibleChannel
  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. final def close(): Unit

    Definition Classes
    AbstractInterruptibleChannel → InterruptibleChannel → Channel → Closeable → AutoCloseable
    Annotations
    @throws( classOf[java.io.IOException] )
  10. final def end(arg0: Boolean): Unit

    Attributes
    protected[java.nio.channels.spi]
    Definition Classes
    AbstractInterruptibleChannel
    Annotations
    @throws( ... )
  11. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  12. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  13. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. def force(metaData: Boolean): Unit

    Flushes out the data from the writer buffer to the disk.

    Flushes out the data from the writer buffer to the disk.

    metaData

    true if need to force changes to both the file's content and the metadata written to storage; otherwise, only need to force content changes to be written

    Definition Classes
    EncryptedFileChannel → FileChannel
  15. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  16. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  17. def implCloseChannel(): Unit

    Closes the reader and the writer.

    Closes the reader and the writer.

    Definition Classes
    EncryptedFileChannel → AbstractInterruptibleChannel
  18. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  19. final def isOpen(): Boolean

    Definition Classes
    AbstractInterruptibleChannel → Channel
  20. def lock(position: Long, size: Long, shared: Boolean): FileLock

    Overrides lock to throw an UnsupportedOperationException.

    Overrides lock to throw an UnsupportedOperationException.

    position

    the position at which the locked region is to start; must be non-negative

    size

    the size of the locked region; must be non-negative, and the sum position size must be non-negative

    shared

    true to request a shared lock (this channel must be open for reading and possibly writing); false to request an exclusive lock (this channel must be open for writing and possibly reading)

    Definition Classes
    EncryptedFileChannel → FileChannel
  21. final def lock(): FileLock

    Definition Classes
    FileChannel
    Annotations
    @throws( classOf[java.io.IOException] )
  22. def map(mode: MapMode, position: Long, size: Long): MappedByteBuffer

    Overrides map to throw an UnsupportedOperationException.

    Overrides map to throw an UnsupportedOperationException.

    mode

    file is to be mapped read-only, read/write, or privately (copy-on-write), respectively

    position

    the position within the file at which the mapped region is to start; must be non-negative

    size

    the size of the region to be mapped; must be non-negative and no greater than MAX_VALUE

    Definition Classes
    EncryptedFileChannel → FileChannel
  23. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  24. final def notify(): Unit

    Definition Classes
    AnyRef
  25. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  26. def position(newPosition: Long): FileChannel

    Overrides position to throw an UnsupportedOperationException.

    Overrides position to throw an UnsupportedOperationException.

    newPosition

    the new position, a non-negative integer counting the number of bytes from the start of the entity

    Definition Classes
    EncryptedFileChannel → FileChannel → SeekableByteChannel
  27. def position(): Long

    Overrides position to throw an UnsupportedOperationException.

    Overrides position to throw an UnsupportedOperationException.

    Definition Classes
    EncryptedFileChannel → FileChannel → SeekableByteChannel
  28. def read(dst: ByteBuffer, position: Long): Int

    Read bytes from the file into the given byte array.

    Read bytes from the file into the given byte array.

    dst

    byte array to copy bytes to

    position

    the file position at which the transfer is to begin; must be non-negative

    returns

    -1 if eof has been reached, the number of bytes copied into b otherwise.

    Definition Classes
    EncryptedFileChannel → FileChannel
  29. def read(dsts: Array[ByteBuffer], offset: Int, length: Int): Long

    Read bytes from the file into the given byte array.

    Read bytes from the file into the given byte array.

    dsts

    byte array to copy bytes to

    offset

    position in b to start copying data

    length

    number of bytes to be copied

    returns

    -1 if eof has been reached, the number of bytes copied into b otherwise.

    Definition Classes
    EncryptedFileChannel → FileChannel → ScatteringByteChannel
  30. def read(dst: ByteBuffer): Int

    Read bytes from the file into the given byte array.

    Read bytes from the file into the given byte array.

    dst

    byte array to copy bytes to

    returns

    -1 if eof has been reached, the number of bytes copied into b otherwise.

    Definition Classes
    EncryptedFileChannel → FileChannel → SeekableByteChannel → ReadableByteChannel
  31. final def read(arg0: Array[ByteBuffer]): Long

    Definition Classes
    FileChannel → ScatteringByteChannel
    Annotations
    @throws( classOf[java.io.IOException] )
  32. def size(): Long

    Overrides size to throw an UnsupportedOperationException.

    Overrides size to throw an UnsupportedOperationException.

    Definition Classes
    EncryptedFileChannel → FileChannel → SeekableByteChannel
  33. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  34. def toString(): String

    Definition Classes
    AnyRef → Any
  35. def transferFrom(src: ReadableByteChannel, position: Long, count: Long): Long

    Overrides transferFrom to throw an UnsupportedOperationException.

    Overrides transferFrom to throw an UnsupportedOperationException.

    src

    the source channel

    position

    the position within the file at which the transfer is to begin; must be non-negative

    count

    the maximum number of bytes to be transferred; must be non-negative

    Definition Classes
    EncryptedFileChannel → FileChannel
  36. def transferTo(position: Long, count: Long, target: WritableByteChannel): Long

    Overrides transferTo to throw an UnsupportedOperationException.

    Overrides transferTo to throw an UnsupportedOperationException.

    position

    the position within the file at which the transfer is to begin; must be non-negative

    count

    the maximum number of bytes to be transferred; must be non-negative

    target

    the target channel

    Definition Classes
    EncryptedFileChannel → FileChannel
  37. def truncate(size: Long): FileChannel

    Overrides truncate to throw an UnsupportedOperationException.

    Overrides truncate to throw an UnsupportedOperationException.

    size

    the new size, a non-negative byte count

    Definition Classes
    EncryptedFileChannel → FileChannel → SeekableByteChannel
  38. def tryLock(position: Long, size: Long, shared: Boolean): FileLock

    Overrides tryLock to throw an UnsupportedOperationException.

    Overrides tryLock to throw an UnsupportedOperationException.

    position

    the position at which the locked region is to start; must be non-negative

    size

    the size of the locked region; must be non-negative, and the sum position size must be non-negative

    shared

    true to request a shared lock; false to request an exclusive lock

    Definition Classes
    EncryptedFileChannel → FileChannel
  39. final def tryLock(): FileLock

    Definition Classes
    FileChannel
    Annotations
    @throws( classOf[java.io.IOException] )
  40. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  41. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  42. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  43. def write(src: ByteBuffer, position: Long): Int

    Writes data to disk starting from a given position.

    Writes data to disk starting from a given position.

    src

    the buffer from which bytes are to be transferred

    position

    the file position at which the transfer is to begin; must be non-negative

    returns

    the number of bytes copied into the buffer cache

    Definition Classes
    EncryptedFileChannel → FileChannel
  44. def write(srcs: Array[ByteBuffer], offset: Int, length: Int): Long

    Writes a section of data to disk.

    Writes a section of data to disk.

    srcs

    data to be written

    offset

    offset in the data

    length

    number of bytes to be written

    returns

    the number of bytes written into disk

    Definition Classes
    EncryptedFileChannel → FileChannel → GatheringByteChannel
  45. def write(src: ByteBuffer): Int

    Writes data to disk.

    Writes data to disk.

    src

    the buffer from which bytes are to be retrieved

    returns

    the number of bytes copied into the buffer cache

    Definition Classes
    EncryptedFileChannel → FileChannel → SeekableByteChannel → WritableByteChannel
  46. final def write(arg0: Array[ByteBuffer]): Long

    Definition Classes
    FileChannel → GatheringByteChannel
    Annotations
    @throws( classOf[java.io.IOException] )

Inherited from FileChannel

Inherited from ScatteringByteChannel

Inherited from GatheringByteChannel

Inherited from SeekableByteChannel

Inherited from ByteChannel

Inherited from WritableByteChannel

Inherited from ReadableByteChannel

Inherited from AbstractInterruptibleChannel

Inherited from InterruptibleChannel

Inherited from Channel

Inherited from Closeable

Inherited from AutoCloseable

Inherited from AnyRef

Inherited from Any

Ungrouped