top | item 46454111

(no title)

tristenharr | 2 months ago

Happy new year HN! After a few late nights this past week, I've finally got this one over the finish line just in time to kick the year off.

I'm happy to answer any questions that might pop up...

Some things of note:

Built-in P2P Mesh Networking

Listen on "/ip4/0.0.0.0/tcp/8080". Connect to "/ip4/192.168.1.5/tcp/8080". Sync counter on "game-room".

That's all you need for libp2p, QUIC transport, mDNS discovery, GossipSub pub/sub

Full conflict-free replicated data types: - GCounter, PNCounter — distributed counters - ORSet with configurable AddWins/RemoveWins bias - RGA, YATA — sequence CRDTs for collaborative text editing - Vector clocks, dot contexts, delta CRDTs

Wrap any CRDT in Distributed<T> and get: - Automatic journaling to disk (CRC32 checksums, auto-compaction at 1000 entries) - Automatic GossipSub replication to all peers - Unified flow: Local mutation → Journal → Network. Remote update → RAM → Journal. - Survives restarts, offline nodes, network partitions.

Go-Style Concurrency - TaskHandle<T> — spawnable async tasks with abort - Pipe<T> — bounded channels (sender/receiver split) - check_preemption() — cooperative yielding every 10ms for fairness

There's more... but those are my personal favorite features.

I've put a good bit of work into this, so I hope you all can appreciate and maybe find some uses for it here on my favorite place on the interwebs!

discuss

order

tombert|1 month ago

These features seem considerably more interesting than the "English to Rust" feature. These data structures and the concurrency stuff seems pretty neat.

nextaccountic|1 month ago

> Wrap any CRDT in Distributed<T>

Is this in a crate in crates.io?

koakuma-chan|1 month ago

Do I really want to yield every 10 ms?

gpm|1 month ago

You already do, to the kernel. It's probably not much more costly to do so an extra time in userspace.