Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(core)!: Return associated builder instead #4968

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion core/src/docs/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ Service implementers should update their code to use the `Configurator` trait in

```rust
impl Configurator for MemoryConfig {
fn into_builder(self) -> impl Builder {
type Builder = MemoryBuilder;
fn into_builder(self) -> Self::Builder {
MemoryBuilder { config: self }
}
}
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/aliyun_drive/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ impl Debug for AliyunDriveConfig {
}

impl Configurator for AliyunDriveConfig {
fn into_builder(self) -> impl Builder {
type Builder = AliyunDriveBuilder;
fn into_builder(self) -> Self::Builder {
AliyunDriveBuilder {
config: self,
http_client: None,
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/alluxio/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ impl Debug for AlluxioConfig {
}

impl Configurator for AlluxioConfig {
fn into_builder(self) -> impl Builder {
type Builder = AlluxioBuilder;
fn into_builder(self) -> Self::Builder {
AlluxioBuilder {
config: self,
http_client: None,
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/atomicserver/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ impl Debug for AtomicserverConfig {
}

impl Configurator for AtomicserverConfig {
fn into_builder(self) -> impl Builder {
type Builder = AtomicserverBuilder;
fn into_builder(self) -> Self::Builder {
AtomicserverBuilder { config: self }
}
}
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/azblob/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ impl Debug for AzblobConfig {
}

impl Configurator for AzblobConfig {
fn into_builder(self) -> impl Builder {
type Builder = AzblobBuilder;
fn into_builder(self) -> Self::Builder {
AzblobBuilder {
config: self,
http_client: None,
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/azdls/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ impl Debug for AzdlsConfig {
}

impl Configurator for AzdlsConfig {
fn into_builder(self) -> impl Builder {
type Builder = AzdlsBuilder;
fn into_builder(self) -> Self::Builder {
AzdlsBuilder {
config: self,
http_client: None,
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/azfile/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ impl Debug for AzfileConfig {
}

impl Configurator for AzfileConfig {
fn into_builder(self) -> impl Builder {
type Builder = AzfileBuilder;
fn into_builder(self) -> Self::Builder {
AzfileBuilder {
config: self,
http_client: None,
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/b2/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ impl Debug for B2Config {
}

impl Configurator for B2Config {
fn into_builder(self) -> impl Builder {
type Builder = B2Builder;
fn into_builder(self) -> Self::Builder {
B2Builder {
config: self,
http_client: None,
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/cacache/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ pub struct CacacheConfig {
}

impl Configurator for CacacheConfig {
fn into_builder(self) -> impl Builder {
type Builder = CacacheBuilder;
fn into_builder(self) -> Self::Builder {
CacacheBuilder { config: self }
}
}
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/chainsafe/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ impl Debug for ChainsafeConfig {
}

impl Configurator for ChainsafeConfig {
fn into_builder(self) -> impl Builder {
type Builder = ChainsafeBuilder;
fn into_builder(self) -> Self::Builder {
ChainsafeBuilder {
config: self,
http_client: None,
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/cloudflare_kv/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ impl Debug for CloudflareKvConfig {
}

impl Configurator for CloudflareKvConfig {
fn into_builder(self) -> impl Builder {
type Builder = CloudflareKvBuilder;
fn into_builder(self) -> Self::Builder {
CloudflareKvBuilder {
config: self,
http_client: None,
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/compfs/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ pub struct CompfsConfig {
}

impl Configurator for CompfsConfig {
fn into_builder(self) -> impl Builder {
type Builder = CompfsBuilder;
fn into_builder(self) -> Self::Builder {
CompfsBuilder { config: self }
}
}
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/cos/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ impl Debug for CosConfig {
}

impl Configurator for CosConfig {
fn into_builder(self) -> impl Builder {
type Builder = CosBuilder;
fn into_builder(self) -> Self::Builder {
CosBuilder {
config: self,
http_client: None,
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/d1/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ impl Debug for D1Config {
}

impl Configurator for D1Config {
fn into_builder(self) -> impl Builder {
type Builder = D1Builder;
fn into_builder(self) -> Self::Builder {
D1Builder {
config: self,
http_client: None,
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/dashmap/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ pub struct DashmapConfig {
}

impl Configurator for DashmapConfig {
fn into_builder(self) -> impl Builder {
type Builder = DashmapBuilder;
fn into_builder(self) -> Self::Builder {
DashmapBuilder { config: self }
}
}
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/dbfs/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ impl Debug for DbfsConfig {
}

impl Configurator for DbfsConfig {
fn into_builder(self) -> impl Builder {
type Builder = DbfsBuilder;
fn into_builder(self) -> Self::Builder {
DbfsBuilder { config: self }
}
}
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/dropbox/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ impl Debug for DropboxConfig {
}

impl Configurator for DropboxConfig {
fn into_builder(self) -> impl Builder {
type Builder = DropboxBuilder;
fn into_builder(self) -> Self::Builder {
DropboxBuilder {
config: self,
http_client: None,
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/etcd/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ impl Debug for EtcdConfig {
}

impl Configurator for EtcdConfig {
fn into_builder(self) -> impl Builder {
type Builder = EtcdBuilder;
fn into_builder(self) -> Self::Builder {
EtcdBuilder { config: self }
}
}
Expand Down
13 changes: 7 additions & 6 deletions core/src/services/foundationdb/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ use crate::*;
#[derive(Default, Serialize, Deserialize, Clone, PartialEq, Eq)]
#[serde(default)]
#[non_exhaustive]
pub struct FoundationConfig {
pub struct FoundationdbConfig {
///root of the backend.
pub root: Option<String>,
///config_path for the backend.
pub config_path: Option<String>,
}

impl Debug for FoundationConfig {
impl Debug for FoundationdbConfig {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let mut ds = f.debug_struct("FoundationConfig");

Expand All @@ -55,16 +55,17 @@ impl Debug for FoundationConfig {
}
}

impl Configurator for FoundationConfig {
fn into_builder(self) -> impl Builder {
impl Configurator for FoundationdbConfig {
type Builder = FoundationdbBuilder;
fn into_builder(self) -> Self::Builder {
FoundationdbBuilder { config: self }
}
}

#[doc = include_str!("docs.md")]
#[derive(Default)]
pub struct FoundationdbBuilder {
config: FoundationConfig,
config: FoundationdbConfig,
}

impl FoundationdbBuilder {
Expand All @@ -83,7 +84,7 @@ impl FoundationdbBuilder {

impl Builder for FoundationdbBuilder {
const SCHEME: Scheme = Scheme::Foundationdb;
type Config = FoundationConfig;
type Config = FoundationdbConfig;

fn build(self) -> Result<impl Access> {
let _network = Arc::new(unsafe { foundationdb::boot() });
Expand Down
2 changes: 1 addition & 1 deletion core/src/services/foundationdb/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@

mod backend;

pub use backend::FoundationConfig;
pub use backend::FoundationdbBuilder as Foundationdb;
pub use backend::FoundationdbConfig;
3 changes: 2 additions & 1 deletion core/src/services/fs/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ pub struct FsConfig {
}

impl Configurator for FsConfig {
fn into_builder(self) -> impl Builder {
type Builder = FsBuilder;
fn into_builder(self) -> Self::Builder {
FsBuilder { config: self }
}
}
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/ftp/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ impl Debug for FtpConfig {
}

impl Configurator for FtpConfig {
fn into_builder(self) -> impl Builder {
type Builder = FtpBuilder;
fn into_builder(self) -> Self::Builder {
FtpBuilder { config: self }
}
}
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/gcs/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ impl Debug for GcsConfig {
}

impl Configurator for GcsConfig {
fn into_builder(self) -> impl Builder {
type Builder = GcsBuilder;
fn into_builder(self) -> Self::Builder {
GcsBuilder {
config: self,
http_client: None,
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/gdrive/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ impl Debug for GdriveConfig {
}

impl Configurator for GdriveConfig {
fn into_builder(self) -> impl Builder {
type Builder = GdriveBuilder;
fn into_builder(self) -> Self::Builder {
GdriveBuilder {
config: self,
http_client: None,
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/ghac/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ pub struct GhacConfig {
}

impl Configurator for GhacConfig {
fn into_builder(self) -> impl Builder {
type Builder = GhacBuilder;
fn into_builder(self) -> Self::Builder {
GhacBuilder {
config: self,
http_client: None,
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/github/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ impl Debug for GithubConfig {
}

impl Configurator for GithubConfig {
fn into_builder(self) -> impl Builder {
type Builder = GithubBuilder;
fn into_builder(self) -> Self::Builder {
GithubBuilder {
config: self,
http_client: None,
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/gridfs/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ impl Debug for GridFsConfig {
}

impl Configurator for GridFsConfig {
fn into_builder(self) -> impl Builder {
type Builder = GridFsBuilder;
fn into_builder(self) -> Self::Builder {
GridFsBuilder { config: self }
}
}
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/hdfs/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ impl Debug for HdfsConfig {
}

impl Configurator for HdfsConfig {
fn into_builder(self) -> impl Builder {
type Builder = HdfsBuilder;
fn into_builder(self) -> Self::Builder {
HdfsBuilder { config: self }
}
}
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/hdfs_native/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ impl Debug for HdfsNativeConfig {
}

impl Configurator for HdfsNativeConfig {
fn into_builder(self) -> impl Builder {
type Builder = HdfsNativeBuilder;
fn into_builder(self) -> Self::Builder {
HdfsNativeBuilder { config: self }
}
}
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/http/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ impl Debug for HttpConfig {
}

impl Configurator for HttpConfig {
fn into_builder(self) -> impl Builder {
type Builder = HttpBuilder;
fn into_builder(self) -> Self::Builder {
HttpBuilder {
config: self,
http_client: None,
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/huggingface/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ impl Debug for HuggingfaceConfig {
}

impl Configurator for HuggingfaceConfig {
fn into_builder(self) -> impl Builder {
type Builder = HuggingfaceBuilder;
fn into_builder(self) -> Self::Builder {
HuggingfaceBuilder { config: self }
}
}
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/icloud/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ impl Debug for IcloudConfig {
}

impl Configurator for IcloudConfig {
fn into_builder(self) -> impl Builder {
type Builder = IcloudBuilder;
fn into_builder(self) -> Self::Builder {
IcloudBuilder {
config: self,
http_client: None,
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/ipfs/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ pub struct IpfsConfig {
}

impl Configurator for IpfsConfig {
fn into_builder(self) -> impl Builder {
type Builder = IpfsBuilder;
fn into_builder(self) -> Self::Builder {
IpfsBuilder {
config: self,
http_client: None,
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/ipmfs/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ pub struct IpmfsConfig {
}

impl Configurator for IpmfsConfig {
fn into_builder(self) -> impl Builder {
type Builder = IpmfsBuilder;
fn into_builder(self) -> Self::Builder {
IpmfsBuilder {
config: self,
http_client: None,
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/koofr/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ impl Debug for KoofrConfig {
}

impl Configurator for KoofrConfig {
fn into_builder(self) -> impl Builder {
type Builder = KoofrBuilder;
fn into_builder(self) -> Self::Builder {
KoofrBuilder {
config: self,
http_client: None,
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/libsql/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ impl Debug for LibsqlConfig {
}

impl Configurator for LibsqlConfig {
fn into_builder(self) -> impl Builder {
type Builder = LibsqlBuilder;
fn into_builder(self) -> Self::Builder {
LibsqlBuilder { config: self }
}
}
Expand Down
Loading
Loading