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:

sizeInBytes Method

int sizeInBytes()
Note
sizeInBytes is part of the BaseRecords contract for the size of the records (in bytes).

sizeInBytes simply the current value of the size internal registry.

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 (java.util.concurrent.atomic.AtomicInteger) that is end - start for isSlice enabled.

Used when…​FIXME

results matching ""

    No results matching ""