Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Aug 15, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -300,5 +300,26 @@ await store
}
}
}

[Fact]
public async Task Can_set_deleted_stream_metadata()
{
using (var fixture = GetFixture())
{
using (var store = await fixture.GetStreamStore())
{
const string streamId = Deleted.DeletedStreamId;
await store
.SetStreamMetadata(streamId, maxCount: 2, maxAge: 30);

var metadata = await store.GetStreamMetadata(streamId);

metadata.MetadataStreamVersion.ShouldBe(0);
metadata.MaxAge.ShouldBe(30);
metadata.MaxCount.ShouldBe(2);
metadata.MetadataJson.ShouldBeNull();
}
}
}
}
}
6 changes: 5 additions & 1 deletion 6 src/SqlStreamStore/Infrastructure/ReadonlyStreamStoreBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,11 @@ public Task<StreamMetadataResult> GetStreamMetadata(
string streamId,
CancellationToken cancellationToken = default)
{
Ensure.That(streamId, nameof(streamId)).IsNotNullOrWhiteSpace().DoesNotStartWith("$");
if (streamId == null) throw new ArgumentNullException(nameof(streamId));
if (streamId.StartsWith("$") && streamId != Deleted.DeletedStreamId)
{
throw new ArgumentException("Must not start with '$'", nameof(streamId));
}

if (Logger.IsDebugEnabled())
{
Expand Down
7 changes: 6 additions & 1 deletion 7 src/SqlStreamStore/Infrastructure/StreamStoreBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,12 @@ public Task SetStreamMetadata(
string metadataJson = null,
CancellationToken cancellationToken = default)
{
Ensure.That(streamId.Value, nameof(streamId)).DoesNotStartWith("$");
if(streamId == null) throw new ArgumentNullException(nameof(streamId));
if(streamId.Value.StartsWith("$") && streamId.Value != Deleted.DeletedStreamId)
{
throw new ArgumentException("Must not start with '$'", nameof(streamId));
}

Ensure.That(expectedStreamMetadataVersion, nameof(expectedStreamMetadataVersion)).IsGte(-2);

if (Logger.IsDebugEnabled())
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.