coven/dev_tools.rs
1//! Development tools outside the sync protocol (E14). No store is opened and
2//! nothing about any store is checked or recorded.
3
4use crate::{ClockRef, IdSourceRef, S3Credentials, StorageConfig};
5use coven_storage::providers::{EmptiedS3Bucket, EmptyS3BucketError, ProviderConnector};
6
7/// Delete every object and abort every unfinished upload in an S3
8/// location's bucket, whatever wrote them, and return how many of each went
9/// (E14). A bucket whose root holds anything but stores' folders and the
10/// location marker is refused with `EmptyS3BucketError::OtherFiles` before
11/// anything is removed. The first failure stops it; calling again finishes.
12/// Retained versions in a versioned bucket stay. It uses the app's `clock`
13/// and `ids`, the ones given to `CovenBuilder::clock` and
14/// `CovenBuilder::id_source`, and makes none of its own.
15pub async fn empty_s3_bucket(
16 location: StorageConfig,
17 credentials: S3Credentials,
18 clock: ClockRef,
19 ids: IdSourceRef,
20) -> Result<EmptiedS3Bucket, EmptyS3BucketError> {
21 ProviderConnector::new(clock, ids).empty_s3_bucket(location, credentials).await
22}
23
24#[cfg(test)]
25#[path = "dev_tools_tests.rs"]
26mod tests;