99
1010/**
1111 * An Antidote key consists of a CRDT type and a corresponding key.
12- * It can be used as a top-level-key of an Antidote object in a bucket or as a key in a map .
12+ * It can be used as a top-level-key of an Antidote object in a bucket or as a key in a map_rr .
1313 * <p>
1414 * Use the static methods of this class to create keys for the respective CRDT types.
1515 */
@@ -95,21 +95,6 @@ public static CounterKey fatCounter(String key) {
9595 return fatCounter (ByteString .copyFromUtf8 (key ));
9696 }
9797
98- /**
99- * An integer can be incremented and assigned to.
100- */
101- public static IntegerKey integer (ByteString key ) {
102- return new IntegerKey (key );
103- }
104-
105-
106- /**
107- * An integer can be incremented and assigned to.
108- */
109- public static IntegerKey integer (String key ) {
110- return integer (ByteString .copyFromUtf8 (key ));
111- }
112-
11398 /**
11499 * A last-writer-wins register.
115100 *
@@ -233,26 +218,10 @@ public static SetKey<String> set_removeWins(String key) {
233218 return set_removeWins (key , ValueCoder .utf8String );
234219 }
235220
236- /**
237- * An add-wins map.
238- * Updates win over concurrent deletes.
239- * Deleting an entry uses tombstones which are not garbage-collected.
240- */
241- public static MapKey map_aw (ByteString key ) {
242- return new MapKey (AntidotePB .CRDT_type .AWMAP , key );
243- }
244-
245- /**
246- * @see #map_aw(ByteString)
247- */
248- public static MapKey map_aw (String key ) {
249- return map_aw (ByteString .copyFromUtf8 (key ));
250- }
251-
252-
253221 /**
254222 * Remove-resets map.
255223 * Removing an entry resets the corresponding CRDT.
224+ * Entries using a CRDT that does not support resets cannot be removed form the map.
256225 * Therefore this map should mainly be used with embedded CRDTs that support a reset operation.
257226 * <p>
258227 * Reading the map only returns entries which have a value, where the internal state is not equal to the initial CRDT state.
@@ -285,6 +254,23 @@ public static MapKey map_g(String key) {
285254 }
286255
287256
257+ public static FlagKey flag_ew (ByteString key ) {
258+ return new FlagKey (AntidotePB .CRDT_type .FLAG_EW , key );
259+ }
260+
261+ public static FlagKey flag_ew (String key ) {
262+ return flag_ew (ByteString .copyFromUtf8 (key ));
263+ }
264+
265+ public static FlagKey flag_dw (ByteString key ) {
266+ return new FlagKey (AntidotePB .CRDT_type .FLAG_DW , key );
267+ }
268+
269+ public static FlagKey flag_dw (String key ) {
270+ return flag_ew (ByteString .copyFromUtf8 (key ));
271+ }
272+
273+
288274 AntidotePB .ApbMapKey .Builder toApbMapKey () {
289275 AntidotePB .ApbMapKey .Builder builder = AntidotePB .ApbMapKey .newBuilder ();
290276 builder .setType (type );
@@ -311,20 +297,18 @@ public static Key<?> create(AntidotePB.CRDT_type type, ByteString k) {
311297 return register (k );
312298 case MVREG :
313299 return multiValueRegister (k );
314- case INTEGER :
315- return integer (k );
316300 case GMAP :
317301 return map_g (k );
318- case AWMAP :
319- return map_aw (k );
320302 case RWSET :
321303 return set_removeWins (k );
322304 case RRMAP :
323305 return map_rr (k );
324306 case FATCOUNTER :
325307 return fatCounter (k );
326- case POLICY :
327- throw new RuntimeException ("policy CRDT not yet supported" );
308+ case FLAG_EW :
309+ return flag_ew (k );
310+ case FLAG_DW :
311+ return flag_dw (k );
328312 default :
329313 throw new RuntimeException ("CRDT not yet supported: " + type );
330314 }
0 commit comments