ServerContext reset ( ) { // Delete the existing log. if ( log != null ) { log . close ( ) ; storage . deleteLog ( name ) ; } // Delete the existing snapshot store. if ( snapshot != null ) { snapshot . close ( ) ; storage . deleteSnapshotStore ( name ) ; } // Open the log. log = storage . openLog ( name ) ; // Open the snapshot store. snapshot = storage . openSnapshotStore ( name ) ; // Create a new user state machine. StateMachine stateMachine = stateMachineFactory . get ( ) ; // Configure the log compaction mode. If the state machine supports snapshotting, the default // compaction mode is SNAPSHOT, otherwise the default is SEQUENTIAL. if ( stateMachine instanceof Snapshottable ) { log . compactor ( ) . withDefaultCompactionMode ( Compaction . Mode . SNAPSHOT ) ; } else { log . compactor ( ) . withDefaultCompactionMode ( Compaction . Mode . SEQUENTIAL ) ; } // Create a new internal server state machine. this . stateMachine = new ServerStateMachine ( stateMachine , this , stateContext ) ; return this ; }
Resets the state log .