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

## Class FsyncFileHandleManagerImpl

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.persistence.wal.filehandle.FsyncFileHandleManagerImpl

All Implemented Interfaces:
  FileHandleManager

    public class FsyncFileHandleManagerImpl
    extends Object
    implements FileHandleManager

Implementation of `FileWriteHandle` for FSYNC mode.

### Field Summary

Fields
`protected GridCacheSharedContext` `cctx` Context.
`protected IgniteLogger` `log` Logger.
`protected RecordSerializer` `serializer`

### Constructor Summary

Constructors
Constructor and Description
`FsyncFileHandleManagerImpl(GridCacheSharedContext cctx, DataStorageMetricsImpl metrics, RecordSerializer serializer, Supplier<FileWriteHandle> handle, WALMode mode, long maxWalSegmentSize, long fsyncDelay, int tlbSize)`

### Method Summary

All Methods Instance Methods Concrete Methods
`WALPointer` `flush(WALPointer ptr, boolean explicitFsync)`
`FileWriteHandle` `initHandle(SegmentIO fileIO, long position, RecordSerializer serializer)` Initialize `FileWriteHandle` for first time.
`FileWriteHandle` `nextHandle(SegmentIO fileIO, RecordSerializer serializer)` Create next file handle.
`void` `onDeactivate()` On deactivate.
`void` `resumeLogging()` Resume logging.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### cctx

    protected final GridCacheSharedContext cctx

Context.

#### log

    protected final IgniteLogger log

Logger.

#### serializer

    protected final RecordSerializer serializer

### Constructor Detail

#### FsyncFileHandleManagerImpl

    public FsyncFileHandleManagerImpl(GridCacheSharedContext cctx,
                                      DataStorageMetricsImpl metrics,
                                      RecordSerializer serializer,
                                      Supplier<FileWriteHandle> handle,
                                      WALMode mode,
                                      long maxWalSegmentSize,
                                      long fsyncDelay,
                                      int tlbSize)

Parameters:
  `cctx` - Context.
  `metrics` - Data storage metrics.
  `serializer` - Serializer.
  `handle` - Current handle supplier.
  `mode` - WAL mode.
  `maxWalSegmentSize` - Max WAL segment size.
  `fsyncDelay` - Fsync delay.
  `tlbSize` - Thread local byte buffer size.

### Method Detail

#### initHandle

    public FileWriteHandle initHandle(SegmentIO fileIO,
                                      long position,
                                      RecordSerializer serializer)
                               throws IOException

Initialize `FileWriteHandle` for first time.

Specified by:
  `initHandle` in interface `FileHandleManager`
Parameters:
  `fileIO` - FileIO.
  `position` - Init position.
  `serializer` - Serializer for file handle.
Returns:
  Created file handle.
Throws:
  `IOException` - if creation was not success.

#### nextHandle

    public FileWriteHandle nextHandle(SegmentIO fileIO,
                                      RecordSerializer serializer)
                               throws IOException

Create next file handle.

Specified by:
  `nextHandle` in interface `FileHandleManager`
Parameters:
  `fileIO` - FileIO.
  `serializer` - Serializer for file handle.
Returns:
  Created file handle.
Throws:
  `IOException` - if creation was not success.

#### onDeactivate

    public void onDeactivate()
                      throws IgniteCheckedException

On deactivate.

Specified by:
  `onDeactivate` in interface `FileHandleManager`
Throws:
  `IgniteCheckedException` - if fail.

#### resumeLogging

    public void resumeLogging()

Resume logging.

Specified by:
  `resumeLogging` in interface `FileHandleManager`

#### flush

    public WALPointer flush(WALPointer ptr,
                            boolean explicitFsync)
                     throws IgniteCheckedException,
                            StorageException

Specified by:
  `flush` in interface `FileHandleManager`
Parameters:
  `ptr` - Pointer until need to flush.
  `explicitFsync` - `true` if fsync required.
Returns:
  Last WAL position which was flushed to WAL segment file. May be greater than or equal to a `ptr`. May be `null`, it means nothing has been flushed.
Throws:
  `IgniteCheckedException` - if fail.
  `StorageException` - if storage was fail.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.9.1
Release Date | : December 9 2020