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

Does not render a hashRing #945

Closed
jgreenrise opened this issue Nov 4, 2023 · 0 comments
Closed

Does not render a hashRing #945

jgreenrise opened this issue Nov 4, 2023 · 0 comments

Comments

@jgreenrise
Copy link

Hello Team, Can someone help me render a hashing ?

`from diagrams import Diagram, Cluster

Create custom shapes for collectors and servers

class Collector:
def init(self, label):
self.label = label

class Server:
def init(self, label):
self.label = label

with Diagram("Consistent Hashing", show=False):
collectors = [Collector(f"Collector-{i+1}") for i in range(4)]

with Cluster("Server Pool"):
    servers = [Server(f"Server-{i+1}") for i in range(10)]

# Create connections from collectors to servers based on consistent hashing
for collector in collectors:
    # Simulate consistent hashing logic to select servers
    selected_servers = []  # Replace with actual consistent hashing algorithm
    for server in selected_servers:
        collector >> server

`

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