Class MetaStorage
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.persistence.metastorage.MetaStorage
-
- All Implemented Interfaces:
CheckpointListener,ReadOnlyMetastorage,ReadWriteMetastorage
public class MetaStorage extends Object implements CheckpointListener, ReadWriteMetastorage
General purpose key-value local-only storage.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMetaStorage.TmpStorageTemporary storage-
Nested classes/interfaces inherited from interface org.apache.ignite.internal.processors.cache.persistence.checkpoint.CheckpointListener
CheckpointListener.Context
-
-
Field Summary
Fields Modifier and Type Field Description static intMETASTORAGE_CACHE_IDstatic StringMETASTORAGE_CACHE_NAMEstatic StringMETASTORAGE_DIR_NAMEMetastorage cache directory to store data.static Set<Integer>METASTORAGE_PARTITIONSThe set of all metastorage partitions.static intMETASTORE_PARTITIONSpecial partition reserved for metastore space.static intOLD_METASTORE_PARTITIONOld special partition reserved for metastore space.static booleanPRESERVE_LEGACY_METASTORAGE_PARTITION_IDThis flag is used ONLY FOR TESTING the migration of a metastorage from Part 0 to Part 1.
-
Constructor Summary
Constructors Constructor Description MetaStorage(GridCacheSharedContext<?,?> cctx, DataRegion dataRegion, boolean readOnly)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapplyUpdate(String key, byte[] value)voidbeforeCheckpointBegin(CheckpointListener.Context ctx)Do some actions before checkpoint write lock.voidclose()Frees the allocated resources.voidinit(GridCacheDatabaseSharedManager db)voiditerate(String keyPrefix, BiConsumer<String,? super Serializable> cb, boolean unmarshal)Read all key/value pairs where key has provided prefix.Marshallermarshaller()voidonCheckpointBegin(CheckpointListener.Context ctx)voidonMarkCheckpointBegin(CheckpointListener.Context ctx)PageMemorypageMemory()Serializableread(String key)byte[]readRaw(String key)voidremove(@NotNull String key)voidremoveData(String key)voidwrite(@NotNull String key, @NotNull Serializable val)voidwriteRaw(String key, byte[] data)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.ignite.internal.processors.cache.persistence.checkpoint.CheckpointListener
afterCheckpointEnd
-
-
-
-
Field Detail
-
METASTORAGE_CACHE_NAME
public static final String METASTORAGE_CACHE_NAME
- See Also:
- Constant Field Values
-
METASTORAGE_CACHE_ID
public static final int METASTORAGE_CACHE_ID
-
METASTORAGE_DIR_NAME
public static final String METASTORAGE_DIR_NAME
Metastorage cache directory to store data.- See Also:
- Constant Field Values
-
OLD_METASTORE_PARTITION
public static final int OLD_METASTORE_PARTITION
Old special partition reserved for metastore space.- See Also:
- Constant Field Values
-
METASTORE_PARTITION
public static final int METASTORE_PARTITION
Special partition reserved for metastore space.- See Also:
- Constant Field Values
-
METASTORAGE_PARTITIONS
public static final Set<Integer> METASTORAGE_PARTITIONS
The set of all metastorage partitions.
-
PRESERVE_LEGACY_METASTORAGE_PARTITION_ID
public static boolean PRESERVE_LEGACY_METASTORAGE_PARTITION_ID
This flag is used ONLY FOR TESTING the migration of a metastorage from Part 0 to Part 1.
-
-
Constructor Detail
-
MetaStorage
public MetaStorage(GridCacheSharedContext<?,?> cctx, DataRegion dataRegion, boolean readOnly)
-
-
Method Detail
-
init
public void init(GridCacheDatabaseSharedManager db) throws IgniteCheckedException
- Throws:
IgniteCheckedException
-
close
public void close()
Frees the allocated resources.
-
read
public Serializable read(String key) throws IgniteCheckedException
- Specified by:
readin interfaceReadOnlyMetastorage- Throws:
IgniteCheckedException
-
iterate
public void iterate(String keyPrefix, BiConsumer<String,? super Serializable> cb, boolean unmarshal) throws IgniteCheckedException
Read all key/value pairs where key has provided prefix. It is guaranteed that callback will be applied to matching keys in ascending order.- Specified by:
iteratein interfaceReadOnlyMetastorage- Parameters:
keyPrefix- Key prefix.cb- Callback to invoke on each matching key/value pair.unmarshal-Trueif object passed intocbshould be unmarshalled.- Throws:
IgniteCheckedException- If failed.
-
write
public void write(@NotNull @NotNull String key, @NotNull @NotNull Serializable val) throws IgniteCheckedException- Specified by:
writein interfaceReadWriteMetastorage- Throws:
IgniteCheckedException
-
remove
public void remove(@NotNull @NotNull String key) throws IgniteCheckedException- Specified by:
removein interfaceReadWriteMetastorage- Throws:
IgniteCheckedException
-
writeRaw
public void writeRaw(String key, byte[] data) throws IgniteCheckedException
- Specified by:
writeRawin interfaceReadWriteMetastorage- Throws:
IgniteCheckedException
-
readRaw
public byte[] readRaw(String key) throws IgniteCheckedException
- Specified by:
readRawin interfaceReadOnlyMetastorage- Throws:
IgniteCheckedException
-
removeData
public void removeData(String key) throws IgniteCheckedException
- Throws:
IgniteCheckedException
-
pageMemory
public PageMemory pageMemory()
- Returns:
- Page memory.
-
onMarkCheckpointBegin
public void onMarkCheckpointBegin(CheckpointListener.Context ctx) throws IgniteCheckedException
- Specified by:
onMarkCheckpointBeginin interfaceCheckpointListener- Throws:
IgniteCheckedException- If failed.
-
beforeCheckpointBegin
public void beforeCheckpointBegin(CheckpointListener.Context ctx) throws IgniteCheckedException
Do some actions before checkpoint write lock.- Specified by:
beforeCheckpointBeginin interfaceCheckpointListener- Throws:
IgniteCheckedException- If failed.
-
onCheckpointBegin
public void onCheckpointBegin(CheckpointListener.Context ctx) throws IgniteCheckedException
- Specified by:
onCheckpointBeginin interfaceCheckpointListener- Throws:
IgniteCheckedException- If failed.
-
applyUpdate
public void applyUpdate(String key, byte[] value) throws IgniteCheckedException
- Throws:
IgniteCheckedException
-
marshaller
public Marshaller marshaller()
-
-