@Test public void create_snapshot(){ Engine e = DBMaker.newMemoryDB().makeEngine(); Engine snapshot = SnapshotEngine.createSnapshotFor(e); assertNotNull(snapshot); }
public static Engine createSnapshotFor(Engine engine) { SnapshotEngine se = null; while(true){ if(engine instanceof SnapshotEngine){ se = (SnapshotEngine) engine; break; }else if(engine instanceof EngineWrapper){ engine = ((EngineWrapper)engine).getWrappedEngine(); }else{ throw new IllegalArgumentException("Could not create Snapshot for Engine: "+engine); } } return se.snapshot(); }
SnapshotEngine extends EngineWrapper { public static Engine createSnapshotFor(Engine engine) { SnapshotEngine se = null; while(true){ if(engine instanceof SnapshotEngine){ se = (SnapshotEngine) engine; break; }else if(engine instanceof EngineWrapper){ engine = ((EngineWrapper)engine).getWrappedEngine(); }else{ throw new IllegalArgumentException("Could not create Snapshot for Engine: "+engine); } } return se.snapshot(); } }
SnapshotEngine extends EngineWrapper { public static Engine createSnapshotFor(Engine engine) { SnapshotEngine se = null; while(true){ if(engine instanceof SnapshotEngine){ se = (SnapshotEngine) engine; break; }else if(engine instanceof EngineWrapper){ engine = ((EngineWrapper)engine).getWrappedEngine(); }else{ throw new IllegalArgumentException("Could not create Snapshot for Engine: "+engine); } } return se.snapshot(); } protected  SnapshotEngine(Engine engine); }
SnapshotEngine extends EngineWrapper { public static Engine createSnapshotFor(Engine engine) { SnapshotEngine se = null; while(true){ if(engine instanceof SnapshotEngine){ se = (SnapshotEngine) engine; break; }else if(engine instanceof EngineWrapper){ engine = ((EngineWrapper)engine).getWrappedEngine(); }else{ throw new IllegalArgumentException("Could not create Snapshot for Engine: "+engine); } } return se.snapshot(); } protected  SnapshotEngine(Engine engine); Engine snapshot(); @Override long put(A value, Serializer<A> serializer); @Override boolean compareAndSwap(long recid, A expectedOldValue, A newValue, Serializer<A> serializer); @Override void update(long recid, A value, Serializer<A> serializer); @Override void delete(long recid, Serializer<A> serializer); static Engine createSnapshotFor(Engine engine); }
SnapshotEngine extends EngineWrapper { public static Engine createSnapshotFor(Engine engine) { SnapshotEngine se = null; while(true){ if(engine instanceof SnapshotEngine){ se = (SnapshotEngine) engine; break; }else if(engine instanceof EngineWrapper){ engine = ((EngineWrapper)engine).getWrappedEngine(); }else{ throw new IllegalArgumentException("Could not create Snapshot for Engine: "+engine); } } return se.snapshot(); } protected  SnapshotEngine(Engine engine); Engine snapshot(); @Override long put(A value, Serializer<A> serializer); @Override boolean compareAndSwap(long recid, A expectedOldValue, A newValue, Serializer<A> serializer); @Override void update(long recid, A value, Serializer<A> serializer); @Override void delete(long recid, Serializer<A> serializer); static Engine createSnapshotFor(Engine engine);  }