orientechnologies / orientdb-labs

OrientDB Labs hosts last development version of OrientDB.
Apache License 2.0
17 stars 3 forks source link

[OEP 21] New API for execute pseudo sql command for admin operations #21

Open tglman opened 5 years ago

tglman commented 5 years ago

Summary: This is an attempt to define a generic API for execute admin operations on an OrientDB context.

Goals: Add an API for run a range of not pre-defined admin operations, that can be executed from any connection type.

Non-Goals:

Success metrics:

Motivation: As today each admin operation needed to be defined in all the existing protocols, slowing down all the possible future evolutions, and adding a toll for every single enchantment to third party integrations.

Description: As today all the structural operations have their own API, and some structural operations were moved inside the SQL (all distributed HA) but this operations can be run only inside a database context limiting the set of changes that can be done.

Here we propose to define a new API that can run SQL like operations on top of an OrientDB context, opening to the possibility to define a query language for any kind of structural operations inside OrientDB.

The proposed API are:

OResultSet admin(String command, Map<Object,Object> args); 
OResultSet admin(String command, Object[] args); 

This API is borrowing the OResultSet from the database query API.

One Important detail is the method name, please propose any other if this is not look good for you.

Alternatives:

OResultSet command(String command, Map<Object,Object> args); 
OResultSet command(String command, Object[] args); 
OResultSet execute(String command, Map<Object,Object> args); 
OResultSet execute(String command, Object[] args); 

Risks and assumptions: This move out the static typed API we had so far for structural operations, see for example the OrientDB#create that specify on the API what are the exact possible arguments, even though we can implements save APIs on top of this.

Impact matrix