Skip to content

Commit

Permalink
Aspire: rename AddFoundationDb helpers to match new convention
Browse files Browse the repository at this point in the history
- AddFoundationDbContainer: to start a local cluster hosted inside Docker
- AddFoundationDb: to use an existing cluster (hosted outside of Aspire)
  • Loading branch information
KrzysFR committed Dec 18, 2023
1 parent 5e0ceb2 commit aafb747
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions Aspire.FoundationDB.Hosting/FdbAspireHostingExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public static class FdbAspireHostingExtensions
/// <param name="root">Base subspace location used by the application, in the cluster keyspace.</param>
/// <param name="clusterFile">Path to the cluster file, or <c>null</c> if the default cluster file should be used.</param>
/// <param name="clusterVersion">If not <c>null</c>, the known version of the remote cluster, which can be used to infer the appropriate version of the local FDB client library that should be used to connect to this cluster.</param>
public static IResourceBuilder<FdbConnectionResource> AddFoundationDbConnection(this IDistributedApplicationBuilder builder, string name, int apiVersion, string root, string? clusterFile = null, string? clusterVersion = null)
public static IResourceBuilder<FdbConnectionResource> AddFoundationDb(this IDistributedApplicationBuilder builder, string name, int apiVersion, string root, string? clusterFile = null, string? clusterVersion = null)
{
return AddFoundationDbConnection(builder, name, apiVersion, FdbPath.Parse(root), clusterFile, clusterVersion);
return AddFoundationDb(builder, name, apiVersion, FdbPath.Parse(root), clusterFile, clusterVersion);
}

/// <summary>Add a connection to an external FoundationDB cluster</summary>
Expand All @@ -45,7 +45,7 @@ public static IResourceBuilder<FdbConnectionResource> AddFoundationDbConnection(
/// <param name="root">Root subspace location used by the application, in the cluster keyspace.</param>
/// <param name="clusterFile">Path to the cluster file, or <c>null</c> if the default cluster file should be used.</param>
/// <param name="clusterVersion">If not <c>null</c>, the known version of the remote cluster, which can be used to infer the appropriate version of the local FDB client library that should be used to connect to this cluster.</param>
public static IResourceBuilder<FdbConnectionResource> AddFoundationDbConnection(this IDistributedApplicationBuilder builder, string name, int apiVersion, FdbPath root, string? clusterFile = null, string? clusterVersion = null)
public static IResourceBuilder<FdbConnectionResource> AddFoundationDb(this IDistributedApplicationBuilder builder, string name, int apiVersion, FdbPath root, string? clusterFile = null, string? clusterVersion = null)
{
Contract.NotNull(builder);
Contract.NotNullOrWhiteSpace(name);
Expand Down Expand Up @@ -144,9 +144,9 @@ public static IResourceBuilder<FdbConnectionResource> WithClusterVersion(this IR
/// <param name="root">Root subspace location used by the application, in the cluster keyspace.</param>
/// <param name="clusterVersion">If not <c>null</c>, specifies the targeted version for the cluster nodes (ex: "7.2.5", "7.3.27", "7.2.*", "7.*", ..)</param>
/// <param name="rollForward">Specifies the policy used to optionally select a more recent version</param>
public static IResourceBuilder<FdbClusterResource> AddFoundationDbCluster(this IDistributedApplicationBuilder builder, string name, int apiVersion, string root, string? clusterVersion = null, FdbVersionPolicy? rollForward = null)
public static IResourceBuilder<FdbClusterResource> AddFoundationDbContainer(this IDistributedApplicationBuilder builder, string name, int apiVersion, string root, string? clusterVersion = null, FdbVersionPolicy? rollForward = null)
{
return AddFoundationDbCluster(builder, name, apiVersion, FdbPath.Parse(root), clusterVersion, rollForward);
return AddFoundationDbContainer(builder, name, apiVersion, FdbPath.Parse(root), clusterVersion, rollForward);
}

/// <summary>Add a local FoundationDB cluster to the application</summary>
Expand All @@ -156,7 +156,7 @@ public static IResourceBuilder<FdbClusterResource> AddFoundationDbCluster(this I
/// <param name="root">Root subspace location used by the application, in the cluster keyspace.</param>
/// <param name="clusterVersion">If not <c>null</c>, specifies the targeted version for the cluster nodes (ex: "7.2.5", "7.3.27", "7.2.*", "7.*", ..)</param>
/// <param name="rollForward">Specifies the policy used to optionally select a more recent version</param>
public static IResourceBuilder<FdbClusterResource> AddFoundationDbCluster(this IDistributedApplicationBuilder builder, string name, int apiVersion, FdbPath root, string? clusterVersion = null, FdbVersionPolicy? rollForward = null)
public static IResourceBuilder<FdbClusterResource> AddFoundationDbContainer(this IDistributedApplicationBuilder builder, string name, int apiVersion, FdbPath root, string? clusterVersion = null, FdbVersionPolicy? rollForward = null)
{
Contract.NotNull(builder);
Contract.NotNullOrWhiteSpace(name);
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ private static void Main(string[] args)

// Define a locally hosted FoundationDB cluster
var fdb = builder
.AddFoundationDbCluster("fdb", apiVersion: 720, root: "/Sandbox/MySuperApp", clusterVersion: "7.2.5", rollForward: FdbVersionPolicy.Exact);
.AddFoundationDbContainer("fdb", apiVersion: 720, root: "/Sandbox/MySuperApp", clusterVersion: "7.2.5", rollForward: FdbVersionPolicy.Exact);

// Project that needs a reference to this cluster
var backend = builder
Expand All @@ -175,7 +175,7 @@ private static void Main(string[] args)

// Define an external FoundationDB cluster connection
var fdb = builder
.AddFoundationDbConnection("fdb", apiVersion: 720, root: "/Sandbox/MySuperApp", clusterFile: "/SOME/PATH/TO/testing.cluster") ;
.AddFoundationDb("fdb", apiVersion: 720, root: "/Sandbox/MySuperApp", clusterFile: "/SOME/PATH/TO/testing.cluster") ;

// Project that needs a reference to this cluster
var backend = builder
Expand All @@ -197,7 +197,7 @@ builder.AddServiceDefaults();
//...
// hookup the FoundationDB component
builder.AddFoundationDb("fdb"); // "fdb" is the same name we used in AddFoundationDbCluster(...) in the AppHost above.
builder.AddFoundationDb("fdb"); // "fdb" is the same name we used in AddFoundationDb(...) or AddFoundationDbCLuster(...) in the AppHost above.
// ...rest of the startup logic....
```
Expand Down

0 comments on commit aafb747

Please sign in to comment.