com.arangodb.async.ArangoDatabaseAsync Maven / Gradle / Ivy
/*
* DISCLAIMER
*
* Copyright 2016 ArangoDB GmbH, Cologne, Germany
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright holder is ArangoDB GmbH, Cologne, Germany
*/
package com.arangodb.async;
import com.arangodb.ArangoSerdeAccessor;
import com.arangodb.DbName;
import com.arangodb.entity.*;
import com.arangodb.entity.arangosearch.analyzer.SearchAnalyzer;
import com.arangodb.model.*;
import com.arangodb.model.arangosearch.AnalyzerDeleteOptions;
import com.arangodb.model.arangosearch.ArangoSearchCreateOptions;
import com.arangodb.model.arangosearch.SearchAliasCreateOptions;
import javax.annotation.concurrent.ThreadSafe;
import java.util.Collection;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
/**
* Interface for operations on ArangoDB database level.
*
* @author Mark Vollmary
* @see Databases API Documentation
* @see Query API Documentation
*/
@ThreadSafe
public interface ArangoDatabaseAsync extends ArangoSerdeAccessor {
/**
* Return the main entry point for the ArangoDB driver
*
* @return main entry point
*/
ArangoDBAsync arango();
/**
* Returns the name of the database
*
* @return database name
*/
DbName dbName();
/**
* Returns the server name and version number.
*
* @return the server version, number
* @see API
* Documentation
*/
CompletableFuture getVersion();
/**
* Returns the name of the used storage engine.
*
* @return the storage engine name
* @see
* API
* Documentation
*/
CompletableFuture getEngine();
/**
* Checks whether the database exists
*
* @return true if the database exists, otherwise false
*/
CompletableFuture exists();
/**
* Retrieves a list of all databases the current user can access
*
* @return a list of all databases the current user can access
* @see API
* Documentation
*/
CompletableFuture> getAccessibleDatabases();
/**
* Returns a handler of the collection by the given name
*
* @param name Name of the collection
* @return collection handler
*/
ArangoCollectionAsync collection(final String name);
/**
* Creates a collection
*
* @param name The name of the collection
* @return information about the collection
* @see API
* Documentation
*/
CompletableFuture createCollection(final String name);
/**
* Creates a collection
*
* @param name The name of the collection
* @param options Additional options, can be null
* @return information about the collection
* @see API
* Documentation
*/
CompletableFuture createCollection(final String name, final CollectionCreateOptions options);
/**
* Returns all collections
*
* @return list of information about all collections
* @see API
* Documentation
*/
CompletableFuture> getCollections();
/**
* Returns all collections
*
* @param options Additional options, can be null
* @return list of information about all collections
* @see API
* Documentation
*/
CompletableFuture> getCollections(final CollectionsReadOptions options);
/**
* Returns an index
*
* @param id The index-handle
* @return information about the index
* @see
* API Documentation
*/
CompletableFuture getIndex(final String id);
/**
* Deletes an index
*
* @param id The index handle
* @return the id of the index
* @see
* API Documentation
*/
CompletableFuture deleteIndex(final String id);
/**
* Creates the database
*
* @return true if the database was created successfully.
* @see API
* Documentation
*/
CompletableFuture create();
/**
* Drop an existing database
*
* @return true if the database was dropped successfully
* @see API
* Documentation
*/
CompletableFuture drop();
/**
* Grants access to the database dbname for user user. You need permission to the _system database in order to
* execute this call.
*
* @param user The name of the user
* @param permissions The permissions the user grant
* @return void
* @see
* API Documentation
*/
CompletableFuture grantAccess(final String user, final Permissions permissions);
/**
* Grants access to the database dbname for user user. You need permission to the _system database in order to
* execute this call.
*
* @param user The name of the user
* @return void
* @see
* API Documentation
*/
CompletableFuture grantAccess(final String user);
/**
* Revokes access to the database dbname for user user. You need permission to the _system database in order to
* execute this call.
*
* @param user The name of the user
* @return void
* @see
* API Documentation
*/
CompletableFuture revokeAccess(final String user);
/**
* Clear the database access level, revert back to the default access level.
*
* @param user The name of the user
* @return void
* @see
* API Documentation
* @since ArangoDB 3.2.0
*/
CompletableFuture resetAccess(final String user);
/**
* Sets the default access level for collections within this database for the user user
. You need
* permission to the _system database in order to execute this call.
*
* @param user The name of the user
* @param permissions The permissions the user grant
* @since ArangoDB 3.2.0
*/
CompletableFuture grantDefaultCollectionAccess(final String user, final Permissions permissions);
/**
* Get specific database access level
*
* @param user The name of the user
* @return permissions of the user
* @see API
* Documentation
* @since ArangoDB 3.2.0
*/
CompletableFuture getPermissions(final String user);
/**
* Performs a database query using the given {@code query} and {@code bindVars}, then returns a new
* {@code ArangoCursor} instance for the result list.
*
* @param query contains the query string to be executed
* @param bindVars key/value pairs representing the bind parameters
* @param options Additional options, can be null
* @param type The type of the result (POJO or {@link com.arangodb.util.RawData})
* @return cursor of the results
* @see
* API
* Documentation
*/
CompletableFuture> query(
final String query,
final Map bindVars,
final AqlQueryOptions options,
final Class type);
/**
* Performs a database query using the given {@code query}, then returns a new {@code ArangoCursor} instance for the
* result list.
*
* @param query contains the query string to be executed
* @param options Additional options, can be null
* @param type The type of the result (POJO or {@link com.arangodb.util.RawData})
* @return cursor of the results
* @see
* API
* Documentation
*/
CompletableFuture> query(
final String query,
final AqlQueryOptions options,
final Class type);
/**
* Performs a database query using the given {@code query} and {@code bindVars}, then returns a new
* {@code ArangoCursor} instance for the result list.
*
* @param query contains the query string to be executed
* @param bindVars key/value pairs representing the bind parameters
* @param type The type of the result (POJO or {@link com.arangodb.util.RawData})
* @return cursor of the results
* @see
* API
* Documentation
*/
CompletableFuture> query(
final String query,
final Map bindVars,
final Class type);
/**
* Performs a database query using the given {@code query}, then returns a new {@code ArangoCursor} instance for the
* result list.
*
* @param query contains the query string to be executed
* @param type The type of the result (POJO or {@link com.arangodb.util.RawData})
* @return cursor of the results
* @see
* API
* Documentation
*/
CompletableFuture> query(final String query, final Class type);
/**
* Return an cursor from the given cursor-ID if still existing
*
* @param cursorId The ID of the cursor
* @param type The type of the result (POJO or {@link com.arangodb.util.RawData})
* @return cursor of the results
* @see API
* Documentation
*/
CompletableFuture> cursor(final String cursorId, final Class type);
/**
* Explain an AQL query and return information about it
*
* @param query the query which you want explained
* @param bindVars key/value pairs representing the bind parameters
* @param options Additional options, can be null
* @return information about the query
* @see API
* Documentation
*/
CompletableFuture explainQuery(
final String query,
final Map bindVars,
final AqlQueryExplainOptions options);
/**
* Parse an AQL query and return information about it This method is for query validation only. To actually query
* the database, see {@link ArangoDatabaseAsync#query(String, Map, AqlQueryOptions, Class)}
*
* @param query the query which you want parse
* @return imformation about the query
* @see API
* Documentation
*/
CompletableFuture parseQuery(final String query);
/**
* Clears the AQL query cache
*
* @return void
* @see API
* Documentation
*/
CompletableFuture clearQueryCache();
/**
* Returns the global configuration for the AQL query cache
*
* @return configuration for the AQL query cache
* @see API
* Documentation
*/
CompletableFuture getQueryCacheProperties();
/**
* Changes the configuration for the AQL query cache. Note: changing the properties may invalidate all results in
* the cache.
*
* @param properties properties to be set
* @return current set of properties
* @see API
* Documentation
*/
CompletableFuture setQueryCacheProperties(final QueryCachePropertiesEntity properties);
/**
* Returns the configuration for the AQL query tracking
*
* @return configuration for the AQL query tracking
* @see API
* Documentation
*/
CompletableFuture getQueryTrackingProperties();
/**
* Changes the configuration for the AQL query tracking
*
* @param properties properties to be set
* @return current set of properties
* @see API
* Documentation
*/
CompletableFuture setQueryTrackingProperties(
final QueryTrackingPropertiesEntity properties);
/**
* Returns a list of currently running AQL queries
*
* @return a list of currently running AQL queries
* @see API
* Documentation
*/
CompletableFuture> getCurrentlyRunningQueries();
/**
* Returns a list of slow running AQL queries
*
* @return a list of slow running AQL queries
* @see API
* Documentation
*/
CompletableFuture> getSlowQueries();
/**
* Clears the list of slow AQL queries
*
* @return void
* @see API
* Documentation
*/
CompletableFuture clearSlowQueries();
/**
* Kills a running query. The query will be terminated at the next cancelation point.
*
* @param id The id of the query
* @return void
* @see API
* Documentation
*/
CompletableFuture killQuery(final String id);
/**
* Create a new AQL user function
*
* @param name the fully qualified name of the user functions
* @param code a string representation of the function body
* @param options Additional options, can be null
* @return void
* @see API
* Documentation
*/
CompletableFuture createAqlFunction(
final String name,
final String code,
final AqlFunctionCreateOptions options);
/**
* Remove an existing AQL user function
*
* @param name the name of the AQL user function
* @param options Additional options, can be null
* @return number of deleted functions (since ArangoDB 3.4.0)
* @see API
* Documentation
*/
CompletableFuture deleteAqlFunction(final String name, final AqlFunctionDeleteOptions options);
/**
* Gets all reqistered AQL user functions
*
* @param options Additional options, can be null
* @return all reqistered AQL user functions
* @see API
* Documentation
*/
CompletableFuture> getAqlFunctions(final AqlFunctionGetOptions options);
/**
* Returns a handler of the graph by the given name
*
* @param name Name of the graph
* @return graph handler
*/
ArangoGraphAsync graph(final String name);
/**
* Create a new graph in the graph module. The creation of a graph requires the name of the graph and a definition
* of its edges.
*
* @param name Name of the graph
* @param edgeDefinitions An array of definitions for the edge
* @return information about the graph
* @see API
* Documentation
*/
CompletableFuture createGraph(final String name, final Collection edgeDefinitions);
/**
* Create a new graph in the graph module. The creation of a graph requires the name of the graph and a definition
* of its edges.
*
* @param name Name of the graph
* @param edgeDefinitions An array of definitions for the edge
* @param options Additional options, can be null
* @return information about the graph
* @see API
* Documentation
*/
CompletableFuture createGraph(
final String name,
final Collection edgeDefinitions,
final GraphCreateOptions options);
/**
* Lists all graphs known to the graph module
*
* @return graphs stored in this database
* @see API
* Documentation
*/
CompletableFuture> getGraphs();
/**
* Execute a server-side transaction
*
* @param action the actual transaction operations to be executed, in the form of stringified JavaScript code
* @param type The type of the result (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options, can be null
* @return the result of the transaction if it succeeded
* @see API
* Documentation
*/
CompletableFuture transaction(final String action, final Class type, final TransactionOptions options);
/**
* Begins a Stream Transaction.
*
* @param options Additional options, can be null
* @return information about the transaction
* @see
* API
* Documentation
* @since ArangoDB 3.5.0
*/
CompletableFuture beginStreamTransaction(StreamTransactionOptions options);
/**
* Aborts a Stream Transaction.
*
* @return information about the transaction
* @see
* API
* Documentation
*/
CompletableFuture abortStreamTransaction(String id);
/**
* Gets information about a Stream Transaction.
*
* @return information about the transaction
* @see
*
* API Documentation
* @since ArangoDB 3.5.0
*/
CompletableFuture getStreamTransaction(String id);
/**
* Gets all the currently running Stream Transactions.
*
* @return all the currently running Stream Transactions
* @see
*
* API Documentation
* @since ArangoDB 3.5.0
*/
CompletableFuture> getStreamTransactions();
/**
* Commits a Stream Transaction.
*
* @return information about the transaction
* @see
*
* API Documentation
* @since ArangoDB 3.5.0
*/
CompletableFuture commitStreamTransaction(String id);
/**
* Retrieves information about the current database
*
* @return information about the current database
* @see API
* Documentation
*/
CompletableFuture getInfo();
/**
* Reads a single document
*
* @param id The id of the document
* @param type The type of the document (POJO or {@link com.arangodb.util.RawData})
* @return the document identified by the id
* @see API
* Documentation
*/
CompletableFuture getDocument(final String id, final Class type);
/**
* Reads a single document
*
* @param id The id of the document
* @param type The type of the document (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options, can be null
* @return the document identified by the id
* @see API
* Documentation
*/
CompletableFuture getDocument(final String id, final Class type, final DocumentReadOptions options);
/**
* Reload the routing table.
*
* @return void
* @see API
* Documentation
*/
CompletableFuture reloadRouting();
/**
* Returns a new {@link ArangoRouteAsync} instance for the given path (relative to the database) that can be used to
* perform arbitrary requests.
*
* @param path The database-relative URL of the route
* @return {@link ArangoRouteAsync}
*/
ArangoRouteAsync route(String... path);
/**
* Fetches all views from the database and returns an list of view descriptions.
*
* @return list of information about all views
* @see
* API Documentation
* @since ArangoDB 3.4.0
*/
CompletableFuture> getViews();
/**
* Returns a {@code ArangoViewAsync} instance for the given view name.
*
* @param name Name of the view
* @return view handler
* @since ArangoDB 3.4.0
*/
ArangoViewAsync view(String name);
/**
* Returns a {@link ArangoSearchAsync} instance for the given ArangoSearch view name.
*
* @param name Name of the view
* @return ArangoSearch view handler
* @since ArangoDB 3.4.0
*/
ArangoSearchAsync arangoSearch(String name);
/**
* Returns a {@link SearchAliasAsync} instance for the given view name.
*
* @param name Name of the view
* @return SearchAlias view handler
* @since ArangoDB 3.10
*/
SearchAliasAsync searchAlias(String name);
/**
* Creates a view of the given {@code type}, then returns view information from the server.
*
* @param name The name of the view
* @param type The type of the view
* @return information about the view
* @since ArangoDB 3.4.0
*/
CompletableFuture createView(String name, ViewType type);
/**
* Creates a ArangoSearch view with the given {@code options}, then returns view information from the server.
*
* @param name The name of the view
* @param options Additional options, can be null
* @return information about the view
* @see API
* Documentation
* @since ArangoDB 3.4.0
*/
CompletableFuture createArangoSearch(String name, ArangoSearchCreateOptions options);
/**
* Creates a SearchAlias view with the given {@code options}, then returns view information from the server.
*
* @param name The name of the view
* @param options Additional options, can be null
* @return information about the view
* @see API
* Documentation
* @since ArangoDB 3.10
*/
CompletableFuture createSearchAlias(String name, SearchAliasCreateOptions options);
/**
* Creates an Analyzer
*
* @param analyzer SearchAnalyzer
* @return the created Analyzer
* @see API Documentation
* @since ArangoDB 3.5.0
*/
CompletableFuture createSearchAnalyzer(SearchAnalyzer analyzer);
/**
* Gets information about an Analyzer
*
* @param name of the Analyzer without database prefix
* @return information about an Analyzer
* @see API Documentation
* @since ArangoDB 3.5.0
*/
CompletableFuture getSearchAnalyzer(String name);
/**
* Retrieves all analyzers definitions.
*
* @return collection of all analyzers definitions
* @see API Documentation
* @since ArangoDB 3.5.0
*/
CompletableFuture> getSearchAnalyzers();
/**
* Deletes an Analyzer
*
* @param name of the Analyzer without database prefix
* @see API Documentation
* @since ArangoDB 3.5.0
*/
CompletableFuture deleteSearchAnalyzer(String name);
/**
* Deletes an Analyzer
*
* @param name of the Analyzer without database prefix
* @param options AnalyzerDeleteOptions
* @see API Documentation
* @since ArangoDB 3.5.0
*/
CompletableFuture deleteSearchAnalyzer(String name, AnalyzerDeleteOptions options);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy