pub struct Database {
    pool: Pool<Postgres>,
}
Expand description

A database connection pool holder, with functions for inserting and getting ActivityPub objects to and from.

Fields

pool: Pool<Postgres>

Implementations

Creates a new connection pool and run migrations to bring the database up to speed.

Inserts the object into the database, or do nothing if it has already been inserted.

Inserts the item into the collection. Both ids must refer to objects that have been previously inserted with Database::insert.

Returns the object with the id. If the object is an “OrderedCollection”, page will be used to provide the specific “CollectionPage”, if provided.

Adds the activity with the given id to the delivery queue, to be delivered to the given inbox.

Waits until the next time there’s deliveries to be delivered.

Implementation details

Returns either when the “activitypub_inbox_delivery” channel is notified (i.e. when a new delivery is added to the db), or when the earliest “next_delivery_time_utc” is reached, whichever is first.

Returns a list of (inbox, activity to send to inbox) tuples that are due to be sent now, and marks the rows as having attempted a delivery at the time of calling this function.

Marks deliveries as failed, to be retried. The slice should contain tuples containing the (inbox_url, activity_id).

Marks deliveries as successful, clearing them out of the delivery queue. The slice should contain tuples containing the (inbox_url, activity_id).

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more