org.apache.ignite.internal.processors.cache.persistence.freelist

## Class FreeListImpl

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.persistence.DataStructure
  - - org.apache.ignite.internal.processors.cache.persistence.freelist.PagesList
    - - org.apache.ignite.internal.processors.cache.persistence.freelist.FreeListImpl

All Implemented Interfaces:
  FreeList, ReuseList, PageLockListener

    public class FreeListImpl
    extends PagesList
    implements FreeList, ReuseList

### Nested Class Summary

### Nested classes/interfaces inherited from class org.apache.ignite.internal.processors.cache.persistence.freelist.PagesList

`PagesList.Stripe`

### Field Summary

### Fields inherited from class org.apache.ignite.internal.processors.cache.persistence.freelist.PagesList

`bucketsSize, changed, name`

### Fields inherited from class org.apache.ignite.internal.processors.cache.persistence.DataStructure

`grpId, pageMem, reuseList, rnd, wal`

### Constructor Summary

Constructors
Constructor and Description
`FreeListImpl(int cacheId, String name, MemoryMetricsImpl memMetrics, MemoryPolicy memPlc, ReuseList reuseList, IgniteWriteAheadLogManager wal, long metaPageId, boolean initNew)`

### Method Summary

Methods
`void` `addForRecycle(ReuseBag bag)`
`protected boolean` `casBucket(int bucket, PagesList.Stripe[] exp, PagesList.Stripe[] upd)`
`void` `dumpStatistics(IgniteLogger log)`
`int` `emptyDataPages()`
`float` `fillFactor()` Calculates average fill factor over FreeListImpl instance.
`protected PagesList.Stripe[]` `getBucket(int bucket)`
`static int` `getRowSize(CacheDataRow row, boolean withCacheId)`
`void` `insertDataRow(CacheDataRow row)`
`protected boolean` `isReuseBucket(int bucket)`
`long` `recycledPagesCount()`
`void` `removeDataRowByLink(long link)`
`long` `takeRecycledPage()`
`String` `toString()`
`boolean` `updateDataRow(long link, CacheDataRow row)`

### Methods inherited from class org.apache.ignite.internal.processors.cache.persistence.freelist.PagesList

`init, put, removeDataPage, saveMetadata, storedPagesCount, takeEmptyPage`

### Methods inherited from class org.apache.ignite.internal.processors.cache.persistence.DataStructure

`acquirePage, allocatePage, allocatePageNoReuse, groupId, init, needWalDeltaRecord, onBeforeReadLock, onBeforeWriteLock, onReadLock, onReadUnlock, onWriteLock, onWriteUnlock, pageSize, randomInt, read, read, readLock, readUnlock, recyclePage, releasePage, tryWriteLock, write, write, write, write, writeLock, writeUnlock, writeUnlock`

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

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

### Constructor Detail

#### FreeListImpl

    public FreeListImpl(int cacheId,
                String name,
                MemoryMetricsImpl memMetrics,
                MemoryPolicy memPlc,
                ReuseList reuseList,
                IgniteWriteAheadLogManager wal,
                long metaPageId,
                boolean initNew)
                 throws IgniteCheckedException

Parameters:
  `cacheId` - Cache ID.
  `name` - Name (for debug purpose).
  `memMetrics` - Memory metrics.
  `memPlc` - Memory policy.
  `reuseList` - Reuse list or `null` if this free list will be a reuse list for itself.
  `wal` - Write ahead log manager.
  `metaPageId` - Metadata page ID.
  `initNew` - `True` if new metadata should be initialized.
Throws:
  `IgniteCheckedException` - If failed.

### Method Detail

#### fillFactor

    public float fillFactor()

Calculates average fill factor over FreeListImpl instance.

#### dumpStatistics

    public void dumpStatistics(IgniteLogger log)

Specified by:
  `dumpStatistics` in interface `FreeList`
Parameters:
  `log` - Logger.

#### insertDataRow

    public void insertDataRow(CacheDataRow row)
                       throws IgniteCheckedException

Specified by:
  `insertDataRow` in interface `FreeList`
Parameters:
  `row` - Row.
Throws:
  `IgniteCheckedException` - If failed.

#### updateDataRow

    public boolean updateDataRow(long link,
                        CacheDataRow row)
                          throws IgniteCheckedException

Specified by:
  `updateDataRow` in interface `FreeList`
Parameters:
  `link` - Row link.
  `row` - New row data.
Returns:
  `True` if was able to update row.
Throws:
  `IgniteCheckedException` - If failed.

#### removeDataRowByLink

    public void removeDataRowByLink(long link)
                             throws IgniteCheckedException

Specified by:
  `removeDataRowByLink` in interface `FreeList`
Parameters:
  `link` - Row link.
Throws:
  `IgniteCheckedException` - If failed.

#### getBucket

    protected PagesList.Stripe[] getBucket(int bucket)

Specified by:
  `getBucket` in class `PagesList`
Parameters:
  `bucket` - Bucket index.
Returns:
  Bucket.

#### casBucket

    protected boolean casBucket(int bucket,
                    PagesList.Stripe[] exp,
                    PagesList.Stripe[] upd)

Specified by:
  `casBucket` in class `PagesList`
Parameters:
  `bucket` - Bucket index.
  `exp` - Expected bucket.
  `upd` - Updated bucket.
Returns:
  `true` If succeeded.

#### isReuseBucket

    protected boolean isReuseBucket(int bucket)

Specified by:
  `isReuseBucket` in class `PagesList`
Parameters:
  `bucket` - Bucket index.
Returns:
  `true` If it is a reuse bucket.

#### emptyDataPages

    public int emptyDataPages()

Returns:
  Number of empty data pages in free list.

#### addForRecycle

    public void addForRecycle(ReuseBag bag)
                       throws IgniteCheckedException

Specified by:
  `addForRecycle` in interface `ReuseList`
Parameters:
  `bag` - Reuse bag.
Throws:
  `IgniteCheckedException` - If failed.

#### takeRecycledPage

    public long takeRecycledPage()
                          throws IgniteCheckedException

Specified by:
  `takeRecycledPage` in interface `ReuseList`
Returns:
  Page ID or `0` if none available.
Throws:
  `IgniteCheckedException` - If failed.

#### recycledPagesCount

    public long recycledPagesCount()
                            throws IgniteCheckedException

Specified by:
  `recycledPagesCount` in interface `ReuseList`
Returns:
  Number of recycled pages it contains.
Throws:
  `IgniteCheckedException` - If failed.

#### getRowSize

    public static int getRowSize(CacheDataRow row,
                 boolean withCacheId)
                          throws IgniteCheckedException

Parameters:
  `row` - Row.
  `withCacheId` - If `true` adds cache ID size.
Returns:
  Entry size on page.
Throws:
  `IgniteCheckedException` - If failed.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.1.0
Release Date | : July 20 2017