|
1 |
| -**Design:** New Feature, **Status:** |
2 |
| -[In Development](../../../README.md) |
| 1 | +**Design:** New Feature, **Status:** [Public Preview](../../../../../services-custom/dynamodb-enhanced/README.md) |
3 | 2 |
|
4 | 3 | ## Tenets (unless you know better ones)
|
5 | 4 |
|
@@ -38,182 +37,22 @@ including AWS's own Document and Mapper Clients.
|
38 | 37 |
|
39 | 38 | The AWS SDK for Java will add a new "enhanced DynamoDB client" that
|
40 | 39 | provides an alternative to the data-access portion of the generated
|
41 |
| -DynamoDB APIs. Control-plane operations like "create table" will not be |
42 |
| -supported at launch, but may be added at a later time. |
| 40 | +DynamoDB APIs. Only limited control-plane operations will be available, |
| 41 | +specifically 'createTable'. |
43 | 42 |
|
44 | 43 | This enhanced client will make DynamoDB easier to use for Java customers
|
45 | 44 | by:
|
46 | 45 | 1. Supporting conversions between Java objects and DynamoDB items
|
47 |
| -2. Supporting conversions between Java built-in types (eg. `Instant`) |
48 |
| - and DynamoDB attribute value types |
49 |
| -3. Directly supporting every data-plane operation of DynamoDB |
50 |
| -4. Using the same verbs and nouns of DynamoDB |
51 |
| - |
52 |
| -## Implementation Overview |
53 |
| - |
54 |
| -**New Clients** |
55 |
| - |
56 |
| -Two new client classes will be added: |
57 |
| -`DynamoDbEnhancedClient` and `DynamoDbEnhancedAsyncClient`. These |
58 |
| -classes act as a wrapper around the generated `DynamoDbClient` and |
59 |
| -`DynamoDbAsyncClient` classes, to provide additional functionality on |
60 |
| -top of that which can be provided by the generated clients. |
61 |
| - |
62 |
| -```java |
63 |
| -DynamoDbEnhancedClient enhancedClient = |
64 |
| - DynamoDbEnhancedClient.builder() |
65 |
| - .dynamoDbClient(DynamoDbClient.create()) |
66 |
| - .build(); |
67 |
| -``` |
68 |
| - |
69 |
| -**Table Abstraction** |
70 |
| - |
71 |
| -`DynamoDbEnhancedClient` provides access to `Table` and `MappedTable`, |
72 |
| -and `DynamoDbEnhancedAsyncClient`provides access to `AsyncTable`, and |
73 |
| -`AsyncMappedTable` abstractions. |
74 |
| - |
75 |
| -The operations on these "tables" match the data-plane operations in the |
76 |
| -low-level DynamoDB client. For example, because `DynamoDbClient.putItem` |
77 |
| -exists, `Table.putItem` will also exist. |
78 |
| - |
79 |
| -`Table` and `AsyncTable` work with "items", described below. |
80 |
| -`MappedTable` and `AsyncMappedTable` work with "objects", described |
81 |
| -below. `Table` and `MappedTable` returning results synchronously, and |
82 |
| -`AsyncTable` and `AsyncMappedTable` returning results asynchronously. |
83 |
| - |
84 |
| -```java |
85 |
| -Table booksTable = enhancedClient.table("books"); |
86 |
| -booksTable.putItem(...); |
87 |
| - |
88 |
| -MappedTable mappedBooksTable = enhancedClient.mappedTable("books"); |
89 |
| -mappedBooksTable.putItem(...); |
90 |
| -``` |
91 |
| - |
92 |
| -**Item Abstraction** |
93 |
| - |
94 |
| -The operations on `Table` and `AsyncTable` work on `Item`s. An `Item` is |
95 |
| -a user-friendly representation of the generated `Map<String, |
96 |
| -AttributeValue>`. `Item`s support automatic type conversion between Java |
97 |
| -built-in types and DynamoDB-specific `AttributeValue` types. |
98 |
| - |
99 |
| -```java |
100 |
| -booksTable.putItem(Item.builder() |
101 |
| - .putAttribute("isbn", "0-330-25864-8") |
102 |
| - .putAttribute("title", "The Hitchhiker's Guide to the Galaxy") |
103 |
| - .putAttribute("creationDate", Instant.now()) |
104 |
| - .build()); |
105 |
| -``` |
106 |
| - |
107 |
| -The `Table` and `AsyncTable` abstractions can be seen as a replacement |
108 |
| -for the 1.11.x DynamoDB Document client. |
109 |
| - |
110 |
| -**Object Abstraction** |
111 |
| - |
112 |
| -The operations on `MappedTable` and `AsyncMappedTable` work on Java |
113 |
| -objects (at launch, Java beans). These objects are automatically |
114 |
| -converted by the enhanced client to the generated `Map<String, |
115 |
| -AttributeValue>`. It's likely that the `MappedTable` and |
116 |
| -`AsyncMappedTable` will use the `Table` and `AsyncTable` as an |
117 |
| -implementation detail. |
118 |
| - |
119 |
| -```java |
120 |
| -Book book = new Book(); |
121 |
| -book.setIsbn("0-330-25864-8"); |
122 |
| -book.setTitle("The Hitchhiker's Guide to the Galaxy"); |
123 |
| -book.setCreationDate(Instant.now()); |
124 |
| -mappedBooksTable.putItem(book); |
125 |
| -``` |
126 |
| - |
127 |
| -The `MappedTable` and `AsyncMappedTable` abstractions can be seen as a |
128 |
| -replacement for the 1.11.x DynamoDB Mapper client. |
129 |
| - |
130 |
| -**Type Conversion** |
131 |
| - |
132 |
| -The core feature of the mapper is the ability to convert common Java |
133 |
| -structures (e.g. Java beans) and types (e.g. `Instant`, `Number`) into |
134 |
| -DynamoDB attribute values. |
135 |
| - |
136 |
| -These conversions are performed based on the types specified by the |
137 |
| -customer. For example, the SDK will automatically convert any `Number` |
138 |
| -types specified by the customer (as an Item attribute) into a DynamoDB |
139 |
| -number. |
140 |
| - |
141 |
| -The customer has the ability to configure the type converters used at |
142 |
| -the `Item` or `DynamoDbEnhanced[Async]Client`-level. This allows the |
143 |
| -customer to add support for unsupported types, change the DynamoDB type |
144 |
| -associated with a Java type (e.g. storing an `Instant` as a DynamoDB |
145 |
| -string instead of a number), or to add support for custom POJO |
146 |
| -conversion logic (i.e. other than Java beans). This also allows the |
147 |
| -customer to provide a hard-coded converter for a specific object type |
148 |
| -that performs more efficiently than the built-in reflection-based object |
149 |
| -converter. |
150 |
| - |
151 |
| -## Features |
152 |
| - |
153 |
| -**Launch Features** |
154 |
| - |
155 |
| -These features are intended for inclusion at launch of the library. |
156 |
| - |
157 |
| -1. Support for all existing data plane operations: get, put, query, |
158 |
| - update, scan, delete, batch get, batch put, transaction get, and |
159 |
| - transaction put. |
160 |
| -2. Support for `[Async]Table` and `[Async]MappedTable`, as described |
161 |
| - above. |
162 |
| -3. Support for bean-based representations in `[Async]MappedTable`. |
163 |
| -4. Type converters for all Java built-in types that are currently |
164 |
| - supported by [Joda Convert](https://www.joda.org/joda-convert/). |
165 |
| - |
166 |
| -| API | Feature | Development | Usability Study | |
167 |
| -| --- | --- | --- | --- | |
168 |
| -| Item | Get | Done | | |
169 |
| -| | Put | Done | | |
170 |
| -| | Query | | | |
171 |
| -| | Update | | | |
172 |
| -| | Scan | | | |
173 |
| -| | Delete | | | |
174 |
| -| | Batch Get | | | |
175 |
| -| | Batch Put | | | |
176 |
| -| | Transaction Get | | | |
177 |
| -| | Transaction Put | | | |
178 |
| -| Object | Get | | | |
179 |
| -| | Put | | | |
180 |
| -| | Query | | | |
181 |
| -| | Update | | | |
182 |
| -| | Scan | | | |
183 |
| -| | Delete | | | |
184 |
| -| | Batch Get | | | |
185 |
| -| | Batch Put | | | |
186 |
| -| | Transaction Get | | | |
187 |
| -| | Transaction Put | | | |
188 |
| -| All | Type Support | In Progress | | |
189 |
| - |
190 |
| -**Post-Launch Features** |
191 |
| - |
192 |
| -1. Support for inheritance in `[Async]MappedTable`. |
193 |
| -2. Support for immutable objects in `[Async]MappedTable`. |
194 |
| -3. Support for projection statements in `[Async]Table` and |
195 |
| - `[Async]MappedTable`. |
196 |
| -4. Support for DynamoDB-provided API metrics (e.g. consumed capacity). |
197 |
| -5. A `software.amazon.aws:dynamodb-all` module that automatically |
198 |
| - includes all AWS DynamoDB artifacts, to enhance client |
199 |
| - discoverability. |
200 |
| - |
201 |
| -**Missing Features** |
202 |
| - |
203 |
| -These features are not intended for inclusion at launch of the library |
204 |
| -(but may be added at a future time). |
205 |
| - |
206 |
| -1. Support for control-plane operations, like create or delete table. |
207 |
| - *Justification for exclusion:* For testing purposes, this can be done |
208 |
| - through the AWS console or low-level SDK. For production purposes, |
209 |
| - this should be done through the AWS CDK or cloud formation. |
210 |
| -2. Versioning and UUID annotations. *Justification for exclusion:* This |
211 |
| - is a higher-level concern than the "type converter" goal that the |
212 |
| - enhanced client is attempting to deliver on. This is a piece of |
213 |
| - functionality that will be built on-top of the enhanced client, not |
214 |
| - in it. |
| 46 | +2. Directly supporting every data-plane operation of DynamoDB |
| 47 | +3. Using the same verbs and nouns of DynamoDB |
| 48 | +4. Support for tests, such as the ability to create tables using the |
| 49 | + same models as the data plane operations. |
| 50 | + |
| 51 | +A fully functional public preview is available for this library. See |
| 52 | +[DynamoDb Enhanced Public Preview |
| 53 | +Library](../../../../../services-custom/dynamodb-enhanced/README.md). |
215 | 54 |
|
216 |
| -**Requested Features** |
| 55 | +## Appendix A: Requested Features |
217 | 56 |
|
218 | 57 | * [Immutable classes](https://github.com/aws/aws-sdk-java-v2/issues/35#issuecomment-315049138)
|
219 | 58 | * [Getter/setter-less fields](https://github.com/aws/aws-sdk-java/issues/547)
|
@@ -257,7 +96,7 @@ These features are not intended for inclusion at launch of the library
|
257 | 96 | runtime (from email)
|
258 | 97 | * Structure versioning (from email)
|
259 | 98 |
|
260 |
| -## Appendix A: Alternative Solutions |
| 99 | +## Appendix B: Alternative Solutions |
261 | 100 |
|
262 | 101 | ### Alternative Solution 1: Level 3 Storage Library
|
263 | 102 |
|
|
0 commit comments