Skip to content
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

Added support for satellite graphs in graph API #405

Merged
merged 3 commits into from
Jan 23, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion arangodb-net-standard/GraphApi/GraphApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public GraphApiClient(IApiClientTransport transport, IApiClientSerialization ser
/// <remarks>
/// The creation of a graph requires the name of the graph and a definition of its edges.
/// </remarks>
/// <param name="postGraphBody">The information of the graph to create.</param>
/// <param name="postGraphBody">The information of the graph to create. Must be an instance of <see cref="PostSatelliteGraphOptions"/> or <see cref="PostNonSatelliteGraphOptions"/>.</param>
/// <param name="query">Optional query parameters of the request.</param>
/// <returns></returns>
public virtual async Task<PostGraphResponse> PostGraphAsync(
Expand Down
13 changes: 12 additions & 1 deletion arangodb-net-standard/GraphApi/Models/PostGraphBody.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,20 @@ public class PostGraphBody
/// </remarks>
public bool? IsSmart { get; set; }

/// <summary>
/// (Optional) Whether to create a Disjoint SmartGraph instead
/// of a regular SmartGraph (Enterprise Edition only).
/// </summary>
/// <remarks>
/// (cluster only)
/// </remarks>
public bool? IsDisjoint { get; set; }

/// <summary>
/// (Optional) Defines options for creating collections within this graph.
/// Must be an instance of <see cref="PostSatelliteGraphOptions"/> or
/// <see cref="PostNonSatelliteGraphOptions"/>
/// </summary>
public PostGraphOptions Options { get; set; }
}
}
}
29 changes: 23 additions & 6 deletions arangodb-net-standard/GraphApi/Models/PostGraphOptions.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
namespace ArangoDBNetStandard.GraphApi.Models
using System.Collections.Generic;

namespace ArangoDBNetStandard.GraphApi.Models
{
/// <summary>
/// Defines options for creating collections within a graph.
/// </summary>
public class PostGraphOptions
public abstract class PostGraphOptions
{
/// <summary>
/// The attribute name that is used to smartly shard the vertices of a graph.
Expand All @@ -17,6 +19,15 @@ public class PostGraphOptions
/// </remarks>
public string SmartGraphAttribute { get; set; }

/// <summary>
/// (Optional) An array of collection names that will be used
/// to create SatelliteCollections for a
/// Hybrid (Disjoint) SmartGraph (Enterprise Edition only).
/// Each array element must be a string and a valid collection name.
/// The collection type cannot be modified later.
/// </summary>
public IEnumerable<string> Satellites { get; set; }

/// <summary>
/// The number of shards that is used for every collection within this graph.
/// Cannot be modified later.
Expand All @@ -27,12 +38,18 @@ public class PostGraphOptions
public int NumberOfShards { get; set; }

/// <summary>
/// The replication factor used when initially creating collections for this graph
/// (Enterprise Edition only).
/// Write concern for new collections in the graph.
/// It determines how many copies of each shard are
/// required to be in sync on the different DB-Servers.
/// If there are less then these many copies in the cluster
/// a shard will refuse to write. Writes to shards with
/// enough up-to-date copies will succeed at the same time however.
/// The value of writeConcern can not be larger than
/// <see cref="PostNonSatelliteGraphOptions.ReplicationFactor"/>.
/// </summary>
/// <remarks>
/// (cluster only)
/// </remarks>
public int ReplicationFactor { get; set; }
public int? WriteConcern { get; set; }
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace ArangoDBNetStandard.GraphApi.Models
{
/// <summary>
/// Options to create a non-satellite graph.
/// </summary>
public class PostNonSatelliteGraphOptions : PostGraphOptions
{
/// <summary>
/// The replication factor used when initially creating collections for this graph
/// (Enterprise Edition only).
/// </summary>
/// <remarks>
/// (cluster only)
/// </remarks>
public int ReplicationFactor { get; set; }
}
}
15 changes: 15 additions & 0 deletions arangodb-net-standard/GraphApi/Models/PostSatelliteGraphOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace ArangoDBNetStandard.GraphApi.Models
{
/// <summary>
/// Options to create a satellite graph.
/// </summary>
public class PostSatelliteGraphOptions : PostGraphOptions
{
/// <summary>
/// Set to "satellite" to create a SatelliteGraph,
/// which will ignore numberOfShards, minReplicationFactor
/// and writeConcern (Enterprise Edition only).
tjoubert marked this conversation as resolved.
Show resolved Hide resolved
/// </summary>
public string ReplicationFactor { get; set; }
tjoubert marked this conversation as resolved.
Show resolved Hide resolved
}
}