Skip to content

[DE-101] deprecated hash and skiplist indexes #424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions src/main/java/com/arangodb/ArangoCollection.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public interface ArangoCollection extends ArangoSerializationAccessor {
/**
* Creates new documents from the given documents, unless there is already a document with the _key given. If no
* _key is given, a new unique _key is generated automatically.
*
* <p>
* Limitations:
* - the fields having {@code null} value are always removed during serialization
*
Expand All @@ -94,7 +94,7 @@ public interface ArangoCollection extends ArangoSerializationAccessor {
/**
* Creates new documents from the given documents, unless there is already a document with the _key given. If no
* _key is given, a new unique _key is generated automatically.
*
* <p>
* Limitations:
* - the fields having {@code null} value are always removed during serialization
*
Expand All @@ -110,7 +110,7 @@ <T> MultiDocumentEntity<DocumentCreateEntity<T>> insertDocuments(

/**
* Bulk imports the given values into the collection.
*
* <p>
* Limitations:
* - the fields having {@code null} value are always removed during serialization
*
Expand All @@ -122,7 +122,7 @@ <T> MultiDocumentEntity<DocumentCreateEntity<T>> insertDocuments(

/**
* Bulk imports the given values into the collection.
*
* <p>
* Limitations:
* - the fields having {@code null} value are always removed during serialization
*
Expand All @@ -135,7 +135,7 @@ <T> MultiDocumentEntity<DocumentCreateEntity<T>> insertDocuments(

/**
* Bulk imports the given values into the collection.
*
* <p>
* Limitations:
* - the fields having {@code null} value are always removed during serialization
*
Expand All @@ -147,7 +147,7 @@ <T> MultiDocumentEntity<DocumentCreateEntity<T>> insertDocuments(

/**
* Bulk imports the given values into the collection.
*
* <p>
* Limitations:
* - the fields having {@code null} value are always removed during serialization
*
Expand Down Expand Up @@ -236,7 +236,7 @@ <T> DocumentUpdateEntity<T> replaceDocument(String key, T value, DocumentReplace
/**
* Replaces multiple documents in the specified collection with the ones in the values, the replaced documents are
* specified by the _key attributes in the documents in values.
*
* <p>
* Limitations:
* - the fields having {@code null} value are always removed during serialization
*
Expand All @@ -251,7 +251,7 @@ <T> DocumentUpdateEntity<T> replaceDocument(String key, T value, DocumentReplace
/**
* Replaces multiple documents in the specified collection with the ones in the values, the replaced documents are
* specified by the _key attributes in the documents in values.
*
* <p>
* Limitations:
* - the fields having {@code null} value are always removed during serialization
*
Expand Down Expand Up @@ -300,10 +300,10 @@ <T> DocumentUpdateEntity<T> updateDocument(String key, T value, DocumentUpdateOp
* to patch (the patch document). All attributes from the patch document will be added to the existing document if
* they do not yet exist, and overwritten in the existing document if they do exist there.
*
* @param key The key of the document
* @param value A representation of a single document (POJO, VPackSlice or String for JSON)
* @param options Additional options, can be null
* @param returnType Type of the returned newDocument and/or oldDocument
* @param key The key of the document
* @param value A representation of a single document (POJO, VPackSlice or String for JSON)
* @param options Additional options, can be null
* @param returnType Type of the returned newDocument and/or oldDocument
* @return information about the document
* @throws ArangoDBException
* @see <a href="https://www.arangodb.com/docs/stable/http/document-working-with-documents.html#update-document">API
Expand Down Expand Up @@ -465,7 +465,10 @@ <T> MultiDocumentEntity<DocumentDeleteEntity<T>> deleteDocuments(
* @return information about the index
* @throws ArangoDBException
* @see <a href="https://www.arangodb.com/docs/stable/http/indexes-hash.html#create-hash-index">API Documentation</a>
* @deprecated use {@link #ensurePersistentIndex(Iterable, PersistentIndexOptions)} instead. Since ArangoDB 3.7 a
* hash index is an alias for a persistent index.
*/
@Deprecated
IndexEntity ensureHashIndex(Iterable<String> fields, HashIndexOptions options) throws ArangoDBException;

/**
Expand All @@ -477,7 +480,10 @@ <T> MultiDocumentEntity<DocumentDeleteEntity<T>> deleteDocuments(
* @throws ArangoDBException
* @see <a href="https://www.arangodb.com/docs/stable/http/indexes-skiplist.html#create-skip-list">API
* Documentation</a>
* @deprecated use {@link #ensurePersistentIndex(Iterable, PersistentIndexOptions)} instead. Since ArangoDB 3.7 a
* skiplist index is an alias for a persistent index.
*/
@Deprecated
IndexEntity ensureSkiplistIndex(Iterable<String> fields, SkiplistIndexOptions options) throws ArangoDBException;

