public void writeSnapshot ( OutputStream os ) throws IOException { stateEngine . prepareForWrite ( ) ; DataOutputStream dos = new DataOutputStream ( os ) ; writeHeader ( dos , stateEngine . getSchemas ( ) , false ) ; VarInt . writeVInt ( dos , stateEngine . getOrderedTypeStates ( ) . size ( ) ) ; SimultaneousExecutor executor = new SimultaneousExecutor ( getClass ( ) , "write-snapshot" ) ; for ( final HollowTypeWriteState typeState : stateEngine . getOrderedTypeStates ( ) ) { executor . execute ( new Runnable ( ) { public void run ( ) { typeState . calculateSnapshot ( ) ; } } ) ; } try { executor . awaitSuccessfulCompletion ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } for ( HollowTypeWriteState typeState : stateEngine . getOrderedTypeStates ( ) ) { HollowSchema schema = typeState . getSchema ( ) ; schema . writeTo ( dos ) ; writeNumShards ( dos , typeState . getNumShards ( ) ) ; typeState . writeSnapshot ( dos ) ; } os . flush ( ) ; }
Write the current state as a snapshot blob .