Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit dbfd6bb

Browse files
support deletion tracking
1 parent 3dcbf30 commit dbfd6bb

File tree

3 files changed

+45
-6
lines changed

3 files changed

+45
-6
lines changed

src/SqlStreamStore.Server/SqlStreamStore.Server.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
66
<LangVersion>latest</LangVersion>
77
<CrossGenDuringPublish>false</CrossGenDuringPublish>
8-
<LibraryVersion Condition="$(LibraryVersion) == ''">1.2.0-beta.3.26</LibraryVersion>
8+
<LibraryVersion Condition="$(LibraryVersion) == ''">1.2.0-beta.3.28</LibraryVersion>
9+
<StartupObject></StartupObject>
910
</PropertyGroup>
1011
<ItemGroup>
1112
<PackageReference Include="ILLink.Tasks" Version="0.1.5-preview-1841731" />

src/SqlStreamStore.Server/SqlStreamStoreFactory.cs

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,26 @@ public IStreamStore Create()
4242
}
4343

4444
public InMemoryStreamStore CreateInMemoryStreamStore()
45-
=> new InMemoryStreamStore();
45+
{
46+
if (_configuration.Schema != default)
47+
{
48+
LogNotSupported(mysql, nameof(_configuration.Schema));
49+
}
50+
51+
if (_configuration.DisableDeletionTracking)
52+
{
53+
LogNotSupported(mysql, nameof(_configuration.DisableDeletionTracking));
54+
}
55+
56+
return new InMemoryStreamStore();
57+
}
4658

4759
public MsSqlStreamStoreV3 CreateMsSqlStreamStore()
4860
{
49-
var settings = new MsSqlStreamStoreV3Settings(_configuration.ConnectionString);
61+
var settings = new MsSqlStreamStoreV3Settings(_configuration.ConnectionString)
62+
{
63+
DisableDeletionTracking = _configuration.DisableDeletionTracking
64+
};
5065

5166
if (_configuration.Schema != null)
5267
{
@@ -57,11 +72,24 @@ public MsSqlStreamStoreV3 CreateMsSqlStreamStore()
5772
}
5873

5974
public MySqlStreamStore CreateMySqlStreamStore()
60-
=> new MySqlStreamStore(new MySqlStreamStoreSettings(_configuration.ConnectionString));
75+
{
76+
if (_configuration.Schema != default)
77+
{
78+
LogNotSupported(mysql, nameof(_configuration.Schema));
79+
}
80+
81+
return new MySqlStreamStore(new MySqlStreamStoreSettings(_configuration.ConnectionString)
82+
{
83+
DisableDeletionTracking = _configuration.DisableDeletionTracking
84+
});
85+
}
6186

6287
public PostgresStreamStore CreatePostgresStreamStore()
6388
{
64-
var settings = new PostgresStreamStoreSettings(_configuration.ConnectionString);
89+
var settings = new PostgresStreamStoreSettings(_configuration.ConnectionString)
90+
{
91+
DisableDeletionTracking = _configuration.DisableDeletionTracking
92+
};
6593

6694
if (_configuration.Schema != null)
6795
{
@@ -70,5 +98,11 @@ public PostgresStreamStore CreatePostgresStreamStore()
7098

7199
return new PostgresStreamStore(settings);
72100
}
101+
102+
private static void LogNotSupported(string provider, string configurationKey) =>
103+
s_Log.Warning(
104+
"Configuration key '{configurationKey}' is not supported for provider {provider}. It will be ignored.",
105+
configurationKey,
106+
provider);
73107
}
74108
}

src/SqlStreamStore.Server/SqlStreamStoreServerConfiguration.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ internal class SqlStreamStoreServerConfiguration
3232
public string Schema => _configuration.Schema;
3333
public string Provider => _configuration.Provider.ToLowerInvariant();
3434

35+
public bool DisableDeletionTracking => _configuration.DisableDeletionTracking;
36+
3537
public SqlStreamStoreServerConfiguration(
3638
IDictionary environment,
3739
string[] args)
@@ -120,6 +122,7 @@ private class ConfigurationData
120122
[Sensitive] public string ConnectionString => _configuration.GetValue<string>(nameof(ConnectionString));
121123
public string Schema => _configuration.GetValue<string>(nameof(Schema));
122124
public string Provider => _configuration.GetValue<string>(nameof(Provider));
125+
public bool DisableDeletionTracking => _configuration.GetValue<bool>(nameof(DisableDeletionTracking));
123126

124127
public ConfigurationData(IConfigurationRoot configuration)
125128
{
@@ -172,7 +175,8 @@ public override void Load()
172175
[nameof(Provider)] = "inmemory",
173176
[nameof(LogLevel)] = nameof(LogEventLevel.Information),
174177
[nameof(Schema)] = default,
175-
[nameof(UseCanonicalUris)] = default
178+
[nameof(UseCanonicalUris)] = default,
179+
[nameof(DisableDeletionTracking)] = default
176180
};
177181

178182
_log(nameof(Default), Data);

0 commit comments

Comments
 (0)