/**
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/arangodb/async/ArangoCollectionAsync.java
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,10 @@ <T> CompletableFuture<MultiDocumentEntity<DocumentDeleteEntity<T>>> deleteDocume
* @param options Additional options, can be null
* @return information about the index
* @see <a href="https://www.arangodb.com/docs/stable/http/indexes-hash.html#create-hash-index">API Documentation</a>
* @deprecated use {@link #ensurePersistentIndex(Iterable, PersistentIndexOptions)} instead. Since ArangoDB 3.7 a
* hash index is an alias for a persistent index.
*/
@Deprecated
CompletableFuture<IndexEntity> ensureHashIndex(final Iterable<String> fields, final HashIndexOptions options);

/**
Expand All @@ -444,7 +447,10 @@ <T> CompletableFuture<MultiDocumentEntity<DocumentDeleteEntity<T>>> deleteDocume
* @return information about the index
* @see <a href="https://www.arangodb.com/docs/stable/http/indexes-skiplist.html#create-skip-list">API
* Documentation</a>
* @deprecated use {@link #ensurePersistentIndex(Iterable, PersistentIndexOptions)} instead. Since ArangoDB 3.7 a
* skiplist index is an alias for a persistent index.
*/
@Deprecated
CompletableFuture<IndexEntity> ensureSkiplistIndex(
final Iterable<String> fields,
final SkiplistIndexOptions options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,15 @@ public CompletableFuture<String> deleteIndex(final String id) {
}

@Override
@Deprecated
public CompletableFuture<IndexEntity> ensureHashIndex(
final Iterable<String> fields,
final HashIndexOptions options) {
return executor.execute(createHashIndexRequest(fields, options), IndexEntity.class);
}

@Override
@Deprecated
public CompletableFuture<IndexEntity> ensureSkiplistIndex(
final Iterable<String> fields,
final SkiplistIndexOptions options) {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/arangodb/internal/ArangoCollectionImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,14 @@ public String deleteIndex(final String id) throws ArangoDBException {
return executor.execute(deleteIndexRequest(id), deleteIndexResponseDeserializer());
}

@Deprecated
@Override
public IndexEntity ensureHashIndex(final Iterable<String> fields, final HashIndexOptions options)
throws ArangoDBException {
return executor.execute(createHashIndexRequest(fields, options), IndexEntity.class);
}

@Deprecated
@Override
public IndexEntity ensureSkiplistIndex(final Iterable<String> fields, final SkiplistIndexOptions options)
throws ArangoDBException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ private String createIndexId(final String id) {
return index;
}

@Deprecated
protected Request createHashIndexRequest(final Iterable<String> fields, final HashIndexOptions options) {
final Request request = request(db.dbName(), RequestType.POST, PATH_API_INDEX);
request.putQueryParam(COLLECTION, name);
Expand All @@ -555,6 +556,7 @@ protected Request createHashIndexRequest(final Iterable<String> fields, final Ha
return request;
}

@Deprecated
protected Request createSkiplistIndexRequest(final Iterable<String> fields, final SkiplistIndexOptions options) {
final Request request = request(db.dbName(), RequestType.POST, PATH_API_INDEX);
request.putQueryParam(COLLECTION, name);
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/arangodb/model/HashIndexOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
/**
* @author Mark Vollmary
* @see <a href="https://www.arangodb.com/docs/stable/http/indexes-hash.html#create-hash-index">API Documentation</a>
* @deprecated use {@link PersistentIndexOptions} instead. Since ArangoDB 3.7 a hash index is an alias for a persistent
* index.
*/
@Deprecated
public class HashIndexOptions extends IndexOptions<HashIndexOptions> {

private Iterable<String> fields;
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/arangodb/model/OptionsBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,20 @@ public static UserCreateOptions build(final UserCreateOptions options, final Str
return options.user(user).passwd(passwd);
}

/**
* @deprecated use {@link #build(PersistentIndexOptions, Iterable)} instead. Since ArangoDB 3.7 a hash index is an
* alias for a persistent index.
*/
@Deprecated
public static HashIndexOptions build(final HashIndexOptions options, final Iterable<String> fields) {
return options.fields(fields);
}

/**
* @deprecated use {@link #build(PersistentIndexOptions, Iterable)} instead. Since ArangoDB 3.7 a skiplist index is
* an alias for a persistent index.
*/
@Deprecated
public static SkiplistIndexOptions build(final SkiplistIndexOptions options, final Iterable<String> fields) {
return options.fields(fields);
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/arangodb/model/SkiplistIndexOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
/**
* @author Mark Vollmary
* @see <a href="https://www.arangodb.com/docs/stable/http/indexes-skiplist.html#create-skip-list">API Documentation</a>
* @deprecated use {@link PersistentIndexOptions} instead. Since ArangoDB 3.7 a skiplist index is an alias for a
* persistent index.
*/
@Deprecated
public class SkiplistIndexOptions extends IndexOptions<SkiplistIndexOptions> {

private Iterable<String> fields;
Expand Down