//
 // [DSN_CHKPT_LEARN]
 // after learn the state from learner, apply the learned state to the local app
 //
 // Or,
 //
 // [DSN_CHKPT_COPY]
 // when an app only implement synchonous checkpoint, the primary replica
 // needs to copy checkpoint from secondaries instead of
 // doing checkpointing by itself, in order to not stall the normal
 // write operations.
 //
 // Postconditions:
 // * after apply_checkpoint() done, last_committed_decree() == last_durable_decree()
 //
 public abstract ErrorCode ApplyCheckpoint(dsn_app_learn_state state, dsn_chkpt_apply_mode mode);
        private static int app_apply_checkpoint(IntPtr app_handle, dsn_app_learn_state state, dsn_chkpt_apply_mode mode)
        {
            var sapp = (((GCHandle)app_handle).Target as ServiceApp) as ReplicatedServiceAppType1;

            return(sapp.ApplyCheckpoint(state, mode));
        }