Skip to content
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
5 changes: 3 additions & 2 deletions core/src/services/ghac/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ impl Accessor for GhacBackend {

// Write only 1 byte to allow create.
let req = self
.ghac_upload(cache_id, 1, AsyncBody::Bytes(Bytes::from_static(&[0])))
.ghac_upload(cache_id, 0, 1, AsyncBody::Bytes(Bytes::from_static(&[0])))
.await?;

let resp = self.client.send(req).await?;
Expand Down Expand Up @@ -562,6 +562,7 @@ impl GhacBackend {
pub async fn ghac_upload(
&self,
cache_id: i64,
offset: u64,
size: u64,
body: AsyncBody,
) -> Result<Request<AsyncBody>> {
Expand All @@ -575,7 +576,7 @@ impl GhacBackend {
req = req.header(
CONTENT_RANGE,
BytesContentRange::default()
.with_range(0, size - 1)
.with_range(offset, offset + size - 1)
.to_header(),
);

Expand Down
3 changes: 2 additions & 1 deletion core/src/services/ghac/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@ impl oio::Write for GhacWriter {
let backend = backend.take().expect("GhacWriter must be initialized");

let cache_id = self.cache_id;
let offset = self.size;
let size = bs.remaining();
let bs = bs.bytes(size);

let fut = async move {
let res = async {
let req = backend
.ghac_upload(cache_id, size as u64, AsyncBody::Bytes(bs))
.ghac_upload(cache_id, offset, size as u64, AsyncBody::Bytes(bs))
.await?;

let resp = backend.client.send(req).await?;
Expand Down