Skip to content

Commit

Permalink
Merge pull request #20 from EventStore/subsystems
Browse files Browse the repository at this point in the history
Add ISubsystemsPlugin as a way to plugably create subsystems
  • Loading branch information
timothycoleman authored Oct 5, 2023
2 parents b791b81 + 31bc5b5 commit 1a34d9c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/EventStore.Plugins/Subsystems/ISubsystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;

namespace EventStore.Plugins.Subsystems;

public interface ISubsystem {
IApplicationBuilder Configure(IApplicationBuilder builder);
IServiceCollection ConfigureServices(IServiceCollection services);
IEnumerable<Task> Start();
void Stop();
}
5 changes: 5 additions & 0 deletions src/EventStore.Plugins/Subsystems/ISubsystemFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace EventStore.Plugins.Subsystems;

public interface ISubsystemFactory<TArg> {
ISubsystem Create(TArg arg);
}
12 changes: 12 additions & 0 deletions src/EventStore.Plugins/Subsystems/ISubsystemsPlugin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Collections.Generic;

namespace EventStore.Plugins.Subsystems;

// A plugin that can create multiple subsystems.
// A TArg is required to produce each subsystem from its respective factory.
public interface ISubsystemsPlugin<TArg> {
string Name { get; }
string Version { get; }
string CommandLineName { get; }
IEnumerable<ISubsystemFactory<TArg>> GetSubsystemFactories(string configPath);
}

0 comments on commit 1a34d9c

Please sign in to comment.