LockFree.EventStore
1.0.0
dotnet add package LockFree.EventStore --version 1.0.0
NuGet\Install-Package LockFree.EventStore -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LockFree.EventStore" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LockFree.EventStore" Version="1.0.0" />
<PackageReference Include="LockFree.EventStore" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LockFree.EventStore --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: LockFree.EventStore, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LockFree.EventStore@1.0.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LockFree.EventStore&version=1.0.0
#tool nuget:?package=LockFree.EventStore&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
LockFree.EventStore
Event store em memória, genérico, de baixa latência e lock-free para .NET. Ideal para cenários de monitoramento, métricas e eventos de domínio.
Principais Recursos
- Escrita MPMC lock-free com descarte FIFO
- Particionamento por chave para alta concorrência
- Snapshots consistentes sem bloquear produtores
- Agregações funcionais e consultas por janela temporal
- Zero dependências externas, pronto para AOT/Trimming
- API fluente para configuração avançada
- Métricas e observabilidade integradas
- Agregações especializadas (Sum, Average, Min, Max)
Exemplo de Uso Básico
var store = new EventStore<Order>();
store.TryAppend(new Order { Id = 1, Amount = 10m, Timestamp = DateTime.UtcNow });
var total = store.Aggregate(() => 0m, (acc, e) => acc + e.Amount,
from: DateTime.UtcNow.AddMinutes(-10));
Construtores Disponíveis
// Construtor padrão
var store = new EventStore<Order>();
// Capacidade explícita
var store = new EventStore<Order>(capacity: 100_000);
// Capacidade e partições
var store = new EventStore<Order>(capacity: 50_000, partitions: 8);
// Configuração avançada
var store = new EventStore<Order>(new EventStoreOptions<Order>
{
Capacity = 100_000,
Partitions = 16,
OnEventDiscarded = evt => Logger.LogTrace("Event discarded: {Event}", evt),
OnCapacityReached = () => Metrics.IncrementCounter("eventstore.capacity_reached"),
TimestampSelector = new OrderTimestampSelector()
});
// API fluente
var store = EventStore.For<Order>()
.WithCapacity(100_000)
.WithPartitions(8)
.OnDiscarded(evt => Log(evt))
.OnCapacityReached(() => NotifyAdmin())
.WithTimestampSelector(new OrderTimestampSelector())
.Create();
API Completa
TryAppend(event)
— Adiciona evento, lock-freeAggregate
— Agrega valores por janela temporal com filtros opcionaisSnapshot()
— Retorna cópia imutável dos eventos com filtros opcionaisCountEvents/Sum/Average/Min/Max
— Agregações especializadasClear/Reset/Purge
— Métodos de limpeza e manutençãoQuery
— Consultas flexíveis com filtros e janelas temporaisStatistics
— Métricas para monitoramento e observabilidadeCount/Capacity/IsEmpty/IsFull/Partitions
— Propriedades de estado
Performance
Projetado para alta concorrência e baixa latência. A ordem global entre partições é aproximada.
Limitações
- Ordem global apenas aproximada entre partições
- Capacidade fixa; eventos antigos são descartados ao exceder
Licença
MIT
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.