Damus
SatsAndSports profile picture
SatsAndSports
It might be different, but this kinda reminds me of something I'm doing with my library for processing payments cashu spilman channels.

(I have a question at the end of this long comment)

I have Rust code for processing payments, wrapped around a transport-neutral and stateless core

The wrapper needs to do complex stuff, while also managing state ("how many payments have been made on this channel so far?"). But I didn't want the wrapper to hardcode an arbitrary choice about how to store the state, e.g. SQLite

So, I have a relatively dumb 'Host' interface, where the developer specifies how state is managed. For example, it has a methods "mark_closed(channel_id)" where the developer fills in the code that writes to the database of their choice to record that a channel is now closed.

The developer will typically not call those functions directly from their code. They just call a higher level "process_payment" method in my library which does all the complex stuff and which calls the Host object when needed

The Host also handles all the "pricing policy"

Anyway, I should get back on topic and ask a question ๐Ÿ™‚: I guess you might have something similar? The MDK doesn't need to know where state is stored?

I vaguely remember dealing with this when I used the MDK a little on my toy app. I think I had to do something special to get it working with localStorage in the browser, but I forget the details