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 Modifier and Type Class Description static classIndexStorageImpl.IndexItemstatic classIndexStorageImpl.MetaStoreInnerIOstatic classIndexStorageImpl.MetaStoreLeafIO
-
Field Summary
Fields Modifier and Type Field Description static intMAX_IDX_NAME_LENMax index name length (bytes num)static intRESERVED_IDX_NAME_LENReserved size for index name.
-
Constructor Summary
Constructors Constructor Description IndexStorageImpl(String treeName, PageMemory pageMem, @Nullable IgniteWriteAheadLogManager wal, AtomicLong globalRmvId, int grpId, boolean grpShared, int allocPartId, byte allocSpace, ReuseList reuseList, long rootPageId, boolean initNew, @Nullable FailureProcessor failureProcessor, PageLockTrackerManager pageLockTrackerManager)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RootPageallocateCacheIndex(Integer cacheId, String idxName, int segment)Allocate page for cache index.RootPageallocateIndex(String idxName)Get or allocate initial page for an index.static voidcheckIndexName(byte[] idxName)Checking the name of the index.voiddestroy()Destroy this meta store.@Nullable RootPagedropCacheIndex(Integer cacheId, String idxName, int segment)Deallocate index page and remove from tree.@Nullable RootPagedropIndex(String idxName)Deallocate index page and remove from tree.@Nullable RootPagefindCacheIndex(Integer cacheId, String idxName, int segment)Find index root.Collection<String>getIndexNames()booleannameIsAssosiatedWithCache(String idxName, int cacheId)@Nullable RootPagerenameCacheIndex(Integer cacheId, String oldIdxName, String newIdxName, int segment)Renaming the root page of the index tree.
-
-
-
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(String treeName, PageMemory pageMem, @Nullable @Nullable IgniteWriteAheadLogManager wal, AtomicLong globalRmvId, int grpId, boolean grpShared, int allocPartId, byte allocSpace, ReuseList reuseList, long rootPageId, boolean initNew, @Nullable @Nullable FailureProcessor failureProcessor, PageLockTrackerManager pageLockTrackerManager)
- Parameters:
treeName- Tree name.pageMem- Page memory.wal- Write ahead log manager.globalRmvId- Global remove id.grpId- Group id.grpShared- Group shared.allocPartId- Alloc partition id.allocSpace- Alloc space.reuseList- Reuse list.rootPageId- Root page id.initNew- If index tree should be (re)created.pageLockTrackerManager- Page lock tracker 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:
allocateCacheIndexin interfaceIndexStorage- 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:
allocateIndexin interfaceIndexStorage- Parameters:
idxName- Index name.- Returns:
RootPagethat 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.
-
findCacheIndex
@Nullable public @Nullable RootPage findCacheIndex(Integer cacheId, String idxName, int segment) throws IgniteCheckedException
Find index root.- Specified by:
findCacheIndexin interfaceIndexStorage- Parameters:
cacheId- Cache ID.idxName- Index name.segment- Segment.- Returns:
- Root ID or null if no page was found.
- Throws:
IgniteCheckedException- If failed.
-
dropCacheIndex
@Nullable public @Nullable RootPage dropCacheIndex(Integer cacheId, String idxName, int segment) throws IgniteCheckedException
Deallocate index page and remove from tree.- Specified by:
dropCacheIndexin interfaceIndexStorage- Parameters:
cacheId- Cache ID.idxName- Index name.segment- Segment number.- Returns:
- Root ID or
nullif no page was removed. - Throws:
IgniteCheckedException- If failed.
-
dropIndex
@Nullable public @Nullable RootPage dropIndex(String idxName) throws IgniteCheckedException
Deallocate index page and remove from tree.- Specified by:
dropIndexin interfaceIndexStorage- Parameters:
idxName- Index name.- Returns:
- Root ID or
nullif no page was removed. - Throws:
IgniteCheckedException- If failed.
-
renameCacheIndex
@Nullable public @Nullable RootPage renameCacheIndex(Integer cacheId, String oldIdxName, String newIdxName, int segment) throws IgniteCheckedException
Renaming the root page of the index tree.- Specified by:
renameCacheIndexin interfaceIndexStorage- Parameters:
cacheId- Cache id.oldIdxName- Old name of the index tree.newIdxName- New name of the index tree.segment- Segment index.- Returns:
- Renamed root page of the index tree.
- Throws:
IgniteCheckedException- If failed.
-
destroy
public void destroy() throws IgniteCheckedExceptionDestroy this meta store.- Specified by:
destroyin interfaceIndexStorage- Throws:
IgniteCheckedException- If failed.
-
getIndexNames
public Collection<String> getIndexNames() throws IgniteCheckedException
- Specified by:
getIndexNamesin interfaceIndexStorage- Returns:
- Index names of all indexes which this storage keeps.
- Throws:
IgniteCheckedException- If failed.
-
nameIsAssosiatedWithCache
public boolean nameIsAssosiatedWithCache(String idxName, int cacheId)
- Specified by:
nameIsAssosiatedWithCachein interfaceIndexStorage- 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).
-
checkIndexName
public static void checkIndexName(byte[] idxName)
Checking the name of the index.- Parameters:
idxName- Index name bytes.
-
-