Skip to content

Commit

Permalink
Minor tweaks and docs updates
Browse files Browse the repository at this point in the history
  • Loading branch information
kzu committed Jun 13, 2024
1 parent f4131d6 commit f7fa4d3
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/CloudActors.CodeAnaysis/SiloBuilderGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ public class SiloBuilderGenerator : IIncrementalGenerator

public void Initialize(IncrementalGeneratorInitializationContext context)
{
var source = context.CompilationProvider.SelectMany((x, _) => x.Assembly.GetAllTypes().OfType<INamedTypeSymbol>())
var source = context.CompilationProvider
.SelectMany((x, _) => x.Assembly.GetAllTypes().OfType<INamedTypeSymbol>())
.Where(x => x.GetAttributes().Any(IsActor))
.Collect();

Expand Down
3 changes: 2 additions & 1 deletion src/CloudActors.Orleans/CloudActorsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ public static partial class CloudActorsExtensions
/// It's not necessary to invoke this method if you already invoked <c>AddCloudActors</c>
/// on the <see cref="ISiloBuilder"/> when configuring Orleans.
/// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
public static IServiceCollection AddCloudActors(this IServiceCollection services)
{
services.TryAddSingleton<IActorBus>(sp => new OrleansActorBus(sp.GetRequiredService<IGrainFactory>()));

// Attempt to replace the OOB persistence so we don't require a parameterless constructor and always
// have actors initialized with a specific id from the grain.
if (services.FirstOrDefault(d => d.ServiceType == typeof(IActorStateFactory)) is null &&
Expand Down
3 changes: 2 additions & 1 deletion src/CloudActors.Streamstone/CloudActors.Streamstone.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<PackageId>Devlooped.CloudActors.Streamstone</PackageId>
<AssemblyName>Devlooped.CloudActors.Streamstone</AssemblyName>
<TargetFramework>net8.0</TargetFramework>
<PackageId>Devlooped.CloudActors.Streamstone</PackageId>
<Description>Cloud Native Actors: Streamstone storage for Azure Tables</Description>
<PackageTags>dotnet orleans actor azure table</PackageTags>
</PropertyGroup>
Expand Down
15 changes: 15 additions & 0 deletions src/CloudActors.Streamstone/StreamstoneSiloBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,33 @@

namespace Orleans.Hosting;

/// <summary>
/// Extensions for configuring Steamstone actor storage.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public static class StreamstoneSiloBuilderExtensions
{
/// <summary>
/// Adds Streamstone actor storage as the default storage provider.
/// </summary>
public static ISiloBuilder AddStreamstoneActorStorage(this ISiloBuilder builder)
=> builder.AddStreamstoneActorStorage(ProviderConstants.DEFAULT_STORAGE_PROVIDER_NAME);

/// <summary>
/// Adds a named Streamstone actor storage provider.
/// </summary>
public static ISiloBuilder AddStreamstoneActorStorage(this ISiloBuilder builder, string name)
=> builder.ConfigureServices(services => services.AddStreamstoneActorStorage(name, null));

/// <summary>
/// Adds a named Streamstone actor storage provider and provides a configuration action.
/// </summary>
public static ISiloBuilder AddStreamstoneActorStorage(this ISiloBuilder builder, string name, Action<StreamstoneOptions> configure)
=> builder.ConfigureServices(services => services.AddStreamstoneActorStorage(name, configure));

/// <summary>
/// Adds a default Streamstone actor storage provider and provides a configuration action.
/// </summary>
public static ISiloBuilder AddStreamstoneActorStorage(this ISiloBuilder builder, Action<StreamstoneOptions> configure)
=> builder.ConfigureServices(services => services.AddStreamstoneActorStorage(ProviderConstants.DEFAULT_STORAGE_PROVIDER_NAME, configure));

Expand Down

0 comments on commit f7fa4d3

Please sign in to comment.