-
Notifications
You must be signed in to change notification settings - Fork 30
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
Implement changes to Cursor API to include the stream transaction id … #325
Implement changes to Cursor API to include the stream transaction id … #325
Conversation
…to the request headers. fix ArangoDB-Community#322
…tandard into streamTransaction # Conflicts: # arangodb-net-standard.Test/CursorApi/CursorApiClientTest.cs # arangodb-net-standard/CursorApi/CursorApiClient.cs # arangodb-net-standard/Transport/Http/HttpApiTransport.cs
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 current implementation looks good.
A transactionId
parameter has been added to DeleteCursorAsync
, PutCursorAsync
and PostCursorBody
, but I wonder if we could instead add an additional general parameter to the API methods for supporting headers, like we do for query/body parameters? e.g. PostCursorAsync<T>(PostCursorBody postCursorBody, PostCursorHeaders postCursorHeaders)
, or something a bit more generic.
https://www.arangodb.com/docs/stable/http/transaction-stream-transaction.html
To use the transaction for a supported operation a client needs to specify the transaction identifier in the x-arango-trx-id header on each request.
I think it's worth taking this opportunity to model something, like an interface containing common headers.
@rossmills99 @modios Any thoughts?
There are headers that are applied widely, e.g. x-arango-async: true
, but I'm not sure it's a strong enough reason to add support for them on each endpoint, as they could also be implemented differently.
I notice from the docs that the transaction ID header is only relevant in the "create cursor" endpoint, so our DeleteCursor or PutCursor APIs should not be affected. Those changes should be removed from the PR. To address @DiscoPYF 's questions:
I think that there are two PostCursorAsync methods. One of them is a convenience method that provides some of the options are method arguments, instead of requiring the |
I agree, this is a good approach (imo) and consistent with our API, indeed. Not sure how generic the parameter for the headers should be. Example: |
Cool 👍 will revert the changes.
Instead of creating a new |
Yes, correct. I think the idea is to have the following: public virtual async Task<CursorResponse<T>> PostCursorAsync<T>(
PostCursorBody postCursorBody, AClassWithHeaderProperties headers) |
Added a new class HeaderProperties with TransactionId as the property. fix ArangoDB-Community#322
PR updated addressing these comments.
|
Thanks for the update. It appears |
PR updated. Reinstated the missed out |
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.
@DiscJockeyDJ Thank you for the update. This implementation fits well with the current APIs. I left minor comments about naming and placing of new methods/classes, but this could be adjusted in an upcoming pull request.
I noticed that some test runs are failing. I will take a look, but approved pending failure resolved.
It would also be useful to add a test to verify that header properties are being passed on to transport correctly. Example: |
I ran again the failed test runs and they now pass. I am listing the failures for future reference:
|
Refactored the method to get HeaderCollection. Added test to verify header properties. fix ArangoDB-Community#322
PR updated to address the above mentioned suggestions 👍
|
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.
Thank you @DiscJockeyDJ , looks good to me. Approved 👍
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.
Looks good to me
…to the request headers.
fix #322