FileRecords

FileRecords is a concrete AbstractRecords…​FIXME

FileRecords is created when…​FIXME

Creating FileRecords Instance

FileRecords takes the following to be created:

  • Underlying File

  • Underlying FileChannel

  • Start

  • End

  • isSlice flag

FileRecords initializes the internal properties.

Opening Log File — open Utility

FileRecords open(
  File file) throws IOException (1)
FileRecords open(
  File file,
  boolean mutable) throws IOException (2)
FileRecords open(
  File file,
  boolean mutable,
  boolean fileAlreadyExists,
  int initFileSize,
  boolean preallocate) throws IOException
FileRecords open(
  File file,
  boolean fileAlreadyExists,
  int initFileSize,
  boolean preallocate) throws IOException
  1. Turns mutable flag on (true)

  2. Turns fileAlreadyExists flag off (false), initFileSize as 0, and preallocate as false

open determines the end of a FileRecords to be created:

  • 0 for the given fileAlreadyExists flag disabled (false) and the given preallocate flag enabled (true)

  • Integer.MAX_VALUE otherwise

In the end, open creates a new FileRecords for the given file, the channel, and the isSlice flag disabled (false).

Note

open is used when:

Reading Log Batches (Into ByteBuffer) — readInto Method

void readInto(
  ByteBuffer buffer,
  int position) throws IOException

readInto…​FIXME

Note

readInto is used when:

Opening FileChannel — openChannel Internal Method

FileChannel openChannel(
  File file,
  boolean mutable,
  boolean fileAlreadyExists,
  int initFileSize,
  boolean preallocate) throws IOException

openChannel…​FIXME

Note
openChannel is used when FileRecords utility is requested to open a log file.

Internal Properties

Name Description

batches

(Iterable<FileChannelRecordBatch>)

size

Size (AtomicInteger) that is end - start for isSlice enabled.

Used when…​FIXME

results matching ""

    No results matching ""