-
-
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
13 changed files
with
103 additions
and
57 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
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
namespace EvenireDB | ||
{ | ||
internal record ExtentInfoProviderConfig(string BasePath); | ||
} |
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,8 @@ | ||
namespace EvenireDB.Extents | ||
{ | ||
public readonly struct ExtentInfo | ||
{ | ||
public readonly required string DataPath { get; init; } | ||
public readonly required string HeadersPath { get; init; } | ||
} | ||
} |
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,26 @@ | ||
namespace EvenireDB.Extents | ||
{ | ||
internal class ExtentInfoProvider : IExtentInfoProvider | ||
{ | ||
private readonly ExtentInfoProviderConfig _config; | ||
|
||
public ExtentInfoProvider(ExtentInfoProviderConfig config) | ||
{ | ||
_config = config ?? throw new ArgumentNullException(nameof(config)); | ||
if (!Directory.Exists(_config.BasePath)) | ||
Directory.CreateDirectory(config.BasePath); | ||
} | ||
|
||
public ExtentInfo GetLatest(Guid streamId) | ||
{ | ||
// TODO: tests | ||
var key = streamId.ToString("N"); | ||
int extentNumber = 0; // TODO: calculate | ||
return new ExtentInfo | ||
{ | ||
DataPath = Path.Combine(_config.BasePath, $"{key}_{extentNumber}_data.dat"), | ||
HeadersPath = Path.Combine(_config.BasePath, $"{key}_{extentNumber}_headers.dat"), | ||
}; | ||
} | ||
} | ||
} |
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,7 @@ | ||
namespace EvenireDB.Extents | ||
{ | ||
public interface IExtentInfoProvider | ||
{ | ||
ExtentInfo GetLatest(Guid streamId); | ||
} | ||
} |
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,5 +1,5 @@ | ||
|
||
namespace EvenireDB | ||
{ | ||
public record FileEventsRepositoryConfig(string BasePath, uint MaxPageSize = 100); | ||
public record FileEventsRepositoryConfig(uint MaxPageSize = 100); | ||
} |
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