Package org.apache.ignite.internal.cdc
Class CdcConsumerState
- java.lang.Object
-
- org.apache.ignite.internal.cdc.CdcConsumerState
-
public class CdcConsumerState extends Object
Change Data Capture Consumer state. Each timeCdcConsumer.onEvents(Iterator)returnstruecurrent offset in WAL segment andDataEntryindex insideDataRecordsaved to file. This allows to theCdcConsumerto continue consumption of theCdcEventfrom the last saved offset in case of fail or restart.- See Also:
CdcConsumer.onEvents(Iterator),CdcMain
-
-
Field Summary
Fields Modifier and Type Field Description static StringCACHES_STATE_FILE_NAMEstatic StringCDC_MODE_FILE_NAMEThe file stores state of CDC mode.static StringMAPPINGS_STATE_FILE_NAMEstatic StringTYPES_STATE_FILE_NAMEstatic StringWAL_STATE_FILE_NAME
-
Constructor Summary
Constructors Constructor Description CdcConsumerState(IgniteLogger log, Path stateDir)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<Integer,Long>loadCaches()Loads CDC caches state from file.CdcModeloadCdcMode()Loads CDC mode state from file.Set<T2<Integer,Byte>>loadMappingsState()Loads types mappings state from file.Map<Integer,Long>loadTypesState()Loads CDC types state from file.T2<WALPointer,Integer>loadWalState()Loads CDC consumer state from file.voidsaveCaches(Map<Integer,Long> cachesState)Saves caches state to file.voidsaveCdcMode(CdcMode mode)Saves CDC mode state to file.voidsaveMappings(Set<T2<Integer,Byte>> mappingsState)Saves types mappings state to file.voidsaveTypes(Map<Integer,Long> typesState)Saves binary types state to file.voidsaveWal(T2<WALPointer,Integer> state)Saves WAL consumption state to file.
-
-
-
Field Detail
-
WAL_STATE_FILE_NAME
public static final String WAL_STATE_FILE_NAME
- See Also:
- Constant Field Values
-
TYPES_STATE_FILE_NAME
public static final String TYPES_STATE_FILE_NAME
- See Also:
- Constant Field Values
-
MAPPINGS_STATE_FILE_NAME
public static final String MAPPINGS_STATE_FILE_NAME
- See Also:
- Constant Field Values
-
CACHES_STATE_FILE_NAME
public static final String CACHES_STATE_FILE_NAME
- See Also:
- Constant Field Values
-
CDC_MODE_FILE_NAME
public static final String CDC_MODE_FILE_NAME
The file stores state of CDC mode. Content of the file is aCdcModevalue:CdcMode.CDC_UTILITY_ACTIVEmeans thatCdcMainutility captures data.CdcMode.IGNITE_NODE_ACTIVEmeans thatCdcManagercaptures data within Ignite node.
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CdcConsumerState
public CdcConsumerState(IgniteLogger log, Path stateDir)
- Parameters:
stateDir- State directory.
-
-
Method Detail
-
saveWal
public void saveWal(T2<WALPointer,Integer> state) throws IOException
Saves WAL consumption state to file.- Parameters:
state- WAL pointer and index ofDataEntryinsideDataRecord.- Throws:
IOException
-
saveTypes
public void saveTypes(Map<Integer,Long> typesState) throws IOException
Saves binary types state to file.- Parameters:
typesState- State of types.- Throws:
IOException
-
saveMappings
public void saveMappings(Set<T2<Integer,Byte>> mappingsState) throws IOException
Saves types mappings state to file.- Parameters:
mappingsState- Mappings state.- Throws:
IOException
-
loadWalState
public T2<WALPointer,Integer> loadWalState()
Loads CDC consumer state from file.- Returns:
- Saved state.
-
loadCaches
public Map<Integer,Long> loadCaches()
Loads CDC caches state from file.- Returns:
- Saved state.
-
saveCaches
public void saveCaches(Map<Integer,Long> cachesState) throws IOException
Saves caches state to file.- Parameters:
cachesState- State of caches.- Throws:
IOException
-
loadMappingsState
public Set<T2<Integer,Byte>> loadMappingsState()
Loads types mappings state from file.- Returns:
- Saved state.
-
loadTypesState
public Map<Integer,Long> loadTypesState()
Loads CDC types state from file.- Returns:
- Saved state.
-
loadCdcMode
public CdcMode loadCdcMode()
Loads CDC mode state from file.- Returns:
- CDC mode state.
-
saveCdcMode
public void saveCdcMode(CdcMode mode) throws IOException
Saves CDC mode state to file.- Parameters:
mode- CDC mode.- Throws:
IOException
-
-