Implement Vectorize GA binding changes#2443
Merged
mikea merged 1 commit intocloudflare:mainfrom Jul 26, 2024
Merged
Conversation
ndisidore
commented
Jul 25, 2024
0f0cdfb to
f2e3127
Compare
mikea
requested changes
Jul 25, 2024
f2e3127 to
df1a145
Compare
ndisidore
commented
Jul 25, 2024
|
|
||
| class VectorizeIndexImpl implements VectorizeIndex { | ||
| /* | ||
| * The Vectorize beta VectorizeIndex shares the same methods, so to keep things simple, they share one implementation. |
Contributor
Author
There was a problem hiding this comment.
This is what we discussed @mikea and if this holds true, I think we're happy with this approach!
df1a145 to
da47902
Compare
ndisidore
commented
Jul 25, 2024
mikea
approved these changes
Jul 26, 2024
ndisidore
commented
Jul 26, 2024
| ); | ||
| public async describe(): Promise<VectorizeIndexInfo> { | ||
| const endpoint = | ||
| this.indexVersion === "v2" ? `info` : `binding/indexes/${this.indexId}`; |
Contributor
Author
There was a problem hiding this comment.
For v2, account info and index id are included in the base url of the fetcher so these endpoints just become the final path part.
da47902 to
df5356e
Compare
ndisidore
commented
Jul 26, 2024
| return new VectorizeIndexImpl( | ||
| env.fetcher, | ||
| env.indexId, | ||
| env.indexVersion ?? "v1" |
Contributor
Author
There was a problem hiding this comment.
This ensures backwards compatibility, since previously built pipelines won't have these inner globals.
We default to v1 if is it not present.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sister to #2421
This creates a new shared implementation of the Vectorize type that is common to both v1 and v2, conditionally switching on the version to serve up the correct api. This allows us to keep the module name common as
cloudflare-internal:vectorize-api