001package com.nimbusds.infinispan.persistence.dynamodb.config;
002
003
004import com.amazonaws.regions.Regions;
005import com.codahale.metrics.MetricRegistry;
006import org.infinispan.configuration.cache.StoreConfigurationChildBuilder;
007
008import java.util.Set;
009
010
011/**
012 * DynamoDB store configuration child builder.
013 */
014public interface DynamoDBStoreConfigurationChildBuilder<S> extends StoreConfigurationChildBuilder<S> {
015        
016        
017        /**
018         * Sets the DynamoDB endpoint.
019         *
020         * @param endpoint The endpoint, {@code null} if not specified.
021         *
022         * @return The builder.
023         */
024        DynamoDBStoreConfigurationChildBuilder<S> endpoint(final String endpoint);
025        
026        
027        /**
028         * Sets the DynamoDB region.
029         *
030         * @param region The region, {@code null} if not specified.
031         *
032         * @return The builder.
033         */
034        DynamoDBStoreConfigurationChildBuilder<S> region(final Regions region);
035        
036        
037        /**
038         * Sets the class for transforming between Infinispan entries (key /
039         * value pair and optional metadata) and a corresponding DynamoDB item.
040         *
041         * @param itemTransformerClass The item transformer class. Must not
042         *                             be {@code null}.
043         *
044         * @return The builder.
045         */
046        DynamoDBStoreConfigurationChildBuilder<S> itemTransformerClass(final Class itemTransformerClass);
047        
048        
049        /**
050         * Sets the optional class for executing direct queries against
051         * DynamoDB. If set {@link #indexedAttributes} must also be specified.
052         *
053         * @param queryExecutorClass The query executor class, {@code null} if
054         *                           not required.
055         *
056         * @return The builder.
057         */
058        DynamoDBStoreConfigurationChildBuilder<S> queryExecutorClass(final Class queryExecutorClass);
059        
060        
061        /**
062         * Sets the optional indexed DynamoDB table attributes. If set
063         * {@link #queryExecutorClass} must also be specified.
064         *
065         * @param indexAttributes The indexed attributes, {@code null} if not
066         *                        required.
067         *
068         * @return The builder.
069         */
070        DynamoDBStoreConfigurationChildBuilder<S> indexedAttributes(final Set<String> indexAttributes);
071        
072        
073        
074        /**
075         * Sets the consistent read flag.
076         *
077         * @param enable {@code true} for consistent reads, {@code false} for
078         *               eventually consistent.
079         *
080         * @return The builder.
081         */
082        DynamoDBStoreConfigurationChildBuilder<S> consistentReads(final boolean enable);
083        
084        
085        /**
086         * Sets the read capacity to provision when creating a new DynamoDB
087         * table.
088         *
089         * @param readCapacity The read capacity. Must be equal or larger than
090         *                     one.
091         *
092         * @return The builder.
093         */
094        DynamoDBStoreConfigurationChildBuilder<S> readCapacity(final long readCapacity);
095        
096        
097        /**
098         * Sets the write capacity to provision when creating a new DynamoDB
099         * table.
100         *
101         * @param writeCapacity The write capacity. Must be equal or larger
102         *                      than one.
103         *
104         * @return The builder.
105         */
106        DynamoDBStoreConfigurationChildBuilder<S> writeCapacity(final long writeCapacity);
107
108
109        /**
110         * Sets the maximum read capacity to use when scanning a DynamoDB table
111         * for expired items.
112         *
113         * @param purgeReadCapacity The maximum read capacity to use when
114         *                          scanning a DynamoDB table for expired
115         *                          items.
116         *
117         * @return This builder.
118         */
119        DynamoDBStoreConfigurationChildBuilder<S> purgeMaxReadCapacity(final Capacity purgeReadCapacity);
120        
121        
122        /**
123         * Sets the DynamoDB table encryption at rest.
124         *
125         * @param encryptionAtRest {@code true} to create the DynamoDB table
126         *                         with encryption at rest, {@code false} with
127         *                         no encryption.
128         *
129         * @return The builder.
130         */
131        DynamoDBStoreConfigurationChildBuilder<S> tableWithEncryptionAtRest(final boolean encryptionAtRest);
132        
133        
134        /**
135         * Sets the DynamoDB table prefix.
136         *
137         * @param tablePrefix The table prefix, {@code null} if not specified.
138         *
139         * @return The builder.
140         */
141        DynamoDBStoreConfigurationChildBuilder<S> tablePrefix(final String tablePrefix);
142
143        
144        /**
145         * Sets an explicit metric registry to use (other than singleton
146         * {@link com.nimbusds.common.monitor.MonitorRegistries}).
147         *
148         * @param metricRegistry The metric registry to use.
149         *
150         * @return The builder.
151         */
152        DynamoDBStoreConfigurationChildBuilder<S> metricRegistry(final MetricRegistry metricRegistry);
153        
154        
155        /**
156         * Sets the name of the optional range key to apply to all DynamoDB
157         * operations.
158         *
159         * @param rangeKeyName The range key name, {@code null} if not
160         *                     specified.
161         *
162         * @return The builder.
163         */
164        DynamoDBStoreConfigurationChildBuilder<S> applyRangeKey(final String rangeKeyName);
165        
166        
167        /**
168         * Sets the value of the optional range key.
169         *
170         * @param rangeKeyValue The range key value, {@code null} if not
171         *                      specified.
172         *
173         * @return The builder.
174         */
175        DynamoDBStoreConfigurationChildBuilder<S> rangeKeyValue(final String rangeKeyValue);
176        
177        
178        /**
179         * Sets the enable stream flag.
180         *
181         * @param enable {@code true} to enable a stream for a global table,
182         *               {@code false} for a regular table.
183         *
184         * @return The builder.
185         */
186        DynamoDBStoreConfigurationChildBuilder<S> enableStream(final boolean enable);
187        
188        
189        /**
190         * Sets the enable continuous backups / point in time recovery.
191         *
192         * @param enable {@code true} to enable continuous backups,
193         *               {@code false} without.
194         *
195         * @return The builder.
196         */
197        DynamoDBStoreConfigurationChildBuilder<S> enableContinuousBackups(final boolean enable);
198        
199        
200        /**
201         * Sets the enable DynamoDB item expiration.
202         *
203         * @param enable {@code true} to enable item expiration, {@code false}
204         *               without.
205         *
206         * @return The builder.
207         */
208        DynamoDBStoreConfigurationChildBuilder<S> enableTTL(final boolean enable);
209        
210        
211        /**
212         * Sets the limit of expired entries to purge during a run of the
213         * expired entry reaper task.
214         *
215         * @param purgeLimit The purge limit, -1 for no limit.
216         *
217         * @return The builder.
218         */
219        DynamoDBStoreConfigurationChildBuilder<S> purgeLimit(final long purgeLimit);
220        
221        
222        /**
223         * Sets the HTTP proxy host.
224         *
225         * @param host The host, {@code null} if none.
226         *
227         * @return The builder.
228         */
229        DynamoDBStoreConfigurationChildBuilder<S> httpProxyHost(final String host);
230        
231        
232        /**
233         * Sets the HTTP proxy port.
234         *
235         * @param port The port, -1 if none.
236         *
237         * @return The builder.
238         */
239        DynamoDBStoreConfigurationChildBuilder<S> httpProxyPort(final int port);
240        
241        
242        /**
243         * Sets the HMAC SHA-256 key.
244         *
245         * @param key The HMAC SHA-256 key, {@code null} if none.
246         *
247         * @return The builder.
248         */
249        DynamoDBStoreConfigurationChildBuilder<S> hmacSHA256Key(final String key);
250}