frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Ask HN: Is this a sane way to expose distributed state in Rust?

1•asdfghjqwertyu•1mo ago
Hi HN,

I’m experimenting with a Rust runtime that exposes replicated, consensus-backed state by advertising a *procedural macro*. Client crates invoke the macro and get a typed API; the runtime owns both the protocol and the codegen.

At a high level, the DB cell:

* Handles RPC (Upsert / Get / Remove) * Coordinates macro expansion for client APIs * Stores opaque zero-copy blobs (`rkyv`)

Here’s the core of the DB side:

```rust use cell_sdk::; use cell_model::macro_coordination::; use std::pin::Pin;

#[protein] pub struct Upsert { pub key: u64, pub kind: String, pub blob: Vec<u8>, }

#[protein] pub struct Get { pub key: u64, pub kind: String }

#[protein] pub struct Row { pub blob: Option<Vec<u8>> }

#[service] #[derive(Clone)] struct DbService { state: Arc<RwLock<HashMap<(u64, String), Vec<u8>>>>, }

#[handler] impl DbService { async fn upsert(&self, u: Upsert) -> Result<bool> { self.state.write().await.insert((u.key, u.kind), u.blob); Ok(true) } async fn get(&self, g: Get) -> Result<Row> { let val = self.state.read().await.get(&(g.key, g.kind)).cloned(); Ok(Row { blob: val }) } async fn remove(&self, k: u64, kind: String) -> Result<bool> { Ok(self.state.write().await.remove(&(k, kind)).is_some()) } }

fn expand_table(ctx: &ExpansionContext) -> Pin<Box<dyn Future<Output=Result<String>> + Send + '_>> { Box::pin(async move { let struct_name = &ctx.struct_name; let pk = ctx.fields.first().unwrap().0.clone();

        Ok(format!(r#"
            pub struct {struct_name}Table {{ synapse: ::cell_sdk::Synapse }}
            impl {struct_name}Table {{
                pub async fn connect() -> ::anyhow::Result<Self> {{
                    Ok(Self {{ synapse: ::cell_sdk::Synapse::grow("db").await? }})
                }}
                pub async fn save(&self, row: {struct_name}) -> ::anyhow::Result<bool> {{
                    let bytes = ::cell_sdk::rkyv::to_bytes::<_,1024>(&row)?.into_vec();
                    let req = DbProtocol::Upsert {{
                        key: row.{pk},
                        kind: "{struct_name}".into(),
                        blob: bytes,
                    }};
                    self.synapse.fire(&req).await
                }}
            }}
        "#))
    })
}

#[tokio::main] async fn main() -> Result<()> { let db = DbService { state: Default::default() };

    const macros = vec![MacroInfo {
        name: "table".into(),
        kind: MacroKind::Attribute,
        description: "distributed table".into(),
        dependencies: vec![],
    }];

    Runtime::ignite_with_coordination(
        move |req| db.dispatch(req),
        "db",
        macros,
        expand_table,
    ).await
} ```

consumer

```rust use cell_sdk::;

#[expand("db", "table")] #[derive(Archive, Serialize, Clone, Debug)] pub struct Order { pub order_id: u64, pub user_id: u64, pub amount: u64, }

#[tokio::main] async fn main() -> anyhow::Result<()> { let orders = OrderTable::connect().await?;

    orders.save(Order { order_id: 42, user_id: 7, amount: 1000 }).await?;
    let o = orders.get(42).await?.unwrap();
    println!("loaded {o:?}");

    orders.remove(42).await?;
    Ok(())
} ```

The question: *does letting a distributed service own both its protocol and client-side macro make sense, or is this hiding too much complexity?* And: Would this actually be useful for enterprise? Would you use it?

Thanks — looking for design-level feedback, not users.

Show HN: Mermaid Formatter – CLI and library to auto-format Mermaid diagrams

https://github.com/chenyanchen/mermaid-formatter
1•astm•13m ago•0 comments

RFCs vs. READMEs: The Evolution of Protocols

https://h3manth.com/scribe/rfcs-vs-readmes/
2•init0•20m ago•1 comments

Kanchipuram Saris and Thinking Machines

https://altermag.com/articles/kanchipuram-saris-and-thinking-machines
1•trojanalert•20m ago•0 comments

Chinese chemical supplier causes global baby formula recall

https://www.reuters.com/business/healthcare-pharmaceuticals/nestle-widens-french-infant-formula-r...
1•fkdk•23m ago•0 comments

I've used AI to write 100% of my code for a year as an engineer

https://old.reddit.com/r/ClaudeCode/comments/1qxvobt/ive_used_ai_to_write_100_of_my_code_for_1_ye...
1•ukuina•25m ago•1 comments

Looking for 4 Autistic Co-Founders for AI Startup (Equity-Based)

1•au-ai-aisl•35m ago•1 comments

AI-native capabilities, a new API Catalog, and updated plans and pricing

https://blog.postman.com/new-capabilities-march-2026/
1•thunderbong•36m ago•0 comments

What changed in tech from 2010 to 2020?

https://www.tedsanders.com/what-changed-in-tech-from-2010-to-2020/
2•endorphine•41m ago•0 comments

From Human Ergonomics to Agent Ergonomics

https://wesmckinney.com/blog/agent-ergonomics/
1•Anon84•45m ago•0 comments

Advanced Inertial Reference Sphere

https://en.wikipedia.org/wiki/Advanced_Inertial_Reference_Sphere
1•cyanf•46m ago•0 comments

Toyota Developing a Console-Grade, Open-Source Game Engine with Flutter and Dart

https://www.phoronix.com/news/Fluorite-Toyota-Game-Engine
1•computer23•48m ago•0 comments

Typing for Love or Money: The Hidden Labor Behind Modern Literary Masterpieces

https://publicdomainreview.org/essay/typing-for-love-or-money/
1•prismatic•49m ago•0 comments

Show HN: A longitudinal health record built from fragmented medical data

https://myaether.live
1•takmak007•52m ago•0 comments

CoreWeave's $30B Bet on GPU Market Infrastructure

https://davefriedman.substack.com/p/coreweaves-30-billion-bet-on-gpu
1•gmays•1h ago•0 comments

Creating and Hosting a Static Website on Cloudflare for Free

https://benjaminsmallwood.com/blog/creating-and-hosting-a-static-website-on-cloudflare-for-free/
1•bensmallwood•1h ago•1 comments

"The Stanford scam proves America is becoming a nation of grifters"

https://www.thetimes.com/us/news-today/article/students-stanford-grifters-ivy-league-w2g5z768z
3•cwwc•1h ago•0 comments

Elon Musk on Space GPUs, AI, Optimus, and His Manufacturing Method

https://cheekypint.substack.com/p/elon-musk-on-space-gpus-ai-optimus
2•simonebrunozzi•1h ago•0 comments

X (Twitter) is back with a new X API Pay-Per-Use model

https://developer.x.com/
3•eeko_systems•1h ago•0 comments

Zlob.h 100% POSIX and glibc compatible globbing lib that is faste and better

https://github.com/dmtrKovalenko/zlob
3•neogoose•1h ago•1 comments

Show HN: Deterministic signal triangulation using a fixed .72% variance constant

https://github.com/mabrucker85-prog/Project_Lance_Core
2•mav5431•1h ago•1 comments

Scientists Discover Levitating Time Crystals You Can Hold, Defy Newton’s 3rd Law

https://phys.org/news/2026-02-scientists-levitating-crystals.html
3•sizzle•1h ago•0 comments

When Michelangelo Met Titian

https://www.wsj.com/arts-culture/books/michelangelo-titian-review-the-renaissances-odd-couple-e34...
1•keiferski•1h ago•0 comments

Solving NYT Pips with DLX

https://github.com/DonoG/NYTPips4Processing
1•impossiblecode•1h ago•1 comments

Baldur's Gate to be turned into TV series – without the game's developers

https://www.bbc.com/news/articles/c24g457y534o
3•vunderba•1h ago•0 comments

Interview with 'Just use a VPS' bro (OpenClaw version) [video]

https://www.youtube.com/watch?v=40SnEd1RWUU
2•dangtony98•1h ago•0 comments

EchoJEPA: Latent Predictive Foundation Model for Echocardiography

https://github.com/bowang-lab/EchoJEPA
1•euvin•1h ago•0 comments

Disablling Go Telemetry

https://go.dev/doc/telemetry
1•1vuio0pswjnm7•1h ago•0 comments

Effective Nihilism

https://www.effectivenihilism.org/
1•abetusk•1h ago•1 comments

The UK government didn't want you to see this report on ecosystem collapse

https://www.theguardian.com/commentisfree/2026/jan/27/uk-government-report-ecosystem-collapse-foi...
5•pabs3•1h ago•0 comments

No 10 blocks report on impact of rainforest collapse on food prices

https://www.thetimes.com/uk/environment/article/no-10-blocks-report-on-impact-of-rainforest-colla...
3•pabs3•1h ago•0 comments