Skip to content

Commit 757fe99

Browse files
author
mpv1989
committed
Add GraphCreateOptions.replicationFactor(Integer)
1 parent 9b7b6e0 commit 757fe99

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ v4.2.5 (2017-xx-xx)
33
* issue #146: added ArangoCollection.exists()
44
* added ArangoDatabase.exists()
55
* issue #152: added BaseDocument.setId(String)
6+
* added GraphCreateOptions.replicationFactor(Integer)
67

78
v4.2.4 (2017-09-04)
89
---------------------------

src/main/java/com/arangodb/model/GraphCreateOptions.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,26 @@ public GraphCreateOptions isSmart(final Boolean isSmart) {
9999
return this;
100100
}
101101

102+
public Integer getReplicationFactor() {
103+
return getOptions().getReplicationFactor();
104+
}
105+
106+
/**
107+
* @param replicationFactor
108+
* (The default is 1): in a cluster, this attribute determines how many copies of each shard are kept on
109+
* different DBServers. The value 1 means that only one copy (no synchronous replication) is kept. A
110+
* value of k means that k-1 replicas are kept. Any two copies reside on different DBServers. Replication
111+
* between them is synchronous, that is, every write operation to the "leader" copy will be replicated to
112+
* all "follower" replicas, before the write operation is reported successful. If a server fails, this is
113+
* detected automatically and one of the servers holding copies take over, usually without an error being
114+
* reported.
115+
* @return options
116+
*/
117+
public GraphCreateOptions replicationFactor(final Integer replicationFactor) {
118+
getOptions().setReplicationFactor(replicationFactor);
119+
return this;
120+
}
121+
102122
public Integer getNumberOfShards() {
103123
return getOptions().getNumberOfShards();
104124
}
@@ -136,13 +156,22 @@ private SmartOptions getOptions() {
136156
}
137157

138158
public static class SmartOptions {
159+
private Integer replicationFactor;
139160
private Integer numberOfShards;
140161
private String smartGraphAttribute;
141162

142163
public SmartOptions() {
143164
super();
144165
}
145166

167+
public Integer getReplicationFactor() {
168+
return replicationFactor;
169+
}
170+
171+
public void setReplicationFactor(final Integer replicationFactor) {
172+
this.replicationFactor = replicationFactor;
173+
}
174+
146175
public Integer getNumberOfShards() {
147176
return numberOfShards;
148177
}

0 commit comments

Comments
 (0)