Closed rrutt closed 11 years ago
For more details on the two API protocol versions, see the Read Me notes on my fork/branch:
https://github.com/rrutt/Alternator/tree/dual-api-versions#readme
Just tried it and all my tests and projects are working fine with this new version (using the old API)
Awesome to hear guys. I haven't had time to look at the latest API yet, anything that needs to change on the protocol or is it just a Java classes?
The JSON structure of the Request and Response messages is quite different between the two versions of the protocol. The x-amz-target HTTP header indicates which protocol is being used for a service call. It is "DynamoDB_20121008.request string" for the new version, and "DynamoDB_20111205.request string" for the original version.
The differences are easiest to see in the Node.js documentation:
http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB_20111205.html
http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB_20120810.html
The differences are mostly about declaring the Hash Key vs. the Range Key; they are generalizing these to accommodate the new "local secondary indexes". The Hash Key condition for a Query is passed like a Range Key condition, but is restricted to an EQ comparison Also, consumed capacity units are being returned as a HashMap keyed by Table name.
The approach I took in my revision is to dispatch to two different handlers and have the new handler map between the original and the new JSON request/result formats. This avoids changes to the actual implementation logic inside the emulator, at least for this revision.
Here is the AlternatorDBHandler.java file comparison showing the approach I took for accepting service requests via the new API protocol:
https://github.com/rrutt/Alternator/compare/mboudreau:master...dual-api-versions#diff-36
I created an example Node.js application for integration regression testing Alternator using the newest AWS-SDK protocol:
https://github.com/rrutt/DynamoDB-Node-Client.git
The AWS-SDK protocol is documentation here:
http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB_20120810.html
The original support for pre-existing functionality accessed via the newer dynamodbv2 Java API has been satisfied with the merge of Pull Request #66.
Should we leave this Issue open for followup re-factoring or addition of newer functionality that Amazon added with this V2 interface?
Close it, we'll open new ones as we go along. On Jun 20, 2013 4:30 AM, "Rick Rutt" notifications@github.com wrote:
The original support for pre-existing functionality accessed via the newer dynamodbv2 Java API has been satisfied with the merge of Pull Request #66https://github.com/mboudreau/Alternator/issues/66 .
Should we leave this Issue open for followup re-factoring or addition of newer functionality that Amazon added with this V2 interface?
— Reply to this email directly or view it on GitHubhttps://github.com/mboudreau/Alternator/issues/65#issuecomment-19703863 .
Amazon created a new specification for the DynamoDB API that is NOT backward compatible with the earlier version. The earlier version of the API is still supported but is deprecated.
I have a branch in my forked repository where the Alternator emulator allows both versions of the DynamoDB API.
https://github.com/rrutt/Alternator/tree/dual-api-versions
Note however that only the features that were already available thru the original API version are supported.
When processing against the newer API protocol, Alternator simply maps the request objects to the original format and calls the pre-existing logic. It then maps the result to the new API protocol format. Any exceptions are also remapped from the dynamodb namespace to the dynamodbv2 namespace.
I will submit this branch as a new Pull Request to the original repository after I work with it for a few days against our application.
In the meantime the branch above is available for others to evaluate this enhancement.