!per #3631 Snapshotting
- capture and save snapshots of processor state - start processor recovery from saved snapshots - snapshot storage on local filesystem - snapshot store completely isolated from journal - LevelDB journal modularized (and completely re-rwritten) - In-memory journal removed
This commit is contained in:
parent
c55189f615
commit
842ac672f7
34 changed files with 1348 additions and 477 deletions
|
|
@ -88,7 +88,7 @@ public class PersistenceDocTest {
|
|||
@Override
|
||||
public void preRestart(Throwable reason, Option<Object> message) {
|
||||
if (message.isDefined() && message.get() instanceof Persistent) {
|
||||
delete((Persistent) message.get());
|
||||
deleteMessage((Persistent) message.get());
|
||||
}
|
||||
super.preRestart(reason, message);
|
||||
}
|
||||
|
|
@ -169,4 +169,62 @@ public class PersistenceDocTest {
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
static Object o4 = new Object() {
|
||||
//#save-snapshot
|
||||
class MyProcessor extends UntypedProcessor {
|
||||
private Object state;
|
||||
|
||||
@Override
|
||||
public void onReceive(Object message) throws Exception {
|
||||
if (message.equals("snap")) {
|
||||
saveSnapshot(state);
|
||||
} else if (message instanceof SaveSnapshotSucceeded) {
|
||||
SnapshotMetadata metadata = ((SaveSnapshotSucceeded)message).metadata();
|
||||
// ...
|
||||
} else if (message instanceof SaveSnapshotFailed) {
|
||||
SnapshotMetadata metadata = ((SaveSnapshotFailed)message).metadata();
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
//#save-snapshot
|
||||
};
|
||||
|
||||
static Object o5 = new Object() {
|
||||
//#snapshot-offer
|
||||
class MyProcessor extends UntypedProcessor {
|
||||
private Object state;
|
||||
|
||||
@Override
|
||||
public void onReceive(Object message) throws Exception {
|
||||
if (message instanceof SnapshotOffer) {
|
||||
state = ((SnapshotOffer)message).snapshot();
|
||||
// ...
|
||||
} else if (message instanceof Persistent) {
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
//#snapshot-offer
|
||||
|
||||
class MyActor extends UntypedActor {
|
||||
ActorRef processor;
|
||||
|
||||
public MyActor() {
|
||||
processor = getContext().actorOf(Props.create(MyProcessor.class));
|
||||
}
|
||||
|
||||
public void onReceive(Object message) throws Exception {
|
||||
// ...
|
||||
}
|
||||
|
||||
private void recover() {
|
||||
//#snapshot-criteria
|
||||
processor.tell(Recover.create(SnapshotSelectionCriteria.create(457L, System.currentTimeMillis())), null);
|
||||
//#snapshot-criteria
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue