README.md

# PartitionedClusterLayout

PartitionedClusterLayout is an abstract expression of a generic state-partitioned cluster.

The goal of this library is to provide a data structure suitable for synchronizing between cluster members that encapsulates a few important concepts:

- Cluster membership
- Key-to-partition routing via [PartitionMap](https://github.com/chassisframework/partition_map)
- Optimal partition/replica placement via [BinPacker](https://github.com/chassisframework/bin_packer).

Given two of these layout structures, the library can provide diffs and range transition plans for growing and shrinking the cluster in a controlled manner.

Custom partitioning strategies replica placement strategies are supported, see [SimpleStrategy](https://github.com/chassisframework/partitioned_cluster_layout/blob/main/lib/partitioned_cluster_layout/strategies/simple_strategy.ex) for an example.


## Installation

If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `partitioned_cluster_layout` to your list of dependencies in `mix.exs`:

```elixir
def deps do
  [
    {:partitioned_cluster_layout, "~> 0.1.0"}
  ]
end
```

Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at [https://hexdocs.pm/partitioned_cluster_layout](https://hexdocs.pm/partitioned_cluster_layout).