Skip to content

FIXME: The Membership.apply method is too complex #194

@ktoso

Description

@ktoso

Current:

    mutating func apply(_ change: MembershipChange) -> MembershipChange? {
        switch change.toStatus {
        case .joining:
            if self.uniqueMember(change.node) != nil {
                // If we actually already have this node, it is a MARK, not a join "over"
                return self.mark(change.node, as: change.toStatus)
            } else {
                return self.join(change.node)
            }
        case let status:
            if self.firstMember(change.node.node) == nil { // TODO more general? // TODO this entire method should be simpler
                self.join(change.node)
            }
            return self.mark(change.node, as: status)
        }
    }

is way to complex. We need to cover the entire spectrum of what applying what means -- including node "replacements", in ANY state (e.g. someone told me about a new node and it's up etc). and make the apply handle those well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    follow-upOutcome of a review which can be addressed at different timet:cluster:membership

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions