Skip to content
Open
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
664 changes: 456 additions & 208 deletions core/core/src/raw/path.rs

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions core/core/src/services/memory/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ impl Service for MemoryBackend {
}

async fn stat(&self, _: &OperationContext, path: &str, _: OpStat) -> Result<RpStat> {
let p = build_abs_path(&self.root, path);
let p = build_absolute_path(&self.root, path);

if p == build_abs_path(&self.root, "") {
if p == build_absolute_path(&self.root, "") {
Ok(RpStat::new(Metadata::new(EntryMode::DIR)))
} else {
match self.core.get(&p)? {
Expand All @@ -150,7 +150,7 @@ impl Service for MemoryBackend {
}

fn write(&self, _ctx: &OperationContext, path: &str, args: OpWrite) -> Result<Self::Writer> {
let p = build_abs_path(&self.root, path);
let p = build_absolute_path(&self.root, path);
Ok(MemoryWriter::new(self.core.clone(), p, args))
}

Expand All @@ -162,7 +162,7 @@ impl Service for MemoryBackend {
}

fn list(&self, _ctx: &OperationContext, path: &str, args: OpList) -> Result<Self::Lister> {
let p = build_abs_path(&self.root, path);
let p = build_absolute_path(&self.root, path);
let keys = self.core.scan(&p)?;
let lister = MemoryLister::new(&self.root, keys);
let lister = oio::HierarchyLister::new(lister, path, args.recursive());
Expand Down Expand Up @@ -224,7 +224,7 @@ impl oio::StreamRead for MemoryReader {
async fn open(&self, range: BytesRange) -> Result<(RpRead, Box<dyn oio::ReadStreamDyn>)> {
let backend = &self.backend;
let path = self.path.as_str();
let p = build_abs_path(&backend.root, path);
let p = build_absolute_path(&backend.root, path);

let value = match backend.core.get(&p)? {
Some(value) => value,
Expand Down
2 changes: 1 addition & 1 deletion core/core/src/services/memory/deleter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl MemoryDeleter {

impl oio::OneShotDelete for MemoryDeleter {
async fn delete_once(&self, path: String, _: OpDelete) -> Result<()> {
let p = build_abs_path(&self.root, &path);
let p = build_absolute_path(&self.root, &path);
self.core.delete(&p)?;
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion core/core/src/services/memory/lister.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl oio::List for MemoryLister {
} else {
EntryMode::FILE
};
let mut path = build_rel_path(&self.root, &key);
let mut path = build_relative_path(&self.root, &key);
if path.is_empty() {
path = "/".to_string();
}
Expand Down
4 changes: 2 additions & 2 deletions core/services/aliyun-drive/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ impl AliyunDriveCore {

pub fn build_path(&self, path: &str, rooted: bool) -> String {
let file_path = if rooted {
build_rooted_abs_path(&self.root, path)
build_rooted_absolute_path(&self.root, path)
} else {
build_abs_path(&self.root, path)
build_absolute_path(&self.root, path)
};
let file_path = file_path.strip_suffix('/').unwrap_or(&file_path);
if file_path.is_empty() {
Expand Down
16 changes: 8 additions & 8 deletions core/services/alluxio/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl Debug for AlluxioCore {

impl AlluxioCore {
pub async fn create_dir(&self, ctx: &OperationContext, path: &str) -> Result<()> {
let path = build_rooted_abs_path(&self.root, path);
let path = build_rooted_absolute_path(&self.root, path);

let r = CreateDirRequest {
recursive: Some(true),
Expand Down Expand Up @@ -85,7 +85,7 @@ impl AlluxioCore {
}

pub async fn create_file(&self, ctx: &OperationContext, path: &str) -> Result<u64> {
let path = build_rooted_abs_path(&self.root, path);
let path = build_rooted_absolute_path(&self.root, path);

let r = CreateFileRequest {
recursive: Some(true),
Expand Down Expand Up @@ -124,7 +124,7 @@ impl AlluxioCore {
}

pub(super) async fn open_file(&self, ctx: &OperationContext, path: &str) -> Result<u64> {
let path = build_rooted_abs_path(&self.root, path);
let path = build_rooted_absolute_path(&self.root, path);

let req = Request::post(format!(
"{}/api/v1/paths/{}/open-file",
Expand Down Expand Up @@ -153,7 +153,7 @@ impl AlluxioCore {
}

pub(super) async fn delete(&self, ctx: &OperationContext, path: &str) -> Result<()> {
let path = build_rooted_abs_path(&self.root, path);
let path = build_rooted_absolute_path(&self.root, path);

let req = Request::post(format!(
"{}/api/v1/paths/{}/delete",
Expand Down Expand Up @@ -183,8 +183,8 @@ impl AlluxioCore {
}

pub(super) async fn rename(&self, ctx: &OperationContext, path: &str, dst: &str) -> Result<()> {
let path = build_rooted_abs_path(&self.root, path);
let dst = build_rooted_abs_path(&self.root, dst);
let path = build_rooted_absolute_path(&self.root, path);
let dst = build_rooted_absolute_path(&self.root, dst);

let req = Request::post(format!(
"{}/api/v1/paths/{}/rename?dst={}",
Expand All @@ -210,7 +210,7 @@ impl AlluxioCore {
}

pub(super) async fn get_status(&self, ctx: &OperationContext, path: &str) -> Result<FileInfo> {
let path = build_rooted_abs_path(&self.root, path);
let path = build_rooted_absolute_path(&self.root, path);

let req = Request::post(format!(
"{}/api/v1/paths/{}/get-status",
Expand Down Expand Up @@ -244,7 +244,7 @@ impl AlluxioCore {
ctx: &OperationContext,
path: &str,
) -> Result<Vec<FileInfo>> {
let path = build_rooted_abs_path(&self.root, path);
let path = build_rooted_absolute_path(&self.root, path);

let req = Request::post(format!(
"{}/api/v1/paths/{}/list-status",
Expand Down
2 changes: 1 addition & 1 deletion core/services/alluxio/src/lister.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl oio::PageList for AlluxioLister {
path
};
ctx.entries.push_back(Entry::new(
&build_rel_path(&self.core.root, &path),
&build_relative_path(&self.core.root, &path),
file_info.try_into()?,
));
}
Expand Down
4 changes: 2 additions & 2 deletions core/services/azblob/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ impl AzblobCore {
"{}/{}/{}",
self.endpoint,
self.container,
percent_encode_path(&build_abs_path(&self.root, path))
percent_encode_path(&build_absolute_path(&self.root, path))
)
}

Expand Down Expand Up @@ -768,7 +768,7 @@ impl AzblobCore {
delimiter: &str,
limit: Option<usize>,
) -> Result<Response<Buffer>> {
let p = build_abs_path(&self.root, path);
let p = build_absolute_path(&self.root, path);
let mut url = QueryPairsWriter::new(&format!("{}/{}", self.endpoint, self.container))
.push("restype", "container")
.push("comp", "list");
Expand Down
4 changes: 2 additions & 2 deletions core/services/azblob/src/lister.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ impl oio::PageList for AzblobLister {

for prefix in prefixes {
let de = oio::Entry::new(
&build_rel_path(&self.core.root, &prefix.name),
&build_relative_path(&self.core.root, &prefix.name),
Metadata::new(EntryMode::DIR),
);

ctx.entries.push_back(de)
}

for object in output.blobs.blob {
let mut path = build_rel_path(&self.core.root, &object.name);
let mut path = build_relative_path(&self.core.root, &object.name);
if path.is_empty() {
path = "/".to_string();
}
Expand Down
20 changes: 10 additions & 10 deletions core/services/azdls/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ impl AzdlsCore {
range: BytesRange,
args: &OpRead,
) -> Result<Response<HttpBody>> {
let p = build_abs_path(&self.root, path);
let p = build_absolute_path(&self.root, path);

let url = format!(
"{}/{}/{}",
Expand Down Expand Up @@ -168,7 +168,7 @@ impl AzdlsCore {
resource: &str,
args: &OpWrite,
) -> Result<Response<Buffer>> {
let p = build_abs_path(&self.root, path)
let p = build_absolute_path(&self.root, path)
.trim_end_matches('/')
.to_string();

Expand Down Expand Up @@ -233,8 +233,8 @@ impl AzdlsCore {
from: &str,
to: &str,
) -> Result<Response<Buffer>> {
let source = build_abs_path(&self.root, from);
let target = build_abs_path(&self.root, to);
let source = build_absolute_path(&self.root, from);
let target = build_absolute_path(&self.root, to);

let url = format!(
"{}/{}/{}",
Expand Down Expand Up @@ -269,7 +269,7 @@ impl AzdlsCore {
close: bool,
body: Buffer,
) -> Result<Response<Buffer>> {
let p = build_abs_path(&self.root, path);
let p = build_absolute_path(&self.root, path);

let mut url = format!(
"{}/{}/{}?action=append&position={}",
Expand Down Expand Up @@ -310,7 +310,7 @@ impl AzdlsCore {
position: u64,
close: bool,
) -> Result<Response<Buffer>> {
let p = build_abs_path(&self.root, path);
let p = build_absolute_path(&self.root, path);

let mut url = format!(
"{}/{}/{}?action=flush&position={}",
Expand Down Expand Up @@ -340,7 +340,7 @@ impl AzdlsCore {
ctx: &OperationContext,
path: &str,
) -> Result<Response<Buffer>> {
let p = build_abs_path(&self.root, path)
let p = build_absolute_path(&self.root, path)
.trim_end_matches('/')
.to_string();

Expand Down Expand Up @@ -422,7 +422,7 @@ impl AzdlsCore {
ctx: &OperationContext,
path: &str,
) -> Result<Response<Buffer>> {
let p = build_abs_path(&self.root, path)
let p = build_absolute_path(&self.root, path)
.trim_end_matches('/')
.to_string();

Expand All @@ -448,7 +448,7 @@ impl AzdlsCore {
ctx: &OperationContext,
path: &str,
) -> Result<Response<Buffer>> {
let p = build_abs_path(&self.root, path)
let p = build_absolute_path(&self.root, path)
.trim_end_matches('/')
.to_string();

Expand Down Expand Up @@ -509,7 +509,7 @@ impl AzdlsCore {
continuation: &str,
limit: Option<usize>,
) -> Result<Response<Buffer>> {
let p = build_abs_path(&self.root, path)
let p = build_absolute_path(&self.root, path)
.trim_end_matches('/')
.to_string();

Expand Down
2 changes: 1 addition & 1 deletion core/services/azdls/src/lister.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ impl oio::PageList for AzdlsLister {
})?)
.with_last_modified(Timestamp::parse_rfc2822(&object.last_modified)?);

let mut path = build_rel_path(&self.core.root, &object.name);
let mut path = build_relative_path(&self.core.root, &object.name);
if mode.is_dir() {
path += "/"
};
Expand Down
22 changes: 11 additions & 11 deletions core/services/azfile/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ impl AzfileCore {
path: &str,
range: BytesRange,
) -> Result<Response<HttpBody>> {
let p = build_abs_path(&self.root, path);
let p = build_absolute_path(&self.root, path);

let url = format!(
"{}/{}/{}",
Expand Down Expand Up @@ -134,7 +134,7 @@ impl AzfileCore {
size: usize,
args: &OpWrite,
) -> Result<Response<Buffer>> {
let p = build_abs_path(&self.root, path)
let p = build_absolute_path(&self.root, path)
.trim_start_matches('/')
.to_string();
let url = format!(
Expand Down Expand Up @@ -187,7 +187,7 @@ impl AzfileCore {
position: u64,
body: Buffer,
) -> Result<Response<Buffer>> {
let p = build_abs_path(&self.root, path)
let p = build_absolute_path(&self.root, path)
.trim_start_matches('/')
.to_string();

Expand Down Expand Up @@ -223,7 +223,7 @@ impl AzfileCore {
ctx: &OperationContext,
path: &str,
) -> Result<Response<Buffer>> {
let p = build_abs_path(&self.root, path);
let p = build_absolute_path(&self.root, path);
let url = format!(
"{}/{}/{}",
self.endpoint,
Expand All @@ -247,7 +247,7 @@ impl AzfileCore {
ctx: &OperationContext,
path: &str,
) -> Result<Response<Buffer>> {
let p = build_abs_path(&self.root, path);
let p = build_absolute_path(&self.root, path);

let url = format!(
"{}/{}/{}?restype=directory",
Expand All @@ -273,11 +273,11 @@ impl AzfileCore {
path: &str,
new_path: &str,
) -> Result<Response<Buffer>> {
let p = build_abs_path(&self.root, path)
let p = build_absolute_path(&self.root, path)
.trim_start_matches('/')
.to_string();

let new_p = build_abs_path(&self.root, new_path)
let new_p = build_absolute_path(&self.root, new_path)
.trim_start_matches('/')
.to_string();

Expand Down Expand Up @@ -331,7 +331,7 @@ impl AzfileCore {
ctx: &OperationContext,
path: &str,
) -> Result<Response<Buffer>> {
let p = build_abs_path(&self.root, path)
let p = build_absolute_path(&self.root, path)
.trim_start_matches('/')
.to_string();

Expand Down Expand Up @@ -360,7 +360,7 @@ impl AzfileCore {
ctx: &OperationContext,
path: &str,
) -> Result<Response<Buffer>> {
let p = build_abs_path(&self.root, path)
let p = build_absolute_path(&self.root, path)
.trim_start_matches('/')
.to_string();

Expand All @@ -387,7 +387,7 @@ impl AzfileCore {
ctx: &OperationContext,
path: &str,
) -> Result<Response<Buffer>> {
let p = build_abs_path(&self.root, path)
let p = build_absolute_path(&self.root, path)
.trim_start_matches('/')
.to_string();

Expand Down Expand Up @@ -416,7 +416,7 @@ impl AzfileCore {
limit: &Option<usize>,
continuation: &str,
) -> Result<Response<Buffer>> {
let p = build_abs_path(&self.root, path)
let p = build_absolute_path(&self.root, path)
.trim_start_matches('/')
.to_string();

Expand Down
6 changes: 3 additions & 3 deletions core/services/b2/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ impl Service for B2Backend {
.core
.get_download_authorization(ctx, path, args.expire())
.await?;
let path = build_abs_path(&self.core.root, path);
let path = build_absolute_path(&self.core.root, path);

let auth_info = self.core.get_auth_info(ctx).await?;

Expand All @@ -395,7 +395,7 @@ impl Service for B2Backend {
.core
.get_download_authorization(ctx, path, args.expire())
.await?;
let path = build_abs_path(&self.core.root, path);
let path = build_absolute_path(&self.core.root, path);

let auth_info = self.core.get_auth_info(ctx).await?;

Expand Down Expand Up @@ -423,7 +423,7 @@ impl Service for B2Backend {
let mut req = Request::post(&resp.upload_url);

req = req.header(http::header::AUTHORIZATION, resp.authorization_token);
req = req.header("X-Bz-File-Name", build_abs_path(&self.core.root, path));
req = req.header("X-Bz-File-Name", build_absolute_path(&self.core.root, path));
req = req.header(http::header::CONTENT_TYPE, "b2/x-auto");
req = req.header(constants::X_BZ_CONTENT_SHA1, "do_not_verify");

Expand Down
Loading
Loading