Permalink
Browse files

Merge branch 'add-get-from-to' of git://github.com/friism/EventStore

Conflicts:
	src/proj/EventStore.Persistence.MongoPersistence/MongoPersistenceEngine.cs
	src/proj/EventStore.Persistence.RavenPersistence/RavenPersistenceEngine.cs
	src/tests/EventStore.Persistence.AcceptanceTests/PersistenceTests.cs
  • Loading branch information...
2 parents 2397382 + 7365963 commit 6fb3fb320c1f211bea9999329e0ade7b842546ee @damianh damianh committed Oct 5, 2012
Showing with 549 additions and 389 deletions.
  1. +6 −0 src/proj/EventStore.Core/Diagnostics/PerformanceCounterPersistenceEngine.cs
  2. +15 −0 src/proj/EventStore.Core/Persistence/InMemoryPersistence/InMemoryPersistenceEngine.cs
  3. +9 −0 src/proj/EventStore.Core/Resources.Designer.cs
  4. +3 −0 src/proj/EventStore.Core/Resources.resx
  5. +9 −0 src/proj/EventStore.Persistence.MongoPersistence/Messages.Designer.cs
  6. +11 −0 src/proj/EventStore.Persistence.MongoPersistence/MongoPersistenceEngine.cs
  7. +9 −0 src/proj/EventStore.Persistence.RavenPersistence/Messages.Designer.cs
  8. +391 −383 src/proj/EventStore.Persistence.RavenPersistence/RavenPersistenceEngine.cs
  9. +3 −0 src/proj/EventStore.Persistence.SqlPersistence/ISqlDialect.cs
  10. +9 −0 src/proj/EventStore.Persistence.SqlPersistence/Messages.Designer.cs
  11. +3 −0 src/proj/EventStore.Persistence.SqlPersistence/Messages.resx
  12. +4 −0 src/proj/EventStore.Persistence.SqlPersistence/SqlDialects/AccessDialect.cs
  13. +12 −0 src/proj/EventStore.Persistence.SqlPersistence/SqlDialects/CommonSqlDialect.cs
  14. +15 −1 src/proj/EventStore.Persistence.SqlPersistence/SqlDialects/CommonSqlStatements.Designer.cs
  15. +8 −0 src/proj/EventStore.Persistence.SqlPersistence/SqlDialects/CommonSqlStatements.resx
  16. +4 −0 src/proj/EventStore.Persistence.SqlPersistence/SqlDialects/FirebirdSqlDialect.cs
  17. +4 −0 src/proj/EventStore.Persistence.SqlPersistence/SqlDialects/MsSqlDialect.cs
  18. +4 −0 src/proj/EventStore.Persistence.SqlPersistence/SqlDialects/SqlCeDialect.cs
  19. +18 −0 src/proj/EventStore.Persistence.SqlPersistence/SqlPersistenceEngine.cs
  20. +10 −0 src/proj/EventStore/Persistence/IPersistStreams.cs
  21. +1 −1 src/tests/EventStore.Persistence.AcceptanceTests/ExtensionMethods.cs
  22. +1 −4 src/tests/EventStore.Persistence.AcceptanceTests/PersistenceTests.cs
@@ -25,6 +25,12 @@ public virtual void MarkCommitAsDispatched(Commit commit)
this.persistence.MarkCommitAsDispatched(commit);
this.counters.CountCommitDispatched();
}
+
+ public IEnumerable<Commit> GetFromTo(DateTime start, DateTime end)
+ {
+ return this.persistence.GetFromTo(start, end);
+ }
+
public virtual IEnumerable<Commit> GetUndispatchedCommits()
{
return this.persistence.GetUndispatchedCommits();
@@ -47,6 +47,7 @@ public virtual IEnumerable<Commit> GetFrom(Guid streamId, int minRevision, int m
lock (this.commits)
return this.commits.Where(x => x.StreamId == streamId && x.StreamRevision >= minRevision && (x.StreamRevision - x.Events.Count + 1) <= maxRevision).ToArray();
}
+
public virtual IEnumerable<Commit> GetFrom(DateTime start)
{
this.ThrowWhenDisposed();
@@ -59,6 +60,20 @@ public virtual IEnumerable<Commit> GetFrom(DateTime start)
var startingCommit = this.commits.FirstOrDefault(x => x.CommitId == commitId);
return this.commits.Skip(this.commits.IndexOf(startingCommit));
}
+
+ public virtual IEnumerable<Commit> GetFromTo(DateTime start, DateTime end)
+ {
+ this.ThrowWhenDisposed();
+ Logger.Debug(Resources.GettingAllCommitsFromToTime, start, end);
+
+ var commitId = this.stamps.Where(x => x.Value >= start && x.Value < end).Select(x => x.Key).FirstOrDefault();
+ if (commitId == Guid.Empty)
+ return new Commit[] { };
+
+ var startingCommit = this.commits.FirstOrDefault(x => x.CommitId == commitId);
+ return this.commits.Skip(this.commits.IndexOf(startingCommit));
+ }
+
public virtual void Commit(Commit attempt)
{
this.ThrowWhenDisposed();

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -165,6 +165,9 @@
<data name="GettingAllCommitsFromTime" xml:space="preserve">
<value>Getting all commits from '{0}' forward.</value>
</data>
+ <data name="GettingAllCommitsFromToTime" xml:space="preserve">
+ <value>Getting all commits from '{0}' to '{1}'.</value>
+ </data>
<data name="AttemptingToCommit" xml:space="preserve">
<value>Attempting to append commit '{0}' to stream '{1}' at position '{2}'.</value>
</data>

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -113,6 +113,17 @@ public virtual IEnumerable<Commit> GetFrom(DateTime start)
.SetSortOrder("CommitStamp")
.Select(x => x.ToCommit(this.serializer)));
}
+
+ public virtual IEnumerable<Commit> GetFromTo(DateTime start, DateTime end)
+ {
+ Logger.Debug(Messages.GettingAllCommitsFromTo, start, end);
+
+ return this.TryMongo(() => this.PersistedCommits
+ .Find(Query.And(Query.GTE("CommitStamp", start), Query.LT("CommitStamp", end)))
+ .SetSortOrder("CommitStamp")
+ .Select(x => x.ToCommit(this.serializer)));
+ }
+
public virtual void Commit(Commit attempt)
{
Logger.Debug(Messages.AttemptingToCommit,

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 6fb3fb3

Please sign in to comment.