This repository was archived by the owner on Aug 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 130
Allow stream message json data to not be prefetched during stream reading. #49
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
15c97fb
Getting the Json data from a StreamMessage is async. Add paramater to…
damianh cb55c54
Add prefect data paramater to ReadAllBackwards, ReadStreamForwards, R…
damianh 7f462ef
Propagate prefect parameter to internal methods.
damianh 63508ba
Propagate prefetch further into MSSql impl. Not yet operational.
damianh 0683b70
Parking MSSql ReadStream with optional payload.
damianh 781fbe5
MSSql - prefetching enabled for read stream back/forewards
damianh f26a2df
MSSql ReadAllBackwards and ReadAllForwards supports prefetch.
damianh e490386
Rename script that reads the message data.
damianh c4e75bd
Test fix - need to use the stream id hashed.
damianh 7132e26
In-memory store simulates async GetJsonData when prefect is set to fa…
damianh 0348546
Rename parameter, a little more obvious.
damianh 3103250
A test for returning null when calling GetJsonData and the stream / m…
damianh 7b86b28
Rebase fix
damianh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
14 changes: 14 additions & 0 deletions
14
src/SqlStreamStore.MsSql/MsSqlScripts/ReadAllBackwardWithData.sql
This file contains hidden or 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,14 @@ | ||
| SELECT TOP(@count) | ||
| dbo.Streams.IdOriginal As StreamId, | ||
| dbo.Messages.StreamVersion, | ||
| dbo.Messages.Position, | ||
| dbo.Messages.Id AS EventId, | ||
| dbo.Messages.Created, | ||
| dbo.Messages.Type, | ||
| dbo.Messages.JsonMetadata, | ||
| dbo.Messages.JsonData | ||
| FROM dbo.Messages | ||
| INNER JOIN dbo.Streams | ||
| ON dbo.Messages.StreamIdInternal = dbo.Streams.IdInternal | ||
| WHERE dbo.Messages.Position <= @ordinal | ||
| ORDER BY dbo.Messages.Position DESC; |
This file contains hidden or 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
15 changes: 15 additions & 0 deletions
15
src/SqlStreamStore.MsSql/MsSqlScripts/ReadAllForwardWithData.sql
This file contains hidden or 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,15 @@ | ||
| /* SQL Server 2008+ */ | ||
| SELECT TOP(@count) | ||
| dbo.Streams.IdOriginal As StreamId, | ||
| dbo.Messages.StreamVersion, | ||
| dbo.Messages.Position, | ||
| dbo.Messages.Id AS EventId, | ||
| dbo.Messages.Created, | ||
| dbo.Messages.Type, | ||
| dbo.Messages.JsonMetadata, | ||
| dbo.Messages.JsonData | ||
| FROM dbo.Messages | ||
| INNER JOIN dbo.Streams | ||
| ON dbo.Messages.StreamIdInternal = dbo.Streams.IdInternal | ||
| WHERE dbo.Messages.Position >= @ordinal | ||
| ORDER BY dbo.Messages.Position; |
This file contains hidden or 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,11 @@ | ||
| /* SQL Server 2008+ */ | ||
|
|
||
| DECLARE @streamIdInternal AS INT | ||
|
|
||
| SELECT @streamIdInternal = dbo.Streams.IdInternal | ||
| FROM dbo.Streams | ||
| WHERE dbo.Streams.Id = @streamId | ||
|
|
||
| SELECT dbo.Messages.JsonData | ||
| FROM dbo.Messages | ||
| WHERE dbo.Messages.StreamIdInternal = @streamIdInternal AND dbo.Messages.StreamVersion = @streamVersion; |
This file contains hidden or 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
24 changes: 24 additions & 0 deletions
24
src/SqlStreamStore.MsSql/MsSqlScripts/ReadStreamBackwardWithData.sql
This file contains hidden or 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,24 @@ | ||
| /* SQL Server 2008+ */ | ||
|
|
||
| DECLARE @streamIdInternal AS INT | ||
| DECLARE @lastStreamVersion AS INT | ||
|
|
||
| SELECT @streamIdInternal = dbo.Streams.IdInternal, @lastStreamVersion = dbo.Streams.[Version] | ||
| FROM dbo.Streams | ||
| WHERE dbo.Streams.Id = @streamId | ||
|
|
||
| SELECT @lastStreamVersion | ||
|
|
||
| SELECT TOP(@count) | ||
| dbo.Messages.StreamVersion, | ||
| dbo.Messages.Position, | ||
| dbo.Messages.Id AS EventId, | ||
| dbo.Messages.Created, | ||
| dbo.Messages.Type, | ||
| dbo.Messages.JsonMetadata, | ||
| dbo.Messages.JsonData | ||
| FROM dbo.Messages | ||
| INNER JOIN dbo.Streams | ||
| ON dbo.Messages.StreamIdInternal = dbo.Streams.IdInternal | ||
| WHERE dbo.Messages.StreamIdInternal = @streamIdInternal AND dbo.Messages.StreamVersion <= @streamVersion | ||
| ORDER BY dbo.Messages.Position DESC |
This file contains hidden or 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
24 changes: 24 additions & 0 deletions
24
src/SqlStreamStore.MsSql/MsSqlScripts/ReadStreamForwardWithData.sql
This file contains hidden or 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,24 @@ | ||
| /* Prefetches the Json Data */ | ||
|
|
||
| DECLARE @streamIdInternal AS INT | ||
| DECLARE @lastStreamVersion AS INT | ||
|
|
||
| SELECT @streamIdInternal = dbo.Streams.IdInternal, @lastStreamVersion = dbo.Streams.[Version] | ||
| FROM dbo.Streams | ||
| WHERE dbo.Streams.Id = @streamId | ||
|
|
||
| SELECT @lastStreamVersion | ||
|
|
||
| SELECT TOP(@count) | ||
| dbo.Messages.StreamVersion, | ||
| dbo.Messages.Position, | ||
| dbo.Messages.Id AS EventId, | ||
| dbo.Messages.Created, | ||
| dbo.Messages.Type, | ||
| dbo.Messages.JsonMetadata, | ||
| dbo.Messages.JsonData | ||
| FROM dbo.Messages | ||
| INNER JOIN dbo.Streams | ||
| ON dbo.Messages.StreamIdInternal = dbo.Streams.IdInternal | ||
| WHERE dbo.Messages.StreamIdInternal = @streamIdInternal AND dbo.Messages.StreamVersion >= @streamVersion | ||
| ORDER BY dbo.Messages.Position; |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the main breaking change for consumers.