Ocelot/src/Ocelot.Provider.Rafty/OcelotAdministrationBuilderExtensions.cs
Tom Pallister 11a2d13f18
Feat/monorepo (#734)
* copied everything from repos back to ocelot repo

* added src projects to sln

* removed all test projects that have no tests

* added all test projects to sln

* removed test not on master

* merged unit tests

* merged acceptance tests

* merged integration tests

* fixed namepaces

* build script creates packages for all projects

* updated docs to make sure no references to external repos that we will remove

* +semver: breaking
2019-01-07 19:52:53 +00:00

29 lines
1.2 KiB
C#

namespace Ocelot.Provider.Rafty
{
using Configuration.Setter;
using DependencyInjection;
using global::Rafty.Concensus.Node;
using global::Rafty.FiniteStateMachine;
using global::Rafty.Infrastructure;
using global::Rafty.Log;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
public static class OcelotAdministrationBuilderExtensions
{
public static IOcelotAdministrationBuilder AddRafty(this IOcelotAdministrationBuilder builder)
{
var settings = new InMemorySettings(4000, 6000, 100, 10000);
builder.Services.RemoveAll<IFileConfigurationSetter>();
builder.Services.AddSingleton<IFileConfigurationSetter, RaftyFileConfigurationSetter>();
builder.Services.AddSingleton<ILog, SqlLiteLog>();
builder.Services.AddSingleton<IFiniteStateMachine, OcelotFiniteStateMachine>();
builder.Services.AddSingleton<ISettings>(settings);
builder.Services.AddSingleton<IPeersProvider, FilePeersProvider>();
builder.Services.AddSingleton<INode, Node>();
builder.Services.Configure<FilePeers>(builder.ConfigurationRoot);
return builder;
}
}
}