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

## Class IndexStorageImpl

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.persistence.IndexStorageImpl

All Implemented Interfaces:
  IndexStorage

    public class IndexStorageImpl
    extends Object
    implements IndexStorage

Metadata storage.

### Nested Class Summary

Nested Classes
`static class` `IndexStorageImpl.MetaStoreInnerIO`
`static class` `IndexStorageImpl.MetaStoreLeafIO`

### Field Summary

Fields
`static int` `MAX_IDX_NAME_LEN` Max index name length (bytes num)
`static int` `RESERVED_IDX_NAME_LEN` Reserved size for index name.

### Constructor Summary

Constructors
Constructor and Description
`IndexStorageImpl(PageMemory pageMem, IgniteWriteAheadLogManager wal, AtomicLong globalRmvId, int grpId, boolean grpShared, int allocPartId, byte allocSpace, ReuseList reuseList, long rootPageId, boolean initNew, FailureProcessor failureProcessor, PageLockListener lockLsnr)`

### Method Summary

All Methods Instance Methods Concrete Methods
`RootPage` `allocateCacheIndex(Integer cacheId, String idxName, int segment)` Allocate page for cache index.
`RootPage` `allocateIndex(String idxName)` Get or allocate initial page for an index.
`void` `destroy()` Destroy this meta store.
`RootPage` `dropCacheIndex(Integer cacheId, String idxName, int segment)` Deallocate index page and remove from tree.
`RootPage` `dropIndex(String idxName)` Deallocate index page and remove from tree.
`Collection<String>` `getIndexNames()`
`boolean` `nameIsAssosiatedWithCache(String idxName, int cacheId)`

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

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

### Field Detail

#### MAX_IDX_NAME_LEN

    public static final int MAX_IDX_NAME_LEN

Max index name length (bytes num)

See Also:
  Constant Field Values

#### RESERVED_IDX_NAME_LEN

    public static final int RESERVED_IDX_NAME_LEN

Reserved size for index name. Needed for backward compatibility.

See Also:
  Constant Field Values

### Constructor Detail

#### IndexStorageImpl

    public IndexStorageImpl(PageMemory pageMem,
                            IgniteWriteAheadLogManager wal,
                            AtomicLong globalRmvId,
                            int grpId,
                            boolean grpShared,
                            int allocPartId,
                            byte allocSpace,
                            ReuseList reuseList,
                            long rootPageId,
                            boolean initNew,
                            FailureProcessor failureProcessor,
                            PageLockListener lockLsnr)

Parameters:
  `pageMem` - Page memory.
  `wal` - Write ahead log manager.

### Method Detail

#### allocateCacheIndex

    public RootPage allocateCacheIndex(Integer cacheId,
                                       String idxName,
                                       int segment)
                                throws IgniteCheckedException

Allocate page for cache index. Index name will be masked if needed.

Specified by:
  `allocateCacheIndex` in interface `IndexStorage`
Parameters:
  `cacheId` - Cache ID.
  `idxName` - Index name.
  `segment` - Segment.
Returns:
  Root page.
Throws:
  `IgniteCheckedException` - If failed.

#### allocateIndex

    public RootPage allocateIndex(String idxName)
                           throws IgniteCheckedException

Get or allocate initial page for an index.

Specified by:
  `allocateIndex` in interface `IndexStorage`
Parameters:
  `idxName` - Index name.
Returns:
  `RootPage` that keeps pageId, allocated flag that shows whether the page was newly allocated, and rootId that is counter which increments each time new page allocated.
Throws:
  `IgniteCheckedException` - If failed.

#### dropCacheIndex

    public RootPage dropCacheIndex(Integer cacheId,
                                   String idxName,
                                   int segment)
                            throws IgniteCheckedException

Deallocate index page and remove from tree.

Specified by:
  `dropCacheIndex` in interface `IndexStorage`
Parameters:
  `cacheId` - Cache ID.
  `idxName` - Index name.
  `segment` - Segment.
Returns:
  Root ID or -1 if no page was removed.
Throws:
  `IgniteCheckedException` - If failed.

#### dropIndex

    public RootPage dropIndex(String idxName)
                       throws IgniteCheckedException

Deallocate index page and remove from tree.

Specified by:
  `dropIndex` in interface `IndexStorage`
Parameters:
  `idxName` - Index name.
Returns:
  Root ID or -1 if no page was removed.
Throws:
  `IgniteCheckedException` - If failed.

#### destroy

    public void destroy()
                 throws IgniteCheckedException

Destroy this meta store.

Specified by:
  `destroy` in interface `IndexStorage`
Throws:
  `IgniteCheckedException` - If failed.

#### getIndexNames

    public Collection<String> getIndexNames()
                                     throws IgniteCheckedException

Specified by:
  `getIndexNames` in interface `IndexStorage`
Returns:
  Index names of all indexes which this storage keeps.
Throws:
  `IgniteCheckedException` - If failed.

#### nameIsAssosiatedWithCache

    public boolean nameIsAssosiatedWithCache(String idxName,
                                             int cacheId)

Specified by:
  `nameIsAssosiatedWithCache` in interface `IndexStorage`
Parameters:
  `idxName` - Index name to check.
  `cacheId` - Cache id to check.
Returns:
  True if the given idxName could be assosiated with the given cacheId (existing is not checked).

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.8.1
Release Date | : May 21 2020