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

Impl initialize() for engine #292

Closed
Tracked by #291
drmingdrmer opened this issue Apr 16, 2022 · 2 comments
Closed
Tracked by #291

Impl initialize() for engine #292

drmingdrmer opened this issue Apr 16, 2022 · 2 comments
Assignees

Comments

@drmingdrmer
Copy link
Member

No description provided.

@github-actions
Copy link

👋 Thanks for opening this issue!

Get help or engage by:

  • /help : to print help messages.
  • /assignme : to assign this issue to you.

@drmingdrmer drmingdrmer self-assigned this Apr 16, 2022
drmingdrmer added a commit to drmingdrmer/openraft that referenced this issue Apr 16, 2022
- Change: fix error usage for `initialize()`: new error to return:
  NotAMembershipEntry and NotInMembers;

  MissingNodeInfo should not be returned when the node to initialize is
  not a member.

- Refactor: move engine to dir engine/

- Test: add engine test for `Engine::initialize()`

- part of datafuselabs#292
drmingdrmer added a commit that referenced this issue Apr 16, 2022
- Change: fix error usage for `initialize()`: new error to return:
  NotAMembershipEntry and NotInMembers;

  MissingNodeInfo should not be returned when the node to initialize is
  not a member.

- Refactor: move engine to dir engine/

- Test: add engine test for `Engine::initialize()`

- part of #292
drmingdrmer added a commit to drmingdrmer/openraft that referenced this issue Apr 16, 2022
- Feature: impl TryFrom<BTreeMap> for Membership.

- part of datafuselabs#292
drmingdrmer added a commit that referenced this issue Apr 16, 2022
- Feature: impl TryFrom<BTreeMap> for Membership.

- part of #292
@drmingdrmer
Copy link
Member Author

Mission complete.

Initializing now is fully delegated to Engine:

    pub(super) async fn handle_init_with_config(
        &mut self,
        member_nodes: BTreeMap<C::NodeId, Option<Node>>,
    ) -> Result<(), InitializeError<C::NodeId>> {

        let membership = Membership::try_from(member_nodes)?;
        let payload = EntryPayload::<C>::Membership(membership);

        let mut entry_refs = [EntryRef::new(&payload)];
        self.core.engine.initialize(&mut entry_refs)?;
        self.run_engine_commands(&entry_refs).await?;

        Ok(())
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant