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

ReadStreamHeadPosition/Version - #391

Merged
yreynhout merged 3 commits into
SQLStreamStore:masterfrom
yreynhout:read-stream-head-position-and-version
May 24, 2020
Merged

yreynhout merged 3 commits into
SQLStreamStore:masterfrom
yreynhout:read-stream-head-position-and-version

Conversation

@yreynhout

@yreynhout yreynhout commented May 4, 2020

Copy link
Copy Markdown
Contributor

This PR introduces two new methods on IReadonlyStreamStore (non-breaking change):

  • ReadStreamHeadPosition: reads the head position of a stream, i.e. the position of its last message
  • ReadStreamHeadVersion: reads the head version of a stream, i.e. the version of its last message

The test suite was extended with additional acceptance tests to cover the behavior of these new operations. This is the basis for a follow-up PR (in that it will follow a similar pattern) which will introduce support for reading the stream head message as well as the all stream head message.

@yreynhout
yreynhout force-pushed the read-stream-head-position-and-version branch from c16d742 to c7496ea Compare May 23, 2020 10:26
@yreynhout
yreynhout marked this pull request as ready for review May 23, 2020 10:31
{
GuardAgainstDisposed();

return (await ReadStreamBackwards(streamId, StreamVersion.End, 1, false, cancellationToken)).LastStreamPosition;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this could be solved in a more optimized way for the http provider, please show me how.

{
GuardAgainstDisposed();

return (await ReadStreamBackwards(streamId, StreamVersion.End, 1, false, cancellationToken)).LastStreamVersion;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this could be solved in a more optimized way for the http provider, please show me how.

@@ -280,13 +281,63 @@ protected override async Task<long> ReadHeadPositionInternal(CancellationToken c

if(result == DBNull.Value)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left this in - but the test for the new operations seem to suggest this path will never be hit (since result is either null or a value, not DBNull.Value). Similar remark in other relational store implementations.

@yreynhout
yreynhout merged commit ae0b72a into SQLStreamStore:master May 24, 2020
@yreynhout
yreynhout deleted the read-stream-head-position-and-version branch May 24, 2020 16:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants