Anodex
Elixir bindings for ANODE - a disk-resident approximate nearest neighbor (ANN) search system.
Features
- Disk-resident: Handles datasets larger than RAM
- Lock-free concurrent operations: High throughput for mixed read/write workloads
- Automatic sharding: Manode automatically partitions data across shards
- Formal recall guarantees: Staleness tracking with theoretical recall bounds
Installation
Add anodex to your dependencies in mix.exs:
def deps do
[
{:anodex, "~> 0.1"}
]
endUsage
# Create an index
opts = %Anodex.Options{
dimension: 128,
data_dir: "/var/lib/myapp/vectors",
name: "embeddings",
compaction_threshold: 100_000
}
{:ok, index} = Anodex.Manode.new(opts)
# Insert vectors
:ok = Anodex.Manode.insert(index, {1, embedding_vector})
# Search for nearest neighbors
{:ok, results} = Anodex.Manode.search(index, query_vector, 10)
# Returns [{distance, id}, ...]
# Shutdown (persists to disk)
:ok = Anodex.Manode.shutdown(index)Requirements
- Elixir >= 1.17
- Linux with io_uring support (kernel 5.1+)
-
Rust toolchain only if building from source (
ANODEX_BUILD=true)
Releasing
Bump version in
mix.exs:@version "0.2.0"Push to master — triggers precompiled NIF builds automatically.
Wait for CI — the "Build Precompiled NIFs" workflow uploads artifacts to spiredb/anodex releases
Download checksums and publish to Hex:
mix rustler_precompiled.download Anodex.Native --all --print mix hex.publish
GitHub Actions Workflows
| Workflow | Trigger | Purpose |
|---|---|---|
| CI | Push/PR | Runs Rust and Elixir tests |
| Build Precompiled NIFs | Push to master (anodex/anode changes) | Builds NIFs for x86_64-linux, uploads to spiredb/anodex |
| Publish to Hex.pm | GitHub release or manual | Downloads checksums, publishes to Hex |
Manual triggers — all workflows support workflow_dispatch:
- Go to Actions tab
- Select workflow
- Click "Run workflow"
License
MIT