-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
427 additions
and
244 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,8 +1,3 @@ | ||
namespace EvenireDB; | ||
|
||
public readonly struct ExtentInfo | ||
{ | ||
public readonly required Guid StreamId { get; init; } | ||
public readonly required string DataPath { get; init; } | ||
public readonly required string HeadersPath { get; init; } | ||
} | ||
public record ExtentInfo(Guid StreamId, string DataPath, string HeadersPath); |
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.
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,12 @@ | ||
using EvenireDB.Common; | ||
|
||
namespace EvenireDB; | ||
|
||
public interface IEventsReader | ||
{ | ||
IAsyncEnumerable<Event> ReadAsync( | ||
Guid streamId, | ||
StreamPosition startPosition, | ||
Direction direction = Direction.Forward, | ||
CancellationToken cancellationToken = default); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,66 @@ | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace EvenireDB | ||
namespace EvenireDB; | ||
|
||
public static partial class LogMessages | ||
{ | ||
public static partial class LogMessages | ||
public enum EventIds | ||
{ | ||
public enum EventIds | ||
{ | ||
ReadingStreamFromRepository = 0, | ||
HighMemoryUsageDetected, | ||
MemoryUsageBelowTreshold, | ||
EventsGroupPersistenceError, | ||
AppendingEventsToStream | ||
} | ||
|
||
[LoggerMessage( | ||
EventId = (int)EventIds.ReadingStreamFromRepository, | ||
Level = LogLevel.Warning, | ||
Message = "Reading stream '{StreamId}' from repository")] | ||
public static partial void ReadingStreamFromRepository(this ILogger logger, Guid streamId); | ||
|
||
[LoggerMessage( | ||
EventId = (int)EventIds.AppendingEventsToStream, | ||
Level = LogLevel.Debug, | ||
Message = "Appending {EventsCount} events to stream '{StreamId}'...")] | ||
public static partial void AppendingEventsToStream(this ILogger logger, int eventsCount, Guid streamId); | ||
|
||
[LoggerMessage( | ||
EventId = (int)EventIds.HighMemoryUsageDetected, | ||
Level = LogLevel.Warning, | ||
Message = "Memory usage is {MemoryUsage} bytes, more than the allowed value: {MaxAllowedAllocatedBytes}. Dropping some cached streams.")] | ||
public static partial void HighMemoryUsageDetected(this ILogger logger, long memoryUsage, long maxAllowedAllocatedBytes); | ||
|
||
[LoggerMessage( | ||
EventId = (int)EventIds.MemoryUsageBelowTreshold, | ||
Level = LogLevel.Debug, | ||
Message = "Memory usage is {MemoryUsage} / {MaxAllowedAllocatedBytes} bytes")] | ||
public static partial void MemoryUsageBelowTreshold(this ILogger logger, long memoryUsage, long maxAllowedAllocatedBytes); | ||
|
||
[LoggerMessage( | ||
EventId = (int)EventIds.EventsGroupPersistenceError, | ||
Level = LogLevel.Error, | ||
Message = "an error has occurred while persisting events group for stream {StreamId}: {Error}")] | ||
public static partial void EventsGroupPersistenceError(this ILogger logger, Guid streamId, string error); | ||
} | ||
} | ||
ReadingStreamFromRepository = 0, | ||
HighMemoryUsageDetected, | ||
MemoryUsageBelowTreshold, | ||
EventsGroupPersistenceError, | ||
AppendingEventsToStream, | ||
StreamDeletionAttempt, | ||
StreamDeleted, | ||
StreamDeletionFailed | ||
} | ||
|
||
[LoggerMessage( | ||
EventId = (int)EventIds.ReadingStreamFromRepository, | ||
Level = LogLevel.Warning, | ||
Message = "Reading stream '{StreamId}' from repository")] | ||
public static partial void ReadingStreamFromRepository(this ILogger logger, Guid streamId); | ||
|
||
[LoggerMessage( | ||
EventId = (int)EventIds.AppendingEventsToStream, | ||
Level = LogLevel.Debug, | ||
Message = "Appending {EventsCount} events to stream '{StreamId}'...")] | ||
public static partial void AppendingEventsToStream(this ILogger logger, int eventsCount, Guid streamId); | ||
|
||
[LoggerMessage( | ||
EventId = (int)EventIds.HighMemoryUsageDetected, | ||
Level = LogLevel.Warning, | ||
Message = "Memory usage is {MemoryUsage} bytes, more than the allowed value: {MaxAllowedAllocatedBytes}. Dropping some cached streams.")] | ||
public static partial void HighMemoryUsageDetected(this ILogger logger, long memoryUsage, long maxAllowedAllocatedBytes); | ||
|
||
[LoggerMessage( | ||
EventId = (int)EventIds.MemoryUsageBelowTreshold, | ||
Level = LogLevel.Debug, | ||
Message = "Memory usage is {MemoryUsage} / {MaxAllowedAllocatedBytes} bytes")] | ||
public static partial void MemoryUsageBelowTreshold(this ILogger logger, long memoryUsage, long maxAllowedAllocatedBytes); | ||
|
||
[LoggerMessage( | ||
EventId = (int)EventIds.EventsGroupPersistenceError, | ||
Level = LogLevel.Error, | ||
Message = "an error has occurred while persisting events group for stream {StreamId}: {Error}")] | ||
public static partial void EventsGroupPersistenceError(this ILogger logger, Guid streamId, string error); | ||
|
||
[LoggerMessage( | ||
EventId = (int)EventIds.StreamDeletionAttempt, | ||
Level = LogLevel.Information, | ||
Message = "Trying to delete stream '{StreamId}', attempt #{Attempt} ...")] | ||
public static partial void StreamDeletionAttempt(this ILogger logger, Guid streamId, int attempt); | ||
|
||
[LoggerMessage( | ||
EventId = (int)EventIds.StreamDeleted, | ||
Level = LogLevel.Information, | ||
Message = "Stream '{StreamId}' deleted.")] | ||
public static partial void StreamDeleted(this ILogger logger, Guid streamId); | ||
|
||
[LoggerMessage( | ||
EventId = (int)EventIds.StreamDeletionFailed, | ||
Level = LogLevel.Critical, | ||
Message = "Stream '{StreamId}' deletion failed: {Error}")] | ||
public static partial void StreamDeletionFailed(this ILogger logger, Guid streamId, string error); | ||
} |
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
namespace EvenireDB; | ||
|
||
public readonly record struct StreamInfo( | ||
Guid StreamId, | ||
long EventsCount, | ||
public record StreamInfo( | ||
Guid StreamId, | ||
long EventsCount, | ||
bool IsCached, | ||
DateTimeOffset CreatedAt, | ||
DateTimeOffset LastAccessedAt); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
global using Xunit; | ||
global using FluentAssertions; | ||
global using NSubstitute; | ||
global using EvenireDB.Utils; | ||
global using EvenireDB.Utils; | ||
global using Microsoft.Extensions.Logging; |
Oops, something went wrong.