Skip to content

Commit 53060b0

Browse files
babltigamikereiche
authored andcommitted
Added support of the expression based durability levels. (#1721)
Closes #1063.
1 parent 372314a commit 53060b0

20 files changed

+238
-19
lines changed

src/main/asciidoc/entity.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ This key needs to be any string with a length of maximum 250 characters.
7878
Feel free to use whatever fits your use case, be it a UUID, an email address or anything else.
7979

8080
Writes to Couchbase-Server buckets can optionally be assigned durability requirements; which instruct Couchbase Server to update the specified document on multiple nodes in memory and/or disk locations across the cluster; before considering the write to be committed.
81-
Default durability requirements can also be configured through the `@Document` annotation.
82-
For example: `@Document(durabilityLevel = DurabilityLevel.MAJORITY)` will force mutations to be replicated to a majority of the Data Service nodes.
81+
Default durability requirements can also be configured through the `@Document` or `@Durability` annotations.
82+
For example: `@Document(durabilityLevel = DurabilityLevel.MAJORITY)` will force mutations to be replicated to a majority of the Data Service nodes. Both of the annotations support expression based durability level assignment via `durabilityExpression` attribute (Note SPEL is not supported).
8383
[[datatypes]]
8484
== Datatypes and Converters
8585

src/main/asciidoc/index.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
= Spring Data Couchbase - Reference Documentation
2-
Michael Nitschinger, Oliver Gierke, Simon Basle, Michael Reiche
2+
Michael Nitschinger, Oliver Gierke, Simon Basle, Michael Reiche, Tigran Babloyan
33
:revnumber: {version}
44
:revdate: {localdate}
55
:spring-data-commons-docs: ../../../../spring-data-commons/src/main/asciidoc
66

7-
(C) 2014-2022 The original author(s).
7+
(C) 2014-2023 The original author(s).
88

99
NOTE: Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically.
1010

src/main/java/org/springframework/data/couchbase/core/ExecutableInsertByIdOperationSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public <T> ExecutableInsertById<T> insertById(final Class<T> domainType) {
4040
Assert.notNull(domainType, "DomainType must not be null!");
4141
return new ExecutableInsertByIdSupport<>(template, domainType, OptionsBuilder.getScopeFrom(domainType),
4242
OptionsBuilder.getCollectionFrom(domainType), null, OptionsBuilder.getPersistTo(domainType),
43-
OptionsBuilder.getReplicateTo(domainType), OptionsBuilder.getDurabilityLevel(domainType),
43+
OptionsBuilder.getReplicateTo(domainType), OptionsBuilder.getDurabilityLevel(domainType, template.getConverter()),
4444
null);
4545
}
4646

src/main/java/org/springframework/data/couchbase/core/ExecutableMutateInByIdOperationSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public <T> ExecutableMutateInById<T> mutateInById(final Class<T> domainType) {
5151
Assert.notNull(domainType, "DomainType must not be null!");
5252
return new ExecutableMutateInByIdSupport(template, domainType, OptionsBuilder.getScopeFrom(domainType),
5353
OptionsBuilder.getCollectionFrom(domainType), null, OptionsBuilder.getPersistTo(domainType),
54-
OptionsBuilder.getReplicateTo(domainType), OptionsBuilder.getDurabilityLevel(domainType),
54+
OptionsBuilder.getReplicateTo(domainType), OptionsBuilder.getDurabilityLevel(domainType, template.getConverter()),
5555
null, Collections.emptyList(), Collections.emptyList(), Collections.emptyList(),
5656
Collections.emptyList(), false);
5757
}

src/main/java/org/springframework/data/couchbase/core/ExecutableRemoveByIdOperationSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public ExecutableRemoveById removeById(Class<?> domainType) {
5252

5353
return new ExecutableRemoveByIdSupport(template, domainType, OptionsBuilder.getScopeFrom(domainType),
5454
OptionsBuilder.getCollectionFrom(domainType), null, OptionsBuilder.getPersistTo(domainType),
55-
OptionsBuilder.getReplicateTo(domainType), OptionsBuilder.getDurabilityLevel(domainType),
55+
OptionsBuilder.getReplicateTo(domainType), OptionsBuilder.getDurabilityLevel(domainType, template.getConverter()),
5656
null);
5757
}
5858

src/main/java/org/springframework/data/couchbase/core/ExecutableReplaceByIdOperationSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public <T> ExecutableReplaceById<T> replaceById(final Class<T> domainType) {
4040
Assert.notNull(domainType, "DomainType must not be null!");
4141
return new ExecutableReplaceByIdSupport<>(template, domainType, OptionsBuilder.getScopeFrom(domainType),
4242
OptionsBuilder.getCollectionFrom(domainType), null, OptionsBuilder.getPersistTo(domainType),
43-
OptionsBuilder.getReplicateTo(domainType), OptionsBuilder.getDurabilityLevel(domainType),
43+
OptionsBuilder.getReplicateTo(domainType), OptionsBuilder.getDurabilityLevel(domainType, template.getConverter()),
4444
null);
4545
}
4646

src/main/java/org/springframework/data/couchbase/core/ExecutableUpsertByIdOperationSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public <T> ExecutableUpsertById<T> upsertById(final Class<T> domainType) {
4040
Assert.notNull(domainType, "DomainType must not be null!");
4141
return new ExecutableUpsertByIdSupport<>(template, domainType, OptionsBuilder.getScopeFrom(domainType),
4242
OptionsBuilder.getCollectionFrom(domainType), null, OptionsBuilder.getPersistTo(domainType),
43-
OptionsBuilder.getReplicateTo(domainType), OptionsBuilder.getDurabilityLevel(domainType),
43+
OptionsBuilder.getReplicateTo(domainType), OptionsBuilder.getDurabilityLevel(domainType, template.getConverter()),
4444
null);
4545
}
4646

src/main/java/org/springframework/data/couchbase/core/ReactiveInsertByIdOperationSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public <T> ReactiveInsertById<T> insertById(final Class<T> domainType) {
6161
Assert.notNull(domainType, "DomainType must not be null!");
6262
return new ReactiveInsertByIdSupport<>(template, domainType, OptionsBuilder.getScopeFrom(domainType),
6363
OptionsBuilder.getCollectionFrom(domainType), null, OptionsBuilder.getPersistTo(domainType),
64-
OptionsBuilder.getReplicateTo(domainType), OptionsBuilder.getDurabilityLevel(domainType),
64+
OptionsBuilder.getReplicateTo(domainType), OptionsBuilder.getDurabilityLevel(domainType, template.getConverter()),
6565
null, template.support());
6666
}
6767

src/main/java/org/springframework/data/couchbase/core/ReactiveMutateInByIdOperationSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public <T> ReactiveMutateInById<T> mutateInById(final Class<T> domainType) {
5252
Assert.notNull(domainType, "DomainType must not be null!");
5353
return new ReactiveMutateInByIdSupport<>(template, domainType, OptionsBuilder.getScopeFrom(domainType),
5454
OptionsBuilder.getCollectionFrom(domainType), null, OptionsBuilder.getPersistTo(domainType),
55-
OptionsBuilder.getReplicateTo(domainType), OptionsBuilder.getDurabilityLevel(domainType),
55+
OptionsBuilder.getReplicateTo(domainType), OptionsBuilder.getDurabilityLevel(domainType, template.getConverter()),
5656
null, template.support(), Collections.emptyList(), Collections.emptyList(), Collections.emptyList(),
5757
Collections.emptyList(), false);
5858
}

src/main/java/org/springframework/data/couchbase/core/ReactiveRemoveByIdOperationSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public ReactiveRemoveById removeById() {
6767
public ReactiveRemoveById removeById(Class<?> domainType) {
6868
return new ReactiveRemoveByIdSupport(template, domainType, OptionsBuilder.getScopeFrom(domainType),
6969
OptionsBuilder.getCollectionFrom(domainType), null, OptionsBuilder.getPersistTo(domainType),
70-
OptionsBuilder.getReplicateTo(domainType), OptionsBuilder.getDurabilityLevel(domainType),
70+
OptionsBuilder.getReplicateTo(domainType), OptionsBuilder.getDurabilityLevel(domainType, template.getConverter()),
7171
null);
7272
}
7373

0 commit comments

Comments
 (0)