Skip to content

Conversation

@alanshaw
Copy link
Member

@alanshaw alanshaw commented May 9, 2024

Supports byte ranges for raw block requests - including multipart.

depends on storacha/dagula#44

refs storacha/freeway#100 (comment)

@alanshaw alanshaw marked this pull request as ready for review May 13, 2024 09:32
@alanshaw alanshaw requested review from Gozala and vasco-santos May 13, 2024 09:35
Comment on lines 30 to 34
export const resolveRange = (range, totalSize) => {
const last = range[1] == null ? (totalSize - 1) : range[1]
const first = range[1] == null && range[0] < 0 ? totalSize + range[0] : range[0]
return [first, last]
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think following is a more clear way to to express it

Suggested change
export const resolveRange = (range, totalSize) => {
const last = range[1] == null ? (totalSize - 1) : range[1]
const first = range[1] == null && range[0] < 0 ? totalSize + range[0] : range[0]
return [first, last]
}
export const resolveRange = ([first, last], totalSize) => [
first < 0 ? totalSize + first : first,
last ?? totalSize - 1
]

@alanshaw alanshaw changed the title feat: support byte range for raw block requests feat!: support byte range for raw block requests May 14, 2024
@alanshaw alanshaw merged commit 496cb24 into main May 14, 2024
@alanshaw alanshaw deleted the feat/support-byte-range-reqs-for-raw-block branch May 14, 2024 17:59
alanshaw pushed a commit that referenced this pull request May 14, 2024
🤖 I have created a release *beep* *boop*
---


##
[5.0.0](v4.1.1...v5.0.0)
(2024-05-14)


### ⚠ BREAKING CHANGES

* dependencies for handlers have changed, splitting out block, DAG and
unixfs services. These are all satisfied by the `Dagula` class for the
time being.

### Features

* support byte range for raw block requests
([#57](#57))
([496cb24](496cb24))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants