consistent_hashing

command module
v0.0.0-...-c1d3cb6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2023 License: MIT Imports: 4 Imported by: 0

README

Consistent Hashing in Go

This is a basic implementation of consistent hashing in Go. Consistent hashing is a technique used in distributed computing to evenly distribute data across multiple nodes in a cluster.

Installation

To use this package in your Go project, you can install it using go get:

go get github.com/irononet/consistent_hashing

Usage

Here's an example of how to use this package:

package main

import (
	"fmt"
	"github.com/irononet/consistent_hashing"
)

func main() {
	// Create a new ConsistentHash instance with 3 replicas and 3 nodes.
	chash := consistent_hashing.NewConsistentHash(3, []string{"node1", "node2", "node3"})

	// Get the node that each key belongs to.
	node := chash.GetNode("my_key")

	fmt.Printf("my_key belongs to node %s\n", node)
}

Contributing

Contributions are welcome! If you find a bug or have a feature request, please open an issue on GitHub. If you want to contribute code, please fork the repository and submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL