generated from Nexus-Mods/NexusMods.App.Template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from Nexus-Mods/set-store
Rework once again of the datom store, taking hints from DataHike and leveraging RocksDB even more
- Loading branch information
Showing
130 changed files
with
2,464 additions
and
1,870 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
52 changes: 52 additions & 0 deletions
52
benchmarks/NexusMods.EventSourcing.Benchmarks/Benchmarks/ABenchmark.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
using NexusMods.EventSourcing.Abstractions; | ||
using NexusMods.EventSourcing.Storage; | ||
using NexusMods.EventSourcing.Storage.Abstractions; | ||
using NexusMods.EventSourcing.Storage.InMemoryBackend; | ||
using NexusMods.EventSourcing.TestModel; | ||
using NexusMods.Paths; | ||
using Xunit; | ||
|
||
namespace NexusMods.EventSourcing.Benchmarks.Benchmarks; | ||
|
||
public class ABenchmark : IAsyncLifetime | ||
{ | ||
private IHost _host = null!; | ||
protected IConnection Connection = null!; | ||
|
||
public IServiceProvider Services => _host.Services; | ||
|
||
public async Task InitializeAsync() | ||
{ | ||
var builder = Host.CreateDefaultBuilder() | ||
.ConfigureServices(services => | ||
{ | ||
services.AddEventSourcingStorage() | ||
.AddRocksDbBackend() | ||
.AddEventSourcing() | ||
.AddTestModel() | ||
.AddDatomStoreSettings(new DatomStoreSettings | ||
{ | ||
Path = FileSystem.Shared.FromUnsanitizedFullPath("benchmarks" + Guid.NewGuid()) | ||
}); | ||
}); | ||
|
||
_host = builder.Build(); | ||
Connection = await NexusMods.EventSourcing.Connection.Start(Services); | ||
} | ||
|
||
public async Task DisposeAsync() | ||
{ | ||
var path = Services.GetRequiredService<DatomStoreSettings>().Path; | ||
await _host.StopAsync(); | ||
_host.Dispose(); | ||
|
||
if (path.DirectoryExists()) | ||
path.DeleteDirectory(); | ||
if (path.FileExists) | ||
path.Delete(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.