Skip to main content

Database

Struct Database 

Source
pub struct Database(/* private fields */);

Implementations§

Source§

impl Database

Source

pub async fn get_bucket_info( &self, id: &Uuid, ) -> Result<Option<BucketInfo>, Error>

Get bucket info by ID from the latest bucket_log entry

Source

pub async fn list_buckets( &self, prefix: Option<String>, limit: Option<u32>, ) -> Result<Vec<BucketInfo>, Error>

List all buckets from the latest bucket_log entries

Source

pub async fn get_bucket_logs( &self, bucket_id: &Uuid, page: u32, page_size: u32, ) -> Result<Vec<BucketLogEntry>, Error>

Get paginated bucket log entries for a specific bucket

Source

pub async fn get_all_bucket_logs( &self, bucket_id: &Uuid, ) -> Result<Vec<BucketLogEntry>, Error>

Get all bucket log entries for a specific bucket (unpaginated, for tree view)

Source

pub async fn get_bucket_log_count(&self, bucket_id: &Uuid) -> Result<i64, Error>

Get total count of log entries for a bucket

Source§

impl Database

Source

pub async fn connect(database_url: &Url) -> Result<Self, DatabaseSetupError>

Source

pub fn new(pool: SqlitePool) -> Self

Trait Implementations§

Source§

impl AsRef<Database> for State

Source§

fn as_ref(&self) -> &Database

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl BucketLogProvider for Database

Source§

type Error = Error

Source§

fn exists<'life0, 'async_trait>( &'life0 self, id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<bool, BucketLogError<Self::Error>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn heads<'life0, 'async_trait>( &'life0 self, id: Uuid, height: u64, ) -> Pin<Box<dyn Future<Output = Result<Vec<Link>, BucketLogError<Self::Error>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the possible heads for a bucket based on passed height Read more
Source§

fn append<'life0, 'async_trait>( &'life0 self, id: Uuid, name: String, current: Link, previous: Option<Link>, height: u64, published: bool, ) -> Pin<Box<dyn Future<Output = Result<(), BucketLogError<Self::Error>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Append a version of the bucket to the log Read more
Source§

fn height<'life0, 'async_trait>( &'life0 self, id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<u64, BucketLogError<Self::Error>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return the greatest height of the bucket version within the chain Read more
Source§

fn has<'life0, 'async_trait>( &'life0 self, id: Uuid, link: Link, ) -> Pin<Box<dyn Future<Output = Result<Vec<u64>, BucketLogError<Self::Error>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Check if a link exists within a bucket Read more
Source§

fn list_buckets<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Uuid>, BucketLogError<Self::Error>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List all bucket IDs that have log entries Read more
Source§

fn latest_published<'life0, 'async_trait>( &'life0 self, id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Option<(Link, u64)>, BucketLogError<Self::Error>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the latest published version of a bucket Read more
Source§

fn head<'life0, 'async_trait>( &'life0 self, id: Uuid, height: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<(Link, u64), BucketLogError<Self::Error>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Get the peers canonical head based on its log entries
Source§

impl Clone for Database

Source§

fn clone(&self) -> Database

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Database

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for Database

Source§

type Target = Pool<Sqlite>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> CompatExt for T

Source§

fn compat(self) -> Compat<T>

Applies the Compat adapter by value. Read more
Source§

fn compat_ref(&self) -> Compat<&T>

Applies the Compat adapter by shared reference. Read more
Source§

fn compat_mut(&mut self) -> Compat<&mut T>

Applies the Compat adapter by mutable reference. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

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

fn in_current_span(self) -> Instrumented<Self>

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

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ServiceExt for T

Source§

fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using HTTP status codes. Read more
Source§

fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using gRPC headers. Read more
Source§

fn follow_redirects(self) -> FollowRedirect<Self>
where Self: Sized,

Follow redirect resposes using the Standard policy. Read more
Source§

fn sensitive_headers( self, headers: impl IntoIterator<Item = HeaderName>, ) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>
where Self: Sized,

Mark headers as sensitive on both requests and responses. Read more
Source§

fn sensitive_request_headers( self, headers: impl IntoIterator<Item = HeaderName>, ) -> SetSensitiveRequestHeaders<Self>
where Self: Sized,

Mark headers as sensitive on requests. Read more
Source§

fn sensitive_response_headers( self, headers: impl IntoIterator<Item = HeaderName>, ) -> SetSensitiveResponseHeaders<Self>
where Self: Sized,

Mark headers as sensitive on responses. Read more
Source§

fn request_body_limit(self, limit: usize) -> RequestBodyLimit<Self>
where Self: Sized,

Intercept requests with over-sized payloads and convert them into 413 Payload Too Large responses. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,