Hyperlinkv0.8.0-beta.28

HashRing

HashRing.hasconsteffect/HashRing.ts:274
<A extends PrimaryKey.PrimaryKey>(node: A): (self: HashRing<A>) => boolean
<A extends PrimaryKey.PrimaryKey>(self: HashRing<A>, node: A): boolean

Checks whether the ring contains a node with the same PrimaryKey value.

When to use

Use when you need to know whether registering a node would update an existing ring member because another node already has the same primary-key identity.

Details

Membership is checked with self.nodes.has(PrimaryKey.value(node)), so matching is by primary key, not object identity or weight.

combinatorsaddremoveget
export const has: {
  <A extends PrimaryKey.PrimaryKey>(node: A): (self: HashRing<A>) => boolean
  <A extends PrimaryKey.PrimaryKey>(self: HashRing<A>, node: A): boolean
} = dual(
  2,
  <A extends PrimaryKey.PrimaryKey>(self: HashRing<A>, node: A): boolean => self.nodes.has(PrimaryKey.value(node))
)