Skip to content

[pixels-daemon, common, proto] Implement Retina Heartbeat Tracking and consistent hash #1215

@AntiO2

Description

@AntiO2

Features:

  • gRPC Service Implementation: Implement the NodeServiceGrpc.NodeServiceImplBase to handle node management requests.

  • Etcd Integration: Use Etcd to store and monitor heartbeat keys (Constants.HEARTBEAT_RETINA_LITERAL).

  • Heartbeat Watcher: Implement a scheduled task (startEtcdWatcher) that periodically checks the state of Retina nodes registered in Etcd.

  • Consistent Hashing Ring Management:

    • Initialize the hashRing (TreeMap) upon startup by loading existing Retina nodes from Etcd.
    • Dynamically update the hashRing (add/remove virtual nodes) based on Etcd watcher changes (node addition/failure).
    • Implement addNodeInternal and removeNodeInternal using the configured bucketNum as the number of virtual nodes, mapping them onto the discrete hash ring.

RPC Endpoint Implementation:

  • Implement GetRetinaList to return the list of currently active Retina nodes in the hash ring.
  • Implement GetRetinaByBucket to use the consistent hashing logic (tailMap and firstKey) to assign a data key (bucket ID) to the appropriate Retina node.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions