prolly-store-mysql
MySQL-backed remote store adapter for prolly-map.
This crate implements RemoteStoreBackend using sqlx::MySqlPool. Use it
through RemoteProllyStore and AsyncProlly when your deployment standardizes
on MySQL and you want durable Prolly nodes, hints, and named roots in SQL.
Installation
[]
= "0.4"
= "0.3.0"
= { = "1", = ["macros", "rt-multi-thread"] }
When to use it
Use this adapter for applications that already operate MySQL and want Prolly map semantics without adding another durable service. It is suitable for transactional application backends, managed MySQL environments, and systems that need ordinary SQL backup, restore, and operational tooling.
Prefer PostgreSQL if your workload benefits from stronger bytea ergonomics or Postgres-specific operational features. Prefer Redis for ephemeral low-latency state and DynamoDB/Cosmos/Spanner for cloud-native managed scale.
Data model
initialize_schema creates:
prolly_nodes(cid VARBINARY(32) PRIMARY KEY, node LONGBLOB NOT NULL)prolly_hints(namespace VARBINARY(255), key VARBINARY(255), value LONGBLOB)prolly_roots(name VARBINARY(255) PRIMARY KEY, manifest LONGBLOB NOT NULL)
Nodes are content-addressed by CID. Named roots store serialized root manifests and are the stable durable handles for branches, checkpoints, and application heads.
Setup
Run MySQL locally:
Or use the Prolly service compose file from the Prolly repo root:
Set the connection URL:
Initialize schema during application startup:
# async
Basic usage
use ;
use MySqlBackend;
# async
Branching, diff, and merge
# use ;
# use MySqlBackend;
# async
Operational notes
initialize_schemais idempotent.- Strict commits validate named-root preconditions and apply node and root writes in one MySQL transaction.
- MySQL key length limits matter for named roots and hint keys; use compact binary or slash-separated names rather than large serialized metadata in the name itself.
- Node rows are content-addressed and may be shared by many roots.
- Deleting a named root does not immediately delete unreachable nodes.
Running the example
From the standalone repository root:
The example initializes schema, writes and branches a tree, diffs and merges branches, resolves a conflict, publishes a named root, and reads it back.
Testing
The integration test runs when PROLLY_STORE_MYSQL_URL is set and returns
without connecting otherwise:
Run it against a disposable database or schema. The adapter tables are shared by every client using that database.
See the prolly-map API documentation for the
async map, transaction, diff, and merge APIs used with this backend.