LemmyNet / activitypub-federation-rust

High-level Rust library for the Activitypub protocol
GNU Affero General Public License v3.0
409 stars 46 forks source link

Examples on how to implement Object Trait for persistent storage like Sqlite #77

Closed MarcCoquand closed 9 months ago

MarcCoquand commented 10 months ago

Hey! I'm trying out this crate to setup an activitypub server.

I am not too familiar with Rust and tried to implement the Object trait for my Sqlite implementation. However, I found it unclear how to best implement "DataType". My assumption is from the example

    type DataType = DbConnection;

That it should be some connection to the sql database akin to SqliteConnection in Diesel. However, SqliteConnection does not implement Clone+Share+Send, so it's not obvious to me what I should implement there for it to work. Any pointers? I looked at the examples and they seem to do it without a real database implementation, so it didn't help me too much.

Nutomic commented 10 months ago

You need to wrap it in Arc then.