arangodb-net-standard icon indicating copy to clipboard operation
arangodb-net-standard copied to clipboard

Add support for satellite graphs in graph API

Open DiscoPYF opened this issue 5 years ago • 4 comments

Release notes: https://www.arangodb.com/docs/stable/release-notes-new-features37.html#satellitegraphs

Looking at the documentation for the HTTP API, it is not gonna be straightforward to include. They use the existing replicationFactor attribute to identify creation of satellite graphs.

replicationFactor: The replication factor used when initially creating collections for this graph. Can be set to "satellite" to create a SatelliteGraph, which will ignore numberOfShards, minReplicationFactor and writeConcern (Enterprise Edition only).

https://www.arangodb.com/docs/stable/http/gharial-management.html

DiscoPYF avatar Nov 17 '20 12:11 DiscoPYF

Took a peek at the java driver implementation. They use a dedicated class to represent the replication factor:

https://github.com/arangodb/arangodb-java-driver/blob/f75985b35693b793dfc3c4fe4663653a34919bba/src/main/java/com/arangodb/entity/ReplicationFactor.java#L26

DiscoPYF avatar Nov 17 '20 13:11 DiscoPYF

You might also want to consider the alternative approach adopted in the upcoming reactive Java driver, which has an interface ReplicationFactor and 2 implementations NumericReplicationFactor and SatelliteReplicationFactor.

However this is possible because Java allows covariant return types for overridden methods, but this is only possible from C# 9. Maybe with previous versions you can achieve something similar returning a covariant generic.

https://github.com/arangodb/arangodb-java-driver/blob/next/arangodb-java-driver/src/main/java/com/arangodb/next/api/entity/ReplicationFactor.java

https://github.com/arangodb/arangodb-java-driver/blob/next/arangodb-java-driver/src/main/java/com/arangodb/next/api/entity/SatelliteReplicationFactor.java

https://github.com/arangodb/arangodb-java-driver/blob/next/arangodb-java-driver/src/main/java/com/arangodb/next/api/entity/NumericReplicationFactor.java

rashtao avatar Nov 17 '20 16:11 rashtao

Thanks for the tip @rashtao !

Another approach would be to create a separate method, e.g. PostSatelliteGraph. This would be really easy to implement, but it would not have a one to one relationship with a specific route contrary to other methods.

DiscoPYF avatar Nov 24 '20 09:11 DiscoPYF

@DiscoPYF , what if we change the type of ReplicationFactor to object and then add some validation in PostGraphAsync()?

tjoubert avatar Jul 27 '22 13:07 tjoubert