-
Notifications
You must be signed in to change notification settings - Fork 336
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Implement Vectorize GA binding changes #2443
Conversation
0f0cdfb
to
f2e3127
Compare
src/cloudflare/internal/test/vectorize/vectorize-api-test.wd-test
Outdated
Show resolved
Hide resolved
f2e3127
to
df1a145
Compare
@@ -16,144 +16,164 @@ enum Operation { | |||
VECTOR_DELETE = 5, | |||
} | |||
|
|||
class VectorizeIndexImpl implements VectorizeIndex { | |||
/* | |||
* The Vectorize beta VectorizeIndex shares the same methods, so to keep things simple, they share one implementation. |
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.
This is what we discussed @mikea and if this holds true, I think we're happy with this approach!
df1a145
to
da47902
Compare
); | ||
public async describe(): Promise<VectorizeIndexInfo> { | ||
const endpoint = | ||
this.indexVersion === "v2" ? `info` : `binding/indexes/${this.indexId}`; |
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.
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
return new VectorizeIndexImpl( | ||
env.fetcher, | ||
env.indexId, | ||
env.indexVersion ?? "v1" |
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.
This ensures backwards compatibility, since previously built pipelines won't have these inner globals.
We default to v1 if is it not present.
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