public static StreamHead ToStreamHead(this RavenStreamHead streamHead) { return(new StreamHead( streamHead.StreamId, streamHead.HeadRevision, streamHead.SnapshotRevision)); }
private void SaveStreamHeadAsync(RavenStreamHead streamHead) { using (var scope = this.OpenCommandScope()) using (var session = this.store.OpenSession()) { session.Advanced.UseOptimisticConcurrency = false; session.Store(streamHead); session.SaveChanges(); scope.Complete(); } }
private void SaveStreamHead(RavenStreamHead streamHead) { if (this.consistentQueries) { this.SaveStreamHeadAsync(streamHead); } else { ThreadPool.QueueUserWorkItem(x => this.SaveStreamHeadAsync(streamHead), null); } }
private void SaveStreamHeadAsync(RavenStreamHead updated) { using (var scope = this.OpenCommandScope()) using (var session = this.store.OpenSession()) { var current = session.Load <RavenStreamHead>(updated.StreamId.ToRavenStreamId()) ?? updated; current.HeadRevision = updated.HeadRevision; current.SnapshotRevision = updated.SnapshotRevision > 0 ? updated.SnapshotRevision : current.SnapshotRevision; session.Advanced.UseOptimisticConcurrency = false; session.Store(current); session.SaveChanges(); scope.Complete(); } }
private void SaveStreamHeadAsync(RavenStreamHead updated) { this.TryRaven(() => { using (var scope = this.OpenCommandScope()) using (var session = this.store.OpenSession()) { var current = session.Load <RavenStreamHead>(updated.StreamId.ToRavenStreamId(this.partition)) ?? updated; current.HeadRevision = updated.HeadRevision; if (updated.SnapshotRevision > 0) { current.SnapshotRevision = updated.SnapshotRevision; } session.Advanced.UseOptimisticConcurrency = false; session.Store(current); session.SaveChanges(); scope.Complete(); // if this fails it's no big deal, stream heads can be updated whenever } return(true); }); }
private void SaveStreamHead(RavenStreamHead streamHead) { ThreadPool.QueueUserWorkItem(x => this.SaveStreamHeadAsync(streamHead), null); }