From fbb697fb6e3ee0f2329a9cdda7eb05abe59ad6bf Mon Sep 17 00:00:00 2001 From: Tochemey Date: Sat, 12 Oct 2024 15:11:42 +0100 Subject: [PATCH] docs: add the custom hasher doc to the readme --- README.md | 3 ++- hash/hasher.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 620725bd..73aaf1b4 100644 --- a/README.md +++ b/README.md @@ -411,7 +411,8 @@ Go-Akt client is equipped with a mini load-balancer that helps route requests to The cluster engine depends upon the [discovery](./discovery/provider.go) mechanism to find other nodes in the cluster. Under the hood, it leverages [Olric](https://github.com/buraksezer/olric) to scale out and guarantee performant, reliable persistence, simple scalability, partitioning (sharding), and -re-balancing out-of-the-box. _**It requires remoting to be enabled**_. +re-balancing out-of-the-box. _**It requires remoting to be enabled**_. One can implement a custom hasher for the partitioning using +the [Hasher](./hash/hasher.go) interface and the `Actor System` [option](./actors/option.go) to set it. The default hasher uses the `XXH3 algorithm`. At the moment the following providers are implemented: diff --git a/hash/hasher.go b/hash/hasher.go index de89003c..c936c62c 100644 --- a/hash/hasher.go +++ b/hash/hasher.go @@ -29,6 +29,7 @@ import ( ) // Hasher defines the hashcode generator interface. +// This help for actors partitioning when cluster mode is enabled type Hasher interface { // HashCode is responsible for generating unsigned, 64-bit hash of provided byte slice HashCode(key []byte) uint64