Search in sources :

Example 6 with IncrementalPersistenceStore

use of io.siddhi.core.util.persistence.IncrementalPersistenceStore in project siddhi by siddhi-io.

the class SnapshotService method restoreLastRevision.

public String restoreLastRevision() throws CannotRestoreSiddhiAppStateException {
    PersistenceStore persistenceStore = siddhiAppContext.getSiddhiContext().getPersistenceStore();
    IncrementalPersistenceStore incrementalPersistenceStore = siddhiAppContext.getSiddhiContext().getIncrementalPersistenceStore();
    String siddhiAppName = siddhiAppContext.getName();
    String revision;
    if (persistenceStore != null) {
        revision = persistenceStore.getLastRevision(siddhiAppName);
    } else if (incrementalPersistenceStore != null) {
        revision = incrementalPersistenceStore.getLastRevision(siddhiAppName);
    } else {
        throw new NoPersistenceStoreException("No persistence store assigned for siddhi app " + siddhiAppName);
    }
    if (revision != null) {
        restoreRevision(revision);
    }
    return revision;
}
Also used : IncrementalPersistenceStore(io.siddhi.core.util.persistence.IncrementalPersistenceStore) PersistenceStore(io.siddhi.core.util.persistence.PersistenceStore) IncrementalPersistenceStore(io.siddhi.core.util.persistence.IncrementalPersistenceStore) NoPersistenceStoreException(io.siddhi.core.exception.NoPersistenceStoreException)

Aggregations

NoPersistenceStoreException (io.siddhi.core.exception.NoPersistenceStoreException)6 IncrementalPersistenceStore (io.siddhi.core.util.persistence.IncrementalPersistenceStore)6 PersistenceStore (io.siddhi.core.util.persistence.PersistenceStore)6 SiddhiAppContext (io.siddhi.core.config.SiddhiAppContext)2 CannotClearSiddhiAppStateException (io.siddhi.core.exception.CannotClearSiddhiAppStateException)2 CannotRestoreSiddhiAppStateException (io.siddhi.core.exception.CannotRestoreSiddhiAppStateException)2 PersistenceStoreException (io.siddhi.core.exception.PersistenceStoreException)2 SiddhiAppRuntimeException (io.siddhi.core.exception.SiddhiAppRuntimeException)2 ThreadBarrier (io.siddhi.core.util.ThreadBarrier)2 IncrementalSnapshotInfo (io.siddhi.core.util.persistence.util.IncrementalSnapshotInfo)2 PersistenceConstants (io.siddhi.core.util.persistence.util.PersistenceConstants)2 PersistenceHelper (io.siddhi.core.util.persistence.util.PersistenceHelper)2 Snapshot (io.siddhi.core.util.snapshot.state.Snapshot)2 SnapshotStateList (io.siddhi.core.util.snapshot.state.SnapshotStateList)2 State (io.siddhi.core.util.snapshot.state.State)2 StateHolder (io.siddhi.core.util.snapshot.state.StateHolder)2 Comparator (java.util.Comparator)2 HashMap (java.util.HashMap)2 Iterator (java.util.Iterator)2 List (java.util.List)2