commit | 216d8d7a8fff06187501c35758a6a66b7bf8a1ea | [log] [tgz] |
---|---|---|
author | Madan Jampani <madan@onlab.us> | Wed Aug 26 13:33:36 2015 -0700 |
committer | Gerrit Code Review <gerrit@onlab.us> | Wed Aug 26 21:11:19 2015 +0000 |
tree | 1a2b2a81c0653ce23ea7a03eeeaef28e5fdcc8d2 | |
parent | bba7138d7353f39d32cca13908902653d676c9dd [diff] |
Support a weak read consistency mode for distributed set Change-Id: I2b72795f083421ecce2c7f7cb932d2ec3e15a960
diff --git a/core/api/src/main/java/org/onosproject/store/service/DistributedSetBuilder.java b/core/api/src/main/java/org/onosproject/store/service/DistributedSetBuilder.java index 1706c8f..f5a44c9 100644 --- a/core/api/src/main/java/org/onosproject/store/service/DistributedSetBuilder.java +++ b/core/api/src/main/java/org/onosproject/store/service/DistributedSetBuilder.java
@@ -74,6 +74,17 @@ DistributedSetBuilder<E> withUpdatesDisabled(); /** + * Provides weak consistency for set reads. + * <p> + * While this can lead to improved read performance, it can also make the behavior + * heard to reason. Only turn this on if you know what you are doing. By default + * reads are strongly consistent. + * + * @return this DistributedSetBuilder + */ + DistributedSetBuilder<E> withRelaxedReadConsistency(); + + /** * Disables distribution of set entries across multiple database partitions. * <p> * When partitioning is disabled, the returned set will have a single partition
diff --git a/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/DefaultDistributedSetBuilder.java b/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/DefaultDistributedSetBuilder.java index 07b59ad..f7957f3 100644 --- a/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/DefaultDistributedSetBuilder.java +++ b/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/DefaultDistributedSetBuilder.java
@@ -69,6 +69,12 @@ } @Override + public DistributedSetBuilder<E> withRelaxedReadConsistency() { + mapBuilder.withRelaxedReadConsistency(); + return this; + } + + @Override public DistributedSetBuilder<E> withPartitionsDisabled() { mapBuilder.withPartitionsDisabled(); return this;