Skip to content

Commit c5efe09

Browse files
authored
Merge pull request ArangoDB-Community#405 from ArangoDB-Community/feature-3.8/DE-253-add-support-for-satellite-graphs
Added support for satellite graphs in graph API
2 parents a7d505c + 8b5f023 commit c5efe09

File tree

5 files changed

+81
-21
lines changed

5 files changed

+81
-21
lines changed

arangodb-net-standard/GraphApi/GraphApiClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public GraphApiClient(IApiClientTransport transport, IApiClientSerialization ser
5555
/// <remarks>
5656
/// The creation of a graph requires the name of the graph and a definition of its edges.
5757
/// </remarks>
58-
/// <param name="postGraphBody">The information of the graph to create.</param>
58+
/// <param name="postGraphBody">The information of the graph to create. Must be an instance of <see cref="PostSatelliteGraphOptions"/> or <see cref="PostNonSatelliteGraphOptions"/>.</param>
5959
/// <param name="query">Optional query parameters of the request.</param>
6060
/// <param name="token">A CancellationToken to observe while waiting for the task to complete or to cancel the task.</param>
6161
/// <returns></returns>

arangodb-net-standard/GraphApi/Models/PostGraphBody.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ namespace ArangoDBNetStandard.GraphApi.Models
66
/// Represents a request body to create a named graph.
77
/// </summary>
88
/// <remarks>
9-
/// The creation of a graph requires the name of the graph and a definition of its edges.
9+
/// The creation of a graph requires the name of the graph
10+
/// and a definition of its edges.
1011
/// </remarks>
1112
public class PostGraphBody
1213
{
@@ -34,9 +35,20 @@ public class PostGraphBody
3435
/// </remarks>
3536
public bool? IsSmart { get; set; }
3637

38+
/// <summary>
39+
/// (Optional) Whether to create a Disjoint SmartGraph instead
40+
/// of a regular SmartGraph (Enterprise Edition only).
41+
/// </summary>
42+
/// <remarks>
43+
/// (cluster only)
44+
/// </remarks>
45+
public bool? IsDisjoint { get; set; }
46+
3747
/// <summary>
3848
/// (Optional) Defines options for creating collections within this graph.
49+
/// Must be an instance of <see cref="PostSatelliteGraphOptions"/> or
50+
/// <see cref="PostNonSatelliteGraphOptions"/>
3951
/// </summary>
4052
public PostGraphOptions Options { get; set; }
4153
}
42-
}
54+
}
Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
namespace ArangoDBNetStandard.GraphApi.Models
1+
using System.Collections.Generic;
2+
3+
namespace ArangoDBNetStandard.GraphApi.Models
24
{
35
/// <summary>
46
/// Defines options for creating collections within a graph.
57
/// </summary>
6-
public class PostGraphOptions
8+
public abstract class PostGraphOptions
79
{
810
/// <summary>
911
/// The attribute name that is used to smartly shard the vertices of a graph.
@@ -18,21 +20,12 @@ public class PostGraphOptions
1820
public string SmartGraphAttribute { get; set; }
1921

2022
/// <summary>
21-
/// The number of shards that is used for every collection within this graph.
22-
/// Cannot be modified later.
23-
/// </summary>
24-
/// <remarks>
25-
/// (cluster only)
26-
/// </remarks>
27-
public int NumberOfShards { get; set; }
28-
29-
/// <summary>
30-
/// The replication factor used when initially creating collections for this graph
31-
/// (Enterprise Edition only).
23+
/// (Optional) An array of collection names that will be used
24+
/// to create SatelliteCollections for a
25+
/// Hybrid (Disjoint) SmartGraph (Enterprise Edition only).
26+
/// Each array element must be a string and a valid collection name.
27+
/// The collection type cannot be modified later.
3228
/// </summary>
33-
/// <remarks>
34-
/// (cluster only)
35-
/// </remarks>
36-
public int ReplicationFactor { get; set; }
29+
public IEnumerable<string> Satellites { get; set; }
3730
}
38-
}
31+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
namespace ArangoDBNetStandard.GraphApi.Models
2+
{
3+
/// <summary>
4+
/// Options to create a non-satellite graph.
5+
/// </summary>
6+
public class PostNonSatelliteGraphOptions : PostGraphOptions
7+
{
8+
/// <summary>
9+
/// The replication factor used when initially creating collections for this graph
10+
/// (Enterprise Edition only).
11+
/// </summary>
12+
/// <remarks>
13+
/// (cluster only)
14+
/// </remarks>
15+
public int ReplicationFactor { get; set; }
16+
17+
/// <summary>
18+
/// The number of shards that is used for every collection within this graph.
19+
/// Cannot be modified later.
20+
/// </summary>
21+
/// <remarks>
22+
/// (cluster only)
23+
/// </remarks>
24+
public int NumberOfShards { get; set; }
25+
26+
/// <summary>
27+
/// Write concern for new collections in the graph.
28+
/// It determines how many copies of each shard are
29+
/// required to be in sync on the different DB-Servers.
30+
/// If there are less then these many copies in the cluster
31+
/// a shard will refuse to write. Writes to shards with
32+
/// enough up-to-date copies will succeed at the same time however.
33+
/// The value of writeConcern can not be larger than
34+
/// <see cref="ReplicationFactor"/>.
35+
/// </summary>
36+
/// <remarks>
37+
/// (cluster only)
38+
/// </remarks>
39+
public int? WriteConcern { get; set; }
40+
}
41+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
namespace ArangoDBNetStandard.GraphApi.Models
2+
{
3+
/// <summary>
4+
/// Options to create a satellite graph.
5+
/// </summary>
6+
public class PostSatelliteGraphOptions : PostGraphOptions
7+
{
8+
/// <summary>
9+
/// Always set to "satellite" to create
10+
/// a SatelliteGraph (Enterprise Edition only).
11+
/// </summary>
12+
public string ReplicationFactor { get; } = "satellite";
13+
}
14+
}

0 commit comments

Comments
 (0)