Skip to content

Commit

Permalink
put blocklist part should contain block_id
Browse files Browse the repository at this point in the history
  • Loading branch information
wcy-fdu committed Feb 16, 2024
1 parent 033f938 commit f63b2ff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions core/src/services/azblob/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ impl AzblobCore {
pub fn azblob_put_block_list_request(
&self,
path: &str,
block_id: Uuid,
size: Option<u64>,
args: &OpWrite,
body: AsyncBody,
Expand All @@ -385,10 +386,11 @@ impl AzblobCore {
let p = build_abs_path(&self.root, path);

let url = format!(
"{}/{}/{}?comp=blocklist",
"{}/{}/{}?comp=block&block_id={}",
self.endpoint,
self.container,
percent_encode_path(&p)
percent_encode_path(&p),
BASE64_STANDARD.encode(block_id),
);
let mut req = Request::put(&url);
// Set SSE headers.
Expand Down Expand Up @@ -419,11 +421,12 @@ impl AzblobCore {
pub async fn azblob_put_block_list(
&self,
path: &str,
block_id: Uuid,
size: Option<u64>,
args: &OpWrite,
body: AsyncBody,
) -> Result<Response<IncomingAsyncBody>> {
let mut req = self.azblob_put_block_list_request(path, size, args, body)?;
let mut req = self.azblob_put_block_list_request(path, block_id, size, args, body)?;

self.sign(&mut req).await?;
self.send(req).await
Expand All @@ -439,7 +442,7 @@ impl AzblobCore {
"{}/{}/{}?comp=blocklist",
self.endpoint,
self.container,
percent_encode_path(&p)
percent_encode_path(&p),
);

let req = Request::post(&url);
Expand Down
4 changes: 2 additions & 2 deletions core/src/services/azblob/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ impl oio::BlockWrite for AzblobWriter {
}
}

async fn write_block(&self, _block_id: Uuid, size: u64, body: AsyncBody) -> Result<()> {
async fn write_block(&self, block_id: Uuid, size: u64, body: AsyncBody) -> Result<()> {
let resp = self
.core
.azblob_put_block_list(&self.path, Some(size), &self.op, body)
.azblob_put_block_list(&self.path, block_id, Some(size), &self.op, body)
.await?;

let status = resp.status();
Expand Down

0 comments on commit f63b2ff

Please sign in to comment.