Skip to content

Commit

Permalink
Start on the FasterKV store
Browse files Browse the repository at this point in the history
  • Loading branch information
halgari committed Dec 13, 2023
1 parent 77d8ca1 commit a6738aa
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 0 deletions.
7 changes: 7 additions & 0 deletions NexusMods.EventSourcing.sln
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmarks", "benchmarks",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NexusMods.EventSourcing.Benchmarks", "benchmarks\NexusMods.EventSourcing.Benchmarks\NexusMods.EventSourcing.Benchmarks.csproj", "{96977D99-BF4B-4952-B594-6E44CCD826B9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NexusMods.EventSourcing.FasterKV", "src\NexusMods.EventSourcing.FasterKV\NexusMods.EventSourcing.FasterKV.csproj", "{AFB69777-0A6A-4C61-A621-32C894673002}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -47,6 +49,7 @@ Global
{6737673E-5898-42EC-B0B2-60DE2CFFF0AF} = {0377EBE6-F147-4233-86AD-32C821B9567E}
{66DCB10E-1D80-4A83-8380-B2E08BEEE7AE} = {6ED01F9D-5E12-4EB2-9601-64A2ADC719DE}
{96977D99-BF4B-4952-B594-6E44CCD826B9} = {72AFE85F-8C12-436A-894E-638ED2C92A76}
{AFB69777-0A6A-4C61-A621-32C894673002} = {0377EBE6-F147-4233-86AD-32C821B9567E}
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A92DED3D-BC67-4E04-9A06-9A1B302B3070}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
Expand All @@ -69,5 +72,9 @@ Global
{96977D99-BF4B-4952-B594-6E44CCD826B9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{96977D99-BF4B-4952-B594-6E44CCD826B9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{96977D99-BF4B-4952-B594-6E44CCD826B9}.Release|Any CPU.Build.0 = Release|Any CPU
{AFB69777-0A6A-4C61-A621-32C894673002}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AFB69777-0A6A-4C61-A621-32C894673002}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AFB69777-0A6A-4C61-A621-32C894673002}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AFB69777-0A6A-4C61-A621-32C894673002}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
29 changes: 29 additions & 0 deletions src/NexusMods.EventSourcing.FasterKV/FasterKVEventStore.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System.Threading.Tasks;
using FASTER.core;
using NexusMods.EventSourcing.Abstractions;

namespace NexusMods.EventSourcing.FasterKV;

public class FasterKVEventStore<TSerializer> : IEventStore
where TSerializer : IEventSerializer
{
private readonly FasterKVSettings<SpanByteAndMemory, SpanByteAndMemory> _settings;
private readonly FasterKV<SpanByteAndMemory,SpanByteAndMemory> _kvStore;


public FasterKVEventStore(TSerializer serializer, Settings settings)
{
_settings = new FasterKVSettings<SpanByteAndMemory, SpanByteAndMemory>(settings.StorageLocation.ToString());
_kvStore = new FasterKV<SpanByteAndMemory, SpanByteAndMemory>(_settings);
}

public ValueTask Add<T>(T eventEntity) where T : IEvent
{
throw new System.NotImplementedException();
}

public void EventsForEntity<TIngester>(EntityId entityId, TIngester ingester) where TIngester : IEventIngester
{
throw new System.NotImplementedException();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\NexusMods.EventSourcing.Abstractions\NexusMods.EventSourcing.Abstractions.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.FASTER.Core" Version="2.6.1" />
<PackageReference Include="NexusMods.Paths" Version="0.4.0" />
</ItemGroup>

<Import Project="$([MSBuild]::GetPathOfFileAbove('NuGet.Build.props', '$(MSBuildThisFileDirectory)../'))" />
</Project>
8 changes: 8 additions & 0 deletions src/NexusMods.EventSourcing.FasterKV/Settings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using NexusMods.Paths;

namespace NexusMods.EventSourcing.FasterKV;

public class Settings
{
public AbsolutePath StorageLocation { get; set; } = default!;
}

0 comments on commit a6738aa

Please sign in to comment.