Skip to content

Commit

Permalink
Merge pull request #38 from EventStore/timothycoleman/plugablecomponents
Browse files Browse the repository at this point in the history
Unify Telemetry Collection and DI usage into one interface: IPlugableComponent
  • Loading branch information
timothycoleman authored Apr 18, 2024
2 parents 09513df + 0d8aa7b commit 5fec51d
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Microsoft.AspNetCore.Routing;

namespace EventStore.Plugins.Authentication {
public interface IAuthenticationProvider {
public interface IAuthenticationProvider : IPlugableComponent {
/// <summary>
/// Initialize the AuthenticationProvider. Event Store will wait until this task completes before becoming ready.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace EventStore.Plugins.Authentication;

public interface IHttpAuthenticationProvider : IConfigureServices {
public interface IHttpAuthenticationProvider {
/// <summary>
/// Return a unique name used to externally identify the authentication provider.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Threading.Tasks;

namespace EventStore.Plugins.Authorization {
public interface IAuthorizationProvider : IConfigureServices {
public interface IAuthorizationProvider : IPlugableComponent {
/// <summary>
/// Check whether the provided <see cref="ClaimsPrincipal" /> has the rights to perform the <see cref="Operation" />
/// </summary>
Expand Down
10 changes: 0 additions & 10 deletions src/EventStore.Plugins/IConfigureServices.cs

This file was deleted.

15 changes: 15 additions & 0 deletions src/EventStore.Plugins/IPlugableComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Text.Json.Nodes;
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace EventStore.Plugins;

// Component that can be plugged in to the main server.
// Plugins are libraries that result in IPlugableComponents being produced and plugged in.
public interface IPlugableComponent {
IApplicationBuilder Configure(IApplicationBuilder builder) => builder;
IServiceCollection ConfigureServices(IServiceCollection services, IConfiguration configuration) => services;
void CollectTelemetry(Action<string, JsonNode> reply) { }
}
8 changes: 1 addition & 7 deletions src/EventStore.Plugins/MD5/IMD5Plugin.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
using System;
using System.Text.Json.Nodes;

namespace EventStore.Plugins.MD5;
namespace EventStore.Plugins.MD5;

public interface IMD5Plugin {
string Name { get; }
string Version { get; }

string CommandLineName { get; }

void CollectTelemetry(Action<string, JsonNode> reply);

/// <summary>
/// Creates an MD5 provider factory for the MD5 plugin
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/EventStore.Plugins/MD5/IMD5Provider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace EventStore.Plugins.MD5;

public interface IMD5Provider : IConfigureServices {
public interface IMD5Provider : IPlugableComponent {
/// <summary>
/// Creates an instance of the MD5 hash algorithm implementation
/// </summary>
Expand Down
10 changes: 2 additions & 8 deletions src/EventStore.Plugins/Subsystems/ISubsystem.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
using System;
using System.Text.Json.Nodes;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System.Threading.Tasks;

namespace EventStore.Plugins.Subsystems;

public interface ISubsystem : IConfigureServices {
public interface ISubsystem : IPlugableComponent {
string Name { get; }
void CollectTelemetry(Action<string, JsonNode> reply);
Task Start();
Task Stop();
}

0 comments on commit 5fec51d

Please sign in to comment.