-
Notifications
You must be signed in to change notification settings - Fork 5
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 Indexing Service when feature flag is present #132
Conversation
scripts/delegate-serve.js
Outdated
* @returns {str is Ucanto.DID<Method>} | ||
*/ | ||
const isDID = (str, method) => | ||
str.startsWith(`did:${method ? `${method}:` : ''}`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use ucanto schema for this.
import { Schema } from '@ucanto/core'
Schema.did({ method }).is(str)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha! I couldn't figure out how to get that to work before. Not sure what wasn't clicking, but it all makes sense now. Pushed as Use Ucanto Schema
.
src/util.js
Outdated
ok: { | ||
...locateResult.ok, | ||
site: locateResult.ok.site.filter( | ||
(site) => site.space && spaces.includes(site.space) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The space should be passed to the locator and used in the query to indexing service.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, I forgot to switch this one to the new locator.scopeToSpaces()
. Pushed!
} | ||
} | ||
} | ||
? spaceScopedLocator(ctx.locator, [stubSpace]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is a stubSpace
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A Space given as a stub (stub_space
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha - for testing right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly—that's what this middleware is for.
package.json
Outdated
@@ -51,17 +52,18 @@ | |||
}, | |||
"devDependencies": { | |||
"@cloudflare/workers-types": "^4.20231218.0", | |||
"@storacha/cli": "^1.0.1", | |||
"@storacha/client": "file:../upload-service/packages/w3up-client", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs update before merge.
234d125
to
c5fa39d
Compare
Depending on how tests are run, the exception inside the promise can blow things up. We intentionally want to ignore the error here, and just test that it doesn't interfere with serving the data.
eb4adfb
to
6a8d430
Compare
🤖 I have created a release *beep* *boop* --- ## [2.22.0](v2.21.0...v2.22.0) (2024-12-19) ### Features * egress client - ucanto integration ([#123](#123)) ([22bed68](22bed68)) * enable egress tracking in production env ([#135](#135)) ([ad43b62](ad43b62)) * **indexer:** probabilistic feature flag ([#136](#136)) ([dca2b35](dca2b35)) * ucan invocation handler ([#133](#133)) ([b199bfa](b199bfa)) * Use Indexing Service when feature flag is present ([#132](#132)) ([fa3f480](fa3f480)) ### Bug Fixes * **config:** staging kv bidding ([#134](#134)) ([7a523d5](7a523d5)) * **egress-client:** set nonce, expire and fix servedAt ([#130](#130)) ([b135643](b135643)) * enable open telemetry for all envs ([#131](#131)) ([c822465](c822465)) --- 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>
storacha/project-tracking#140
Depends on storacha/blob-fetcher#19 and storacha/upload-service#57
When
ff=indexing-service
is given in the gateway URL, Freeway will use the Indexing Service to locate blobs.