Madan Jampani
Committed by Gerrit Code Review

Support a weak read consistency mode for distributed set

Change-Id: I2b72795f083421ecce2c7f7cb932d2ec3e15a960
...@@ -74,6 +74,17 @@ public interface DistributedSetBuilder<E> { ...@@ -74,6 +74,17 @@ public interface DistributedSetBuilder<E> {
74 DistributedSetBuilder<E> withUpdatesDisabled(); 74 DistributedSetBuilder<E> withUpdatesDisabled();
75 75
76 /** 76 /**
77 + * Provides weak consistency for set reads.
78 + * <p>
79 + * While this can lead to improved read performance, it can also make the behavior
80 + * heard to reason. Only turn this on if you know what you are doing. By default
81 + * reads are strongly consistent.
82 + *
83 + * @return this DistributedSetBuilder
84 + */
85 + DistributedSetBuilder<E> withRelaxedReadConsistency();
86 +
87 + /**
77 * Disables distribution of set entries across multiple database partitions. 88 * Disables distribution of set entries across multiple database partitions.
78 * <p> 89 * <p>
79 * When partitioning is disabled, the returned set will have a single partition 90 * When partitioning is disabled, the returned set will have a single partition
......
...@@ -69,6 +69,12 @@ public class DefaultDistributedSetBuilder<E> implements DistributedSetBuilder<E> ...@@ -69,6 +69,12 @@ public class DefaultDistributedSetBuilder<E> implements DistributedSetBuilder<E>
69 } 69 }
70 70
71 @Override 71 @Override
72 + public DistributedSetBuilder<E> withRelaxedReadConsistency() {
73 + mapBuilder.withRelaxedReadConsistency();
74 + return this;
75 + }
76 +
77 + @Override
72 public DistributedSetBuilder<E> withPartitionsDisabled() { 78 public DistributedSetBuilder<E> withPartitionsDisabled() {
73 mapBuilder.withPartitionsDisabled(); 79 mapBuilder.withPartitionsDisabled();
74 return this; 80 return this;
......