lambrospetrou / durable-utils

Utilities for Cloudflare Durable Objects and Workers
MIT License
6 stars 0 forks source link

Global Eventually Replicated DO #4

Open lambrospetrou opened 3 weeks ago

lambrospetrou commented 3 weeks ago

I want to provide a Durable Objects (DO) abstraction that replicates the data of a DO to N other DOs in different regions.

This is going to be strictly for backup/disaster recovery purposes, and not for distributed transactions, therefore eventual replication is OK.

Something similar to DynamoDB Global Tables, but for DOs.

Examples

const rdoAPrefixKey = "migrations_metadata";
const rdoALeaderLocationHint = "eeur";
const rdoA = new GlobalReplicatedDO(rdoAPrefixKey, rdoALeaderLocationHint);

await rdoA.put("key-1", "value1");

// After a few (milli)seconds the above will be propagated everywhere.
// The following should reach the DO closest to your location to read the value.
rdoA.get("key-1");