Skip to content

Commit 9f95607

Browse files
authored
[DE-60] Deprecate usage of deprecated server API (#440)
* request next cursor batch using POST method instead of PUT * deprecated collection id * deprecated load/unload collection * deprecated DocumentCreateOptions.overwrite() * deprecated minReplicationFactor in favor of writeConcern * deprecated traversal API
1 parent 7a5c01f commit 9f95607

16 files changed

+124
-14
lines changed

src/main/java/com/arangodb/ArangoCollection.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,9 @@ <T> MultiDocumentEntity<DocumentDeleteEntity<T>> deleteDocuments(
661661
* @throws ArangoDBException
662662
* @see <a href="https://www.arangodb.com/docs/stable/http/collection-modifying.html#load-collection">API
663663
* Documentation</a>
664+
* @deprecated MMFiles only
664665
*/
666+
@Deprecated
665667
CollectionEntity load() throws ArangoDBException;
666668

667669
/**
@@ -672,7 +674,9 @@ <T> MultiDocumentEntity<DocumentDeleteEntity<T>> deleteDocuments(
672674
* @throws ArangoDBException
673675
* @see <a href="https://www.arangodb.com/docs/stable/http/collection-modifying.html#unload-collection">API
674676
* Documentation</a>
677+
* @deprecated MMFiles only
675678
*/
679+
@Deprecated
676680
CollectionEntity unload() throws ArangoDBException;
677681

678682
/**

src/main/java/com/arangodb/async/ArangoCollectionAsync.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,9 @@ CompletableFuture<IndexEntity> ensureFulltextIndex(
615615
* @return information about the collection
616616
* @see <a href="https://www.arangodb.com/docs/stable/http/collection-modifying.html#load-collection">API
617617
* Documentation</a>
618+
* @deprecated MMFiles only
618619
*/
620+
@Deprecated
619621
CompletableFuture<CollectionEntity> load();
620622

621623
/**
@@ -625,7 +627,9 @@ CompletableFuture<IndexEntity> ensureFulltextIndex(
625627
* @return information about the collection
626628
* @see <a href="https://www.arangodb.com/docs/stable/http/collection-modifying.html#unload-collection">API
627629
* Documentation</a>
630+
* @deprecated MMFiles only
628631
*/
632+
@Deprecated
629633
CompletableFuture<CollectionEntity> unload();
630634

631635
/**

src/main/java/com/arangodb/entity/CollectionEntity.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ public CollectionEntity() {
4141
super();
4242
}
4343

44+
/**
45+
* @deprecated Accessing collections by their internal ID instead of accessing them by name is deprecated and highly
46+
* discouraged. This functionality may be removed in future versions of ArangoDB.
47+
*/
48+
@Deprecated
4449
public String getId() {
4550
return id;
4651
}

src/main/java/com/arangodb/entity/CollectionPropertiesEntity.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class CollectionPropertiesEntity extends CollectionEntity {
3838
private Collection<String> shardKeys;
3939
private final ReplicationFactor replicationFactor;
4040
private final MinReplicationFactor minReplicationFactor;
41-
41+
private Integer writeConcern;
4242
private String shardingStrategy; // cluster option
4343
private String smartJoinAttribute; // enterprise option
4444

@@ -119,14 +119,30 @@ public void setReplicationFactor(final Integer replicationFactor) {
119119
this.replicationFactor.setReplicationFactor(replicationFactor);
120120
}
121121

122+
/**
123+
* @deprecated use {@link #getWriteConcern()} instead
124+
*/
125+
@Deprecated
122126
public Integer getMinReplicationFactor() {
123127
return minReplicationFactor.getMinReplicationFactor();
124128
}
125129

130+
/**
131+
* @deprecated use {@link #setWriteConcern(Integer)} instead
132+
*/
133+
@Deprecated
126134
public void setMinReplicationFactor(final Integer minReplicationFactor) {
127135
this.minReplicationFactor.setMinReplicationFactor(minReplicationFactor);
128136
}
129137

138+
public Integer getWriteConcern() {
139+
return writeConcern;
140+
}
141+
142+
public void setWriteConcern(final Integer writeConcern) {
143+
this.writeConcern = writeConcern;
144+
}
145+
130146
/**
131147
* @return whether the collection is a satellite collection. Only in an enterprise cluster setup (else returning null).
132148
*/

src/main/java/com/arangodb/entity/GraphEntity.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public class GraphEntity implements Entity {
4141
private String smartGraphAttribute;
4242
private ReplicationFactor replicationFactor;
4343
private Integer minReplicationFactor;
44+
private Integer writeConcern;
4445

4546
public String getName() {
4647
return name != null ? name : _key;
@@ -74,10 +75,18 @@ public Boolean getSatellite() {
7475
return this.replicationFactor.getSatellite();
7576
}
7677

78+
/**
79+
* @deprecated use {@link #getWriteConcern()} instead
80+
*/
81+
@Deprecated
7782
public Integer getMinReplicationFactor() {
7883
return minReplicationFactor;
7984
}
8085

86+
public Integer getWriteConcern() {
87+
return writeConcern;
88+
}
89+
8190
public String getSmartGraphAttribute() {
8291
return smartGraphAttribute;
8392
}

src/main/java/com/arangodb/entity/MinReplicationFactor.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@
2020

2121
package com.arangodb.entity;
2222

23+
import com.arangodb.model.CollectionCreateOptions;
24+
2325
/**
2426
* @author Heiko Kernbach
27+
* @deprecated use {@link CollectionCreateOptions#writeConcern(Integer)} instead
2528
*/
29+
@Deprecated
2630
public class MinReplicationFactor {
2731

2832
private Integer minReplicationFactor;

src/main/java/com/arangodb/entity/PathEntity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
* @see <a href= "https://www.arangodb.com/docs/stable/http/traversal.html#executes-a-traversal">API
2828
* Documentation</a>
2929
*/
30+
@Deprecated
3031
public class PathEntity<V, E> implements Entity {
3132

3233
private Collection<E> edges;

src/main/java/com/arangodb/entity/TraversalEntity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
* @see <a href= "https://www.arangodb.com/docs/stable/http/traversal.html#executes-a-traversal">API
2828
* Documentation</a>
2929
*/
30+
@Deprecated
3031
public class TraversalEntity<V, E> implements Entity {
3132

3233
private Collection<V> vertices;

src/main/java/com/arangodb/internal/InternalArangoDatabase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ protected Request queryRequest(
186186

187187
protected Request queryNextRequest(final String id, final AqlQueryOptions options, Map<String, String> meta) {
188188

189-
final Request request = request(dbName, RequestType.PUT, PATH_API_CURSOR, id);
189+
final Request request = request(dbName, RequestType.POST, PATH_API_CURSOR, id);
190190

191191
if (meta != null) {
192192
request.getHeaderParam().putAll(meta);

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public class CollectionCreateOptions {
3737
private Long journalSize;
3838
private final ReplicationFactor replicationFactor;
3939
private final MinReplicationFactor minReplicationFactor;
40+
private Integer writeConcern;
4041
private KeyOptions keyOptions;
4142
private Boolean waitForSync;
4243
private Boolean doCompact;
@@ -89,6 +90,10 @@ public Integer getReplicationFactor() {
8990
return replicationFactor.getReplicationFactor();
9091
}
9192

93+
/**
94+
* @deprecated use {@link #getWriteConcern()} instead
95+
*/
96+
@Deprecated
9297
public Integer getMinReplicationFactor() {
9398
return minReplicationFactor.getMinReplicationFactor();
9499
}
@@ -118,12 +123,31 @@ public CollectionCreateOptions replicationFactor(final Integer replicationFactor
118123
* are allowed. Having `minReplicationFactor > 1` requires additional insync copies on follower servers
119124
* to allow writes.
120125
* @return options
126+
* @deprecated use {@link #writeConcern(Integer)} instead
121127
*/
128+
@Deprecated
122129
public CollectionCreateOptions minReplicationFactor(final Integer minReplicationFactor) {
123130
this.minReplicationFactor.setMinReplicationFactor(minReplicationFactor);
124131
return this;
125132
}
126133

134+
public Integer getWriteConcern() {
135+
return writeConcern;
136+
}
137+
138+
/**
139+
* @param writeConcern write concern for this collection (default: 1).
140+
* It determines how many copies of each shard are required to be in sync on the different
141+
* DB-Servers. If there are less then these many copies in the cluster a shard will refuse to
142+
* write. Writes to shards with enough up-to-date copies will succeed at the same time however.
143+
* The value of writeConcern can not be larger than replicationFactor. (cluster only)
144+
* @return options
145+
*/
146+
public CollectionCreateOptions writeConcern(final Integer writeConcern) {
147+
this.writeConcern = writeConcern;
148+
return this;
149+
}
150+
127151
public Boolean getSatellite() {
128152
return replicationFactor.getSatellite();
129153
}

0 commit comments

Comments
 (0)