コード例 #1
0
ファイル: replica_timer.cpp プロジェクト: zjc95/rDSN
        void replica::catch_up_with_private_logs(partition_status s)
        {
            learn_state state;
            _private_log->get_learn_state(
                get_gpid(),
                _app->last_committed_decree() + 1,
                state
                );

            auto err = apply_learned_state_from_private_log(state);

            tasking::enqueue(
                LPC_CHECKPOINT_REPLICA_COMPLETED,
                this,
                [this, err, s]() 
                {
                    if (PS_SECONDARY == s)
                        this->on_checkpoint_completed(err);
                    else if (PS_POTENTIAL_SECONDARY == s)
                        this->on_learn_remote_state_completed(err);
                    else
                    {
                        dassert(false, "invalid state %s", enum_to_string(s));
                    }
                },
                gpid_to_hash(get_gpid())
                );
        }
コード例 #2
0
ファイル: replica_chkpt.cpp プロジェクト: Strongc/rDSN
        void replica::catch_up_with_private_logs(partition_status s)
        {
            learn_state state;
            _private_log->get_learn_state(
                get_gpid(),
                _app->last_committed_decree() + 1,
                state
                );

            auto err = apply_learned_state_from_private_log(state);

            if (s == PS_POTENTIAL_SECONDARY)
            {
                tasking::enqueue(
                    &_potential_secondary_states.learn_remote_files_completed_task, 
                    LPC_CHECKPOINT_REPLICA_COMPLETED,
                    this,
                    [this, err]() 
                    {
                        this->on_learn_remote_state_completed(err);
                    },
                    gpid_to_hash(get_gpid())
                    );
            }
            else
            {
                tasking::enqueue(
                    &_secondary_states.checkpoint_completed_task,
                    LPC_CHECKPOINT_REPLICA_COMPLETED,
                    this,
                    [this, err]() 
                    {
                        this->on_checkpoint_completed(err);
                    },
                    gpid_to_hash(get_gpid())
                    );
            }
        }