Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Use Blob protocol #132

Merged
merged 2 commits into from
Oct 11, 2024
Merged

feat: Use Blob protocol #132

merged 2 commits into from
Oct 11, 2024

Conversation

Peeja
Copy link
Member

@Peeja Peeja commented Oct 10, 2024

Reopens #118 against main, and should address @alanshaw's feedback (making the Shard page work again).

Copy link
Contributor

github-actions bot commented Oct 10, 2024

Website preview 🔗✨

build log

Copy link
Member

@alanshaw alanshaw left a comment

Choose a reason for hiding this comment

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

I would appreciate some closure on the feedback but it's non-blocking.

// the Store protocol. Note that the Blob attempt can throw *or* return an
// error in the result.
return client.capability.blob.get(shard.multihash).then((result) => {
if (result.error) throw result.error
Copy link
Member

@alanshaw alanshaw Oct 11, 2024

Choose a reason for hiding this comment

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

Might be good to distinguish between a service error and a 404 here and only retry on 404.

{ cause: [blobErr, storeErr] }
)
})
})
Copy link
Member

Choose a reason for hiding this comment

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

Minor, but I find using then/catch in an async function jarring. Why not just use try/catch?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I was trying to find a more elegant way to write this, but for some reason it was more complicated the other way. Not sure why—in the light of morning, it's totally fine. 😛 Rewritten.

fetcher: async () => {
if (!client || !space) return
if (!client || !space || !(isCARLink(shard))) return
Copy link
Member

Choose a reason for hiding this comment

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

Does it matter if it's not a CAR shard?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, client.capability.store.get(shard) takes a CARLink. Why this wasn't failing before I can't explain; it's red in my editor. 😕

export default function ItemPage ({ params }: PageProps): JSX.Element {
const [{ client, spaces }] = useW3()
const spaceDID = decodeURIComponent(params.did)
const space = spaces.find(s => s.did() === spaceDID)
const root = parseLink(params.cid)
const shard = parseLink(params.shard)
const shard = parseLink(params.shard).toV1()
Copy link
Member

Choose a reason for hiding this comment

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

Does it need to be v1?

Copy link
Member Author

Choose a reason for hiding this comment

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

Possibly not in theory, but CARLink is defined as v1 specifically. It's probably an accident, as 1 is the default for the type parameter. But it's either this or type guard for v1, and we may as well accept v0 and convert it, since it's both simpler to write and accepts more input.

@Peeja Peeja merged commit 308837e into main Oct 11, 2024
5 checks passed
@Peeja Peeja deleted the blob-protocol branch October 11, 2024 14:23
Peeja pushed a commit that referenced this pull request Oct 16, 2024
🤖 I have created a release *beep* *boop*
---


##
[1.13.0](w3console-v1.12.0...w3console-v1.13.0)
(2024-10-11)


### Features

* Use Blob protocol
([#132](#132))
([308837e](308837e))

---
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>
Peeja added a commit that referenced this pull request Oct 17, 2024
Peeja added a commit that referenced this pull request Oct 17, 2024
This is breaking in some cases because w3up doesn't expect effects to be
links, but they sometimes are (and it should be legal for them to be).
Revert, will fix and redeploy.

Reverts #132
Peeja added a commit that referenced this pull request Oct 21, 2024
Reverts #134 (which reverted
#132)

Last night, this was still failing locally. This morning it's working
again. I've done nothing but investigate.

I now think the Blob protocol was a red herring. I think something else
caused us to send a receipt that the client chokes on, and that that'll
happen regardless of this change. If it comes back, we should
investigate further, but I don't think this is what did it.
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