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

Several options not available on DatastoreOptions #517

Open
chadbr opened this issue Oct 17, 2019 · 3 comments
Open

Several options not available on DatastoreOptions #517

chadbr opened this issue Oct 17, 2019 · 3 comments
Labels
api: datastore Issues related to the googleapis/nodejs-datastore API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@chadbr
Copy link

chadbr commented Oct 17, 2019

Hello,

I use several option flags for datastore that aren't defined in the current type definition.

Today I define my options as 'any' but I'd like to be able to have some type safety.

Examples:
servicePath - this has the hostname of the datastore instance... we use it to ensure unit tests are running against localhost and not a production database...

maxRetries -- self explanatory...

We also set these because of an older bug... but I could see not wanting to add them to options?
'grpc.max_send_message_length': -1, // unlimited
'grpc.max_receive_message_length': -1 // unlimited

Thanks, Chad

@AVaksman
Copy link
Contributor

@chadbr
Datastore constructor accepts options: DatastoreOptions which include apiEndpoint as one of the parameters, you should be able to

const datastoreClient = new Datastore({
    apiEndpoint: 'localhost:' + customPort,
})

to set a custom hostname for unit tests.

All rpc call functions take gaxOptions: CallOptions as part of function's options or directly.
And gaxOptions expose maxRetries parameter.

As far as
grpc.max_send_message_length: -1
grpc.max_receive_message_length: -1
These are no longer needed as Datastore switched to grpc-js and grpc-js does not have an issue with pre-set maximum send/receive message size (similar issue from bigtable library)

Is this information helpful?

@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Oct 18, 2019
@chadbr
Copy link
Author

chadbr commented Oct 18, 2019

@AVaksman

Yes, We use those options to create the endpoint -- it's at a later point we want to check the connected Datastore object... We can use apiEndpoint -- but servicePath is simply more convenient.

On the gaxOptions -- Can I set those in the options passed to Datastore constructor? Or I have to set them on every call?

Thanks, Chad

@AVaksman
Copy link
Contributor

gaxOptions needs to be passed on every call.

@bcoe bcoe added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. and removed triage me I really want to be triaged. labels Oct 18, 2019
@bcoe bcoe added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Nov 4, 2019
@google-cloud-label-sync google-cloud-label-sync bot added the api: datastore Issues related to the googleapis/nodejs-datastore API. label Jan 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: datastore Issues related to the googleapis/nodejs-datastore API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

4 participants