org.apache.ignite.internal.processors.cache.persistence.wal.filehandle

## Interface FileWriteHandle

    public interface FileWriteHandle

File write handle.

### Method Summary

All Methods Instance Methods Abstract Methods
`@Nullable WALPointer` `addRecord(WALRecord rec)`
`void` `awaitNext()` Awaiting when next segment would be initialized.
`boolean` `close(boolean rollOver)` Close segment.
`void` `closeBuffer()` Close buffer.
`void` `finishResumeLogging()` Do action after finish resume logging.
`void` `flushAll()` Flush all records.
`void` `fsync(WALPointer ptr)` Do fsync.
`long` `getSegmentId()`
`int` `getSwitchSegmentRecordOffset()`
`boolean` `needFsync(WALPointer ptr)`
`WALPointer` `position()`
`int` `serializerVersion()`
`void` `signalNextAvailable()` Signals next segment available to wake up other worker threads waiting for WAL to write.
`void` `writeHeader()` Write header to segment.

### Method Detail

#### serializerVersion

    int serializerVersion()

Returns:
  Version of serializer.

#### finishResumeLogging

    void finishResumeLogging()

Do action after finish resume logging.

#### writeHeader

    void writeHeader()
              throws IgniteCheckedException

Write header to segment.

Throws:
  `IgniteCheckedException` - if fail.

#### addRecord

    @Nullable
    @Nullable WALPointer addRecord(WALRecord rec)
                                      throws StorageException,
                                             IgniteCheckedException

Parameters:
  `rec` - Record to be added.
Returns:
  Pointer or null if roll over to next segment is required or already started by other thread.
Throws:
  `StorageException` - if storage was failed.
  `IgniteCheckedException` - if fail.

#### flushAll

    void flushAll()
           throws IgniteCheckedException

Flush all records.

Throws:
  `IgniteCheckedException` - if fail.

#### needFsync

    boolean needFsync(WALPointer ptr)

Parameters:
  `ptr` - Pointer.
Returns:
  `true` if fsync needed.

#### position

    WALPointer position()

Returns:
  Pointer to the end of the last written record (probably not fsync-ed).

#### fsync

    void fsync(WALPointer ptr)
        throws StorageException,
               IgniteCheckedException

Do fsync.

Parameters:
  `ptr` - Pointer to which fsync required.
Throws:
  `StorageException` - if storage fail.
  `IgniteCheckedException` - if fail.

#### closeBuffer

    void closeBuffer()

Close buffer.

#### close

    boolean close(boolean rollOver)
           throws IgniteCheckedException,
                  StorageException

Close segment.

Parameters:
  `rollOver` - Close for rollover.
Returns:
  `true` if close was success.
Throws:
  `IgniteCheckedException` - if fail.
  `StorageException` - if storage was fail.

#### signalNextAvailable

    void signalNextAvailable()

Signals next segment available to wake up other worker threads waiting for WAL to write.

#### awaitNext

    void awaitNext()

Awaiting when next segment would be initialized.

#### getSegmentId

    long getSegmentId()

Returns:
  Absolute WAL segment file index (incremental counter).

#### getSwitchSegmentRecordOffset

    int getSwitchSegmentRecordOffset()

Returns:
  SwitchSegmentRecord offset (0 if undef)

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.14.0
Release Date | : September 29 2022