You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Refactor] Extract GrpcRunner from GRPCIndexBase class (#395)
## Problem
This is another extractive refactoring in preparation for grpc with
asyncio.
## Solution
The generated stub class, `VectorServiceStub`, is what knows how to call
the Pinecone grpc service, but our wrapper code needs to do some work to
make sure we have a consistent approach to "metadata" (grpc-speak for
request headers) and handling other request params like `timeout`.
Previously this work was accomplished in a private method of the
`GRPCIndexBase` base class called `_wrap_grpc_call()`.
Since we will need to perform almost identical marshaling of metadata
for requests with asyncio, I pulled this logic out into a separate class
`GrpcRunner` and renamed `_wrap_grpc_call` to `run`. You can see there
is also a parallel method implementation called `run_asyncio`; currently
this is unused and untested, but kind of illustrates why this refactor
is useful.
## Type of Change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update
- [ ] Infrastructure change (CI configs, etc)
- [ ] Non-code change (docs, etc)
- [x] None of the above: Mechanical refactor, should have no net impact
to functionality.
## Test Plan
Tests should still be green
0 commit comments