Skip to content

Commit

Permalink
adjust API naming style
Browse files Browse the repository at this point in the history
  • Loading branch information
koushiro committed Oct 31, 2024
1 parent 5e4a516 commit 5fdd515
Show file tree
Hide file tree
Showing 52 changed files with 153 additions and 153 deletions.
2 changes: 1 addition & 1 deletion core/src/layers/blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ impl<A: Access> LayeredAccess for BlockingAccessor<A> {
fn metadata(&self) -> Arc<AccessorInfo> {
let info = self.inner.info().as_ref().clone();
let cap = info.full_capability();
info.set_full_capability(Capability {
info.with_full_capability(Capability {
blocking: true,
..cap
})
Expand Down
4 changes: 2 additions & 2 deletions core/src/layers/complete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ impl<A: Access> LayeredAccess for CompleteAccessor<A> {
fn metadata(&self) -> Arc<AccessorInfo> {
let info = (*self.meta).clone();
let cap = info.full_capability();
info.set_full_capability(Capability {
info.with_full_capability(Capability {
create_dir: cap.list && cap.write_can_empty,
..cap
})
Expand Down Expand Up @@ -730,7 +730,7 @@ mod tests {

fn info(&self) -> Arc<AccessorInfo> {
AccessorInfo::default()
.set_native_capability(self.capability)
.with_native_capability(self.capability)
.into()
}

Expand Down
2 changes: 1 addition & 1 deletion core/src/layers/immutable_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ impl<A: Access> LayeredAccess for ImmutableIndexAccessor<A> {
fn metadata(&self) -> Arc<AccessorInfo> {
let info = (*self.inner.info()).clone();
let cap = info.full_capability();
info.set_full_capability(Capability {
info.with_full_capability(Capability {
list: true,
list_with_recursive: true,
..cap
Expand Down
2 changes: 1 addition & 1 deletion core/src/layers/retry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ mod tests {

fn info(&self) -> Arc<AccessorInfo> {
AccessorInfo::default()
.set_native_capability(Capability {
.with_native_capability(Capability {
read: true,
write: true,
write_can_multi: true,
Expand Down
2 changes: 1 addition & 1 deletion core/src/layers/timeout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ mod tests {

fn info(&self) -> Arc<AccessorInfo> {
AccessorInfo::default()
.set_native_capability(Capability {
.with_native_capability(Capability {
read: true,
delete: true,
..Default::default()
Expand Down
10 changes: 5 additions & 5 deletions core/src/raw/accessor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ impl AccessorInfo {
}

/// Set [`Scheme`] for backend.
pub fn set_scheme(mut self, scheme: Scheme) -> Self {
pub fn with_scheme(mut self, scheme: Scheme) -> Self {
self.scheme = scheme;
self
}
Expand All @@ -863,7 +863,7 @@ impl AccessorInfo {
/// Set root for backend.
///
/// Note: input root must be normalized.
pub fn set_root(mut self, root: &str) -> Self {
pub fn with_root(mut self, root: &str) -> Self {
self.root = root.to_string();
self
}
Expand All @@ -879,7 +879,7 @@ impl AccessorInfo {
}

/// Set name of this backend.
pub fn set_name(mut self, name: &str) -> Self {
pub fn with_name(mut self, name: &str) -> Self {
self.name = name.to_string();
self
}
Expand All @@ -894,7 +894,7 @@ impl AccessorInfo {
/// # NOTES
///
/// Set native capability will also flush the full capability.
pub fn set_native_capability(mut self, capability: Capability) -> Self {
pub fn with_native_capability(mut self, capability: Capability) -> Self {
self.native_capability = capability;
self.full_capability = capability;
self
Expand All @@ -906,7 +906,7 @@ impl AccessorInfo {
}

/// Set full capabilities for service.
pub fn set_full_capability(mut self, capability: Capability) -> Self {
pub fn with_full_capability(mut self, capability: Capability) -> Self {
self.full_capability = capability;
self
}
Expand Down
8 changes: 4 additions & 4 deletions core/src/raw/adapters/kv/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ impl<S: Adapter> Access for Backend<S> {
let kv_cap = kv_info.capabilities();

AccessorInfo::default()
.set_scheme(kv_info.scheme())
.set_name(kv_info.name())
.set_root(&self.root)
.set_native_capability(Capability {
.with_scheme(kv_info.scheme())
.with_name(kv_info.name())
.with_root(&self.root)
.with_native_capability(Capability {
stat: kv_cap.read,

write_can_empty: kv_cap.write,
Expand Down
8 changes: 4 additions & 4 deletions core/src/raw/adapters/typed_kv/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ impl<S: Adapter> Access for Backend<S> {
let kv_cap = kv_info.capabilities();

AccessorInfo::default()
.set_root(&self.root)
.set_scheme(kv_info.scheme())
.set_name(kv_info.name())
.set_native_capability(Capability {
.with_root(&self.root)
.with_scheme(kv_info.scheme())
.with_name(kv_info.name())
.with_native_capability(Capability {
read: kv_cap.get,
stat: kv_cap.get,

Expand Down
2 changes: 1 addition & 1 deletion core/src/raw/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ mod tests {
type BlockingLister = ();

fn info(&self) -> Arc<AccessorInfo> {
Arc::new(AccessorInfo::default().set_scheme(Scheme::Custom("test")))
Arc::new(AccessorInfo::default().with_scheme(Scheme::Custom("test")))
}

async fn delete(&self, _: &str, _: OpDelete) -> Result<RpDelete> {
Expand Down
2 changes: 1 addition & 1 deletion core/src/raw/oio/list/flat_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ mod tests {
fn info(&self) -> Arc<AccessorInfo> {
let info = AccessorInfo::default();
let cap = info.full_capability();
info.set_full_capability(Capability { list: true, ..cap })
info.with_full_capability(Capability { list: true, ..cap })
.into()
}

Expand Down
6 changes: 3 additions & 3 deletions core/src/services/aliyun_drive/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ impl Access for AliyunDriveBackend {

fn info(&self) -> Arc<AccessorInfo> {
AccessorInfo::default()
.set_scheme(Scheme::AliyunDrive)
.set_root(&self.core.root)
.set_native_capability(Capability {
.with_scheme(Scheme::AliyunDrive)
.with_root(&self.core.root)
.with_native_capability(Capability {
stat: true,
create_dir: true,
read: true,
Expand Down
6 changes: 3 additions & 3 deletions core/src/services/alluxio/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ impl Access for AlluxioBackend {

fn info(&self) -> Arc<AccessorInfo> {
AccessorInfo::default()
.set_scheme(Scheme::Alluxio)
.set_root(&self.core.root)
.set_native_capability(Capability {
.with_scheme(Scheme::Alluxio)
.with_root(&self.core.root)
.with_native_capability(Capability {
stat: true,

// FIXME:
Expand Down
8 changes: 4 additions & 4 deletions core/src/services/azblob/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,10 +497,10 @@ impl Access for AzblobBackend {

fn info(&self) -> Arc<AccessorInfo> {
AccessorInfo::default()
.set_scheme(Scheme::Azblob)
.set_root(&self.core.root)
.set_name(&self.core.container)
.set_native_capability(Capability {
.with_scheme(Scheme::Azblob)
.with_root(&self.core.root)
.with_name(&self.core.container)
.with_native_capability(Capability {
stat: true,
stat_with_if_match: true,
stat_with_if_none_match: true,
Expand Down
8 changes: 4 additions & 4 deletions core/src/services/azdls/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,10 @@ impl Access for AzdlsBackend {

fn info(&self) -> Arc<AccessorInfo> {
AccessorInfo::default()
.set_scheme(Scheme::Azdls)
.set_root(&self.core.root)
.set_name(&self.core.filesystem)
.set_native_capability(Capability {
.with_scheme(Scheme::Azdls)
.with_root(&self.core.root)
.with_name(&self.core.filesystem)
.with_native_capability(Capability {
stat: true,

read: true,
Expand Down
6 changes: 3 additions & 3 deletions core/src/services/azfile/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ impl Access for AzfileBackend {

fn info(&self) -> Arc<AccessorInfo> {
AccessorInfo::default()
.set_scheme(Scheme::Azfile)
.set_root(&self.core.root)
.set_native_capability(Capability {
.with_scheme(Scheme::Azfile)
.with_root(&self.core.root)
.with_native_capability(Capability {
stat: true,

read: true,
Expand Down
6 changes: 3 additions & 3 deletions core/src/services/b2/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@ impl Access for B2Backend {

fn info(&self) -> Arc<AccessorInfo> {
AccessorInfo::default()
.set_scheme(Scheme::B2)
.set_root(&self.core.root)
.set_native_capability(Capability {
.with_scheme(Scheme::B2)
.with_root(&self.core.root)
.with_native_capability(Capability {
stat: true,

read: true,
Expand Down
6 changes: 3 additions & 3 deletions core/src/services/chainsafe/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ impl Access for ChainsafeBackend {

fn info(&self) -> Arc<AccessorInfo> {
AccessorInfo::default()
.set_scheme(Scheme::Chainsafe)
.set_root(&self.core.root)
.set_native_capability(Capability {
.with_scheme(Scheme::Chainsafe)
.with_root(&self.core.root)
.with_native_capability(Capability {
stat: true,

read: true,
Expand Down
6 changes: 3 additions & 3 deletions core/src/services/compfs/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ impl Access for CompfsBackend {

fn info(&self) -> Arc<AccessorInfo> {
AccessorInfo::default()
.set_scheme(Scheme::Compfs)
.set_root(&self.core.root.to_string_lossy())
.set_native_capability(Capability {
.with_scheme(Scheme::Compfs)
.with_root(&self.core.root.to_string_lossy())
.with_native_capability(Capability {
stat: true,

read: true,
Expand Down
8 changes: 4 additions & 4 deletions core/src/services/cos/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,10 @@ impl Access for CosBackend {

fn info(&self) -> Arc<AccessorInfo> {
AccessorInfo::default()
.set_scheme(Scheme::Cos)
.set_root(&self.core.root)
.set_name(&self.core.bucket)
.set_native_capability(Capability {
.with_scheme(Scheme::Cos)
.with_root(&self.core.root)
.with_name(&self.core.bucket)
.with_native_capability(Capability {
stat: true,
stat_with_if_match: true,
stat_with_if_none_match: true,
Expand Down
6 changes: 3 additions & 3 deletions core/src/services/dbfs/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ impl Access for DbfsBackend {

fn info(&self) -> Arc<AccessorInfo> {
AccessorInfo::default()
.set_scheme(Scheme::Dbfs)
.set_root(&self.core.root)
.set_native_capability(Capability {
.with_scheme(Scheme::Dbfs)
.with_root(&self.core.root)
.with_native_capability(Capability {
stat: true,

write: true,
Expand Down
6 changes: 3 additions & 3 deletions core/src/services/dropbox/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ impl Access for DropboxBackend {

fn info(&self) -> Arc<AccessorInfo> {
AccessorInfo::default()
.set_scheme(Scheme::Dropbox)
.set_root(&self.core.root)
.set_native_capability(Capability {
.with_scheme(Scheme::Dropbox)
.with_root(&self.core.root)
.with_native_capability(Capability {
stat: true,

read: true,
Expand Down
6 changes: 3 additions & 3 deletions core/src/services/fs/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ impl Access for FsBackend {

fn info(&self) -> Arc<AccessorInfo> {
AccessorInfo::default()
.set_scheme(Scheme::Fs)
.set_root(&self.core.root.to_string_lossy())
.set_native_capability(Capability {
.with_scheme(Scheme::Fs)
.with_root(&self.core.root.to_string_lossy())
.with_native_capability(Capability {
stat: true,

read: true,
Expand Down
6 changes: 3 additions & 3 deletions core/src/services/ftp/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,9 @@ impl Access for FtpBackend {

fn info(&self) -> Arc<AccessorInfo> {
AccessorInfo::default()
.set_scheme(Scheme::Ftp)
.set_root(&self.root)
.set_native_capability(Capability {
.with_scheme(Scheme::Ftp)
.with_root(&self.root)
.with_native_capability(Capability {
stat: true,

read: true,
Expand Down
8 changes: 4 additions & 4 deletions core/src/services/gcs/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,10 @@ impl Access for GcsBackend {

fn info(&self) -> Arc<AccessorInfo> {
AccessorInfo::default()
.set_scheme(Scheme::Gcs)
.set_root(&self.core.root)
.set_name(&self.core.bucket)
.set_native_capability(Capability {
.with_scheme(Scheme::Gcs)
.with_root(&self.core.root)
.with_name(&self.core.bucket)
.with_native_capability(Capability {
stat: true,
stat_with_if_match: true,
stat_with_if_none_match: true,
Expand Down
6 changes: 3 additions & 3 deletions core/src/services/gdrive/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ impl Access for GdriveBackend {

fn info(&self) -> Arc<AccessorInfo> {
AccessorInfo::default()
.set_scheme(Scheme::Gdrive)
.set_root(&self.core.root)
.set_native_capability(Capability {
.with_scheme(Scheme::Gdrive)
.with_root(&self.core.root)
.with_native_capability(Capability {
stat: true,

read: true,
Expand Down
8 changes: 4 additions & 4 deletions core/src/services/ghac/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,10 @@ impl Access for GhacBackend {

fn info(&self) -> Arc<AccessorInfo> {
AccessorInfo::default()
.set_scheme(Scheme::Ghac)
.set_root(&self.root)
.set_name(&self.version)
.set_native_capability(Capability {
.with_scheme(Scheme::Ghac)
.with_root(&self.root)
.with_name(&self.version)
.with_native_capability(Capability {
stat: true,

read: true,
Expand Down
6 changes: 3 additions & 3 deletions core/src/services/github/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ impl Access for GithubBackend {

fn info(&self) -> Arc<AccessorInfo> {
AccessorInfo::default()
.set_scheme(Scheme::Github)
.set_root(&self.core.root)
.set_native_capability(Capability {
.with_scheme(Scheme::Github)
.with_root(&self.core.root)
.with_native_capability(Capability {
stat: true,

read: true,
Expand Down
6 changes: 3 additions & 3 deletions core/src/services/hdfs/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@ impl Access for HdfsBackend {

fn info(&self) -> Arc<AccessorInfo> {
AccessorInfo::default()
.set_scheme(Scheme::Hdfs)
.set_root(&self.root)
.set_native_capability(Capability {
.with_scheme(Scheme::Hdfs)
.with_root(&self.root)
.with_native_capability(Capability {
stat: true,

read: true,
Expand Down
Loading

0 comments on commit 5fdd515

Please sign in to comment.