Search in sources :

Example 1 with SnapshotAwareService

use of com.hazelcast.cp.internal.raft.SnapshotAwareService in project hazelcast by hazelcast.

the class RestoreSnapshotOp method run.

@Override
public Object run(CPGroupId groupId, long commitIndex) {
    SnapshotAwareService service = getService();
    service.restoreSnapshot(groupId, commitIndex, snapshot);
    return null;
}
Also used : SnapshotAwareService(com.hazelcast.cp.internal.raft.SnapshotAwareService)

Example 2 with SnapshotAwareService

use of com.hazelcast.cp.internal.raft.SnapshotAwareService in project hazelcast by hazelcast.

the class NodeEngineRaftIntegration method takeSnapshot.

@Override
public Object takeSnapshot(long commitIndex) {
    try {
        List<RestoreSnapshotOp> snapshotOps = new ArrayList<>();
        for (ServiceInfo serviceInfo : nodeEngine.getServiceInfos(SnapshotAwareService.class)) {
            SnapshotAwareService service = serviceInfo.getService();
            Object snapshot = service.takeSnapshot(groupId, commitIndex);
            if (snapshot != null) {
                snapshotOps.add(new RestoreSnapshotOp(serviceInfo.getName(), snapshot));
            }
        }
        return snapshotOps;
    } catch (Throwable t) {
        return t;
    }
}
Also used : ServiceInfo(com.hazelcast.spi.impl.servicemanager.ServiceInfo) ArrayList(java.util.ArrayList) SnapshotAwareService(com.hazelcast.cp.internal.raft.SnapshotAwareService) RestoreSnapshotOp(com.hazelcast.cp.internal.raftop.snapshot.RestoreSnapshotOp)

Example 3 with SnapshotAwareService

use of com.hazelcast.cp.internal.raft.SnapshotAwareService in project hazelcast by hazelcast.

the class UnsafeSnapshotReplicationOp method run.

@Override
public void run() throws Exception {
    SnapshotAwareService service = getService();
    for (Entry<CPGroupId, Object> entry : snapshots.entrySet()) {
        CPGroupId groupId = entry.getKey();
        service.restoreSnapshot(groupId, 0, entry.getValue());
    }
}
Also used : CPGroupId(com.hazelcast.cp.CPGroupId) SnapshotAwareService(com.hazelcast.cp.internal.raft.SnapshotAwareService)

Aggregations

SnapshotAwareService (com.hazelcast.cp.internal.raft.SnapshotAwareService)3 CPGroupId (com.hazelcast.cp.CPGroupId)1 RestoreSnapshotOp (com.hazelcast.cp.internal.raftop.snapshot.RestoreSnapshotOp)1 ServiceInfo (com.hazelcast.spi.impl.servicemanager.ServiceInfo)1 ArrayList (java.util.ArrayList)1