Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(feat) Adds new method stateChanged(peerId, newState) for ReplicatorS… #558

Merged
merged 2 commits into from
Mar 19, 2021

Conversation

killme2008
Copy link
Contributor

@killme2008 killme2008 commented Mar 16, 2021

Motivation:

Track replicator state #521

Modification:

Adds a new method to ReplicatorStateListener

   /**
         * Called when the replicator state is changed. See {@link ReplicatorState}
         * @param peer the replicator's peer id.
         * @param newState the new replicator state.
         * @since 1.3.6
         */
        default void stateChanged(final PeerId peer, final ReplicatorState newState) {}

And a new enum type ReplicatorState:

     /**
       * Represents state changes in the replicator.
       * @author boyan(boyan@antfin.com)
       *
       */
      enum ReplicatorState{
        /**
         * The replicator is created.
         */
        CREATED,
        /**
         * The replicator is destroyed.
         */
        DESTROYED,
        /**
         * The replicator begins to doing it's job(replicating logs or installing snapshot).
         */
        ONLINE,
        /**
         * The replicaotr is suspended by raft error or lost connection.
         */
        OFFLINE
      }

Users can use this API to track the replicator state for some purposes.

Result:

Fixes #521

@killme2008 killme2008 force-pushed the feature/improve-replicator-state-listener branch from 102c3dc to 8051538 Compare March 16, 2021 06:54
@killme2008 killme2008 requested review from fengjiachun, SteNicholas and zongtanghu and removed request for SteNicholas March 17, 2021 11:21
@killme2008
Copy link
Contributor Author

@fengjiachun 这个 check好像不 work 了?

@fengjiachun
Copy link
Contributor

@fengjiachun 这个 check好像不 work 了?

check format 失败,你应该没执行格式化代码

Copy link
Contributor

@fengjiachun fengjiachun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fengjiachun fengjiachun requested review from SteNicholas and removed request for zongtanghu March 19, 2021 02:44
@SteNicholas SteNicholas merged commit 1d9290a into master Mar 19, 2021
@fengjiachun fengjiachun deleted the feature/improve-replicator-state-listener branch March 19, 2021 02:59
@fengjiachun fengjiachun mentioned this pull request Apr 7, 2021
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide a listener API for tracking cluster member state
3 participants