pub struct MultipartTable {
db: Arc<Database>,
}Expand description
Typed wrapper around the multipart_active redb table.
Clone-safe: the inner Arc<Database> is cheap to clone.
Fields§
§db: Arc<Database>Implementations§
Source§impl MultipartTable
impl MultipartTable
Sourcepub fn new(db: Arc<Database>) -> Result<Self, AppError>
pub fn new(db: Arc<Database>) -> Result<Self, AppError>
Create a MultipartTable bound to an existing redb Database.
This opens (and, if necessary, creates) the multipart_active table
inside the provided database. Reusing the same Database instance as
CacheStore avoids holding two file handles on cache.redb.
fn make_key(profile: &ProfileId, bucket: &BucketId, key: &str) -> String
Sourcepub fn record(&self, rec: &MultipartRecord) -> Result<(), AppError>
pub fn record(&self, rec: &MultipartRecord) -> Result<(), AppError>
Insert or overwrite a MultipartRecord.
Overwrites any existing record for the same (profile, bucket, key).
Sourcepub fn remove(
&self,
profile: &ProfileId,
bucket: &BucketId,
key: &str,
) -> Result<(), AppError>
pub fn remove( &self, profile: &ProfileId, bucket: &BucketId, key: &str, ) -> Result<(), AppError>
Delete the record for (profile, bucket, key).
No-op when the entry does not exist.
Sourcepub fn list_all(&self) -> Result<Vec<MultipartRecord>, AppError>
pub fn list_all(&self) -> Result<Vec<MultipartRecord>, AppError>
Return all active multipart upload records.
Sourcepub fn list_for_profile(
&self,
profile: &ProfileId,
) -> Result<Vec<MultipartRecord>, AppError>
pub fn list_for_profile( &self, profile: &ProfileId, ) -> Result<Vec<MultipartRecord>, AppError>
Return all active records for profile.
Sourcepub fn find_by_upload_id(
&self,
upload_id: &str,
) -> Result<Option<MultipartRecord>, AppError>
pub fn find_by_upload_id( &self, upload_id: &str, ) -> Result<Option<MultipartRecord>, AppError>
Linear scan to find a record by its upload_id.
Used by the cleanup scanner (task 38) to correlate uploads reported by
S3 list_multipart_uploads with brows3r bookkeeping records.
Trait Implementations§
Source§impl Clone for MultipartTable
impl Clone for MultipartTable
Source§fn clone(&self) -> MultipartTable
fn clone(&self) -> MultipartTable
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for MultipartTable
impl !RefUnwindSafe for MultipartTable
impl Send for MultipartTable
impl Sync for MultipartTable
impl Unpin for MultipartTable
impl UnsafeUnpin for MultipartTable
impl !UnwindSafe for MultipartTable
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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