Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changes necessary to work from generated code from a .proto file for TCP

Client Messages. Reorganized so that all messages intended to be
serialized over protobuf reside under the TcpClientMessageDto and DTOs for
HTTP live in HttpClientMessageDto, hence the large number of affected
files.

Includes custom XSLT for ProtoGen C# which generates message constructors
and deals with nullable value types.

Changes timestamp serialization "on-the-wire" over TCP to be number of
milliseconds from UNIX Epoch.
  • Loading branch information...
commit 4b568dc82ce05c20fd70fd8ccbe48a29f9574b95 1 parent 90e9573
@jen20 jen20 authored
Showing with 1,476 additions and 2,150 deletions.
  1. +1 −1  src/EventStore/EventStore.ClientAPI/AllEventsSlice.cs
  2. +5 −5 src/EventStore/EventStore.ClientAPI/ClientOperations/AppendToStreamOperation.cs
  3. +4 −4 src/EventStore/EventStore.ClientAPI/ClientOperations/CommitTransactionOperation.cs
  4. +4 −4 src/EventStore/EventStore.ClientAPI/ClientOperations/CreateStreamOperation.cs
  5. +4 −4 src/EventStore/EventStore.ClientAPI/ClientOperations/DeleteStreamOperation.cs
  6. +3 −3 src/EventStore/EventStore.ClientAPI/ClientOperations/ReadAllEventsBackwardOperation.cs
  7. +3 −3 src/EventStore/EventStore.ClientAPI/ClientOperations/ReadAllEventsForwardOperation.cs
  8. +3 −3 src/EventStore/EventStore.ClientAPI/ClientOperations/ReadStreamEventsBackwardOperation.cs
  9. +7 −4 src/EventStore/EventStore.ClientAPI/ClientOperations/ReadStreamEventsForwardOperation.cs
  10. +4 −4 src/EventStore/EventStore.ClientAPI/ClientOperations/StartTransactionOperation.cs
  11. +5 −5 src/EventStore/EventStore.ClientAPI/ClientOperations/TransactionalWriteOperation.cs
  12. +5 −5 src/EventStore/EventStore.ClientAPI/Connection/SubscriptionsChannel.cs
  13. +1 −4 src/EventStore/EventStore.ClientAPI/EventStore.ClientAPI.csproj
  14. +1 −1  src/EventStore/EventStore.ClientAPI/EventStoreConnection.cs
  15. +1 −1  src/EventStore/EventStore.ClientAPI/EventStreamSlice.cs
  16. +0 −33 src/EventStore/EventStore.ClientAPI/Messages/ClientEvent.cs
  17. +93 −31 src/EventStore/EventStore.ClientAPI/Messages/{ClientMessages.cs → ClientMessage.cs}
  18. +29 −2 src/EventStore/EventStore.ClientAPI/Messages/ClientMessagesExtensions.cs
  19. +0 −26 src/EventStore/EventStore.ClientAPI/Messages/EventLinkPair.cs
  20. +0 −76 src/EventStore/EventStore.ClientAPI/Messages/EventRecord.cs
  21. +2 −2 src/EventStore/EventStore.ClientAPI/RecordedEvent.cs
  22. +4 −2 src/EventStore/EventStore.Core/EventStore.Core.csproj
  23. +0 −1,118 src/EventStore/EventStore.Core/Messages/ClientMessageDtos.cs
  24. +167 −0 src/EventStore/EventStore.Core/Messages/HttpClientMessageDto.cs
  25. +855 −0 src/EventStore/EventStore.Core/Messages/TcpClientMessageDto.cs
  26. +74 −0 src/EventStore/EventStore.Core/Messages/TcpClientMessageDtoExtensions.cs
  27. +4 −4 src/EventStore/EventStore.Core/Services/Transport/Http/Controllers/AtomControllerDefinitions.cs
  28. +3 −3 src/EventStore/EventStore.Core/Services/Transport/Http/{EventConvertion.cs → EventConversion.cs}
  29. +3 −3 src/EventStore/EventStore.Core/Services/Transport/Http/Format.cs
  30. +60 −57 src/EventStore/EventStore.Core/Services/Transport/Tcp/ClientTcpDispatcher.cs
  31. +4 −3 src/EventStore/EventStore.TestClient/Commands/CreateStreamProcessor.cs
  32. +2 −2 src/EventStore/EventStore.TestClient/Commands/DeleteProcessor.cs
  33. +6 −5 src/EventStore/EventStore.TestClient/Commands/DvuBasic/DvuBasicProcessor.cs
  34. +8 −6 src/EventStore/EventStore.TestClient/Commands/MultiWriteFloodWaiting.cs
  35. +5 −4 src/EventStore/EventStore.TestClient/Commands/MultiWriteProcessor.cs
  36. +7 −7 src/EventStore/EventStore.TestClient/Commands/ReadAllProcessor.cs
  37. +1 −1  src/EventStore/EventStore.TestClient/Commands/ReadFloodProcessor.cs
  38. +2 −2 src/EventStore/EventStore.TestClient/Commands/ReadProcessor.cs
  39. +5 −5 src/EventStore/EventStore.TestClient/Commands/SubscribeToStreamProcessor.cs
  40. +9 −8 src/EventStore/EventStore.TestClient/Commands/TransactionWriteProcessor.cs
  41. +2 −2 src/EventStore/EventStore.TestClient/Commands/WriteFloodHttpProcessor.cs
  42. +10 −8 src/EventStore/EventStore.TestClient/Commands/WriteFloodProcessor.cs
  43. +2 −2 src/EventStore/EventStore.TestClient/Commands/WriteFloodWaitingHttpProcessor.cs
  44. +10 −8 src/EventStore/EventStore.TestClient/Commands/WriteFloodWaitingProcessor.cs
  45. +2 −2 src/EventStore/EventStore.TestClient/Commands/WriteHttpProcessor.cs
  46. +2 −2 src/EventStore/EventStore.TestClient/Commands/WriteLongTermHttpProcessor.cs
  47. +11 −9 src/EventStore/EventStore.TestClient/Commands/WriteLongTermProcessor.cs
  48. +10 −9 src/EventStore/EventStore.TestClient/Commands/WriteProcessor.cs
  49. +1 −0  src/EventStore/EventStore.TestClient/EventStore.TestClient.csproj
  50. +13 −0 src/EventStore/EventStore.TestClient/MessageUtil.cs
  51. +7 −7 src/EventStore/Protos/ClientAPI/ClientMessageDtos.proto
  52. +2 −1  src/EventStore/Scripts/ProtoGen/generate-clientmessages-from-proto.cmd
  53. +0 −645 tools/ProtoGen/Heavily Edited CSharp.xslt
  54. +10 −4 tools/ProtoGen/csharp.xslt
View
2  src/EventStore/EventStore.ClientAPI/AllEventsSlice.cs
@@ -37,7 +37,7 @@ public class AllEventsSlice
public readonly Position Position;
public readonly RecordedEvent[] Events;
- internal AllEventsSlice(Position position, IEnumerable<ClientMessages.EventLinkPair> events)
+ internal AllEventsSlice(Position position, IEnumerable<ClientMessage.EventLinkPair> events)
{
Position = position;
Events = events == null ? EventStreamSlice.EmptyEvents : events.Select(x => new RecordedEvent(x.Event)).ToArray();
View
10 src/EventStore/EventStore.ClientAPI/ClientOperations/AppendToStreamOperation.cs
@@ -41,7 +41,7 @@ namespace EventStore.ClientAPI.ClientOperations
internal class AppendToStreamOperation : IClientOperation
{
private readonly TaskCompletionSource<object> _source;
- private ClientMessages.WriteEventsCompleted _result;
+ private ClientMessage.WriteEventsCompleted _result;
private int _completed;
private Guid _correlationId;
@@ -87,8 +87,8 @@ public TcpPackage CreateNetworkPackage()
{
lock (_corrIdLock)
{
- var dtos = _events.Select(x => new ClientMessages.ClientEvent(x.EventId.ToByteArray(), x.Type, x.Data, x.Metadata)).ToArray();
- var write = new ClientMessages.WriteEvents(_stream, _expectedVersion, dtos, _forward);
+ var dtos = _events.Select(x => new ClientMessage.ClientEvent(x.EventId.ToByteArray(), x.Type, x.Data, x.Metadata)).ToArray();
+ var write = new ClientMessage.WriteEvents(_stream, _expectedVersion, dtos, _forward);
return new TcpPackage(TcpCommand.WriteEvents, _correlationId, write.Serialize());
}
}
@@ -99,7 +99,7 @@ public InspectionResult InspectPackage(TcpPackage package)
{
if (package.Command == TcpCommand.DeniedToRoute)
{
- var route = package.Data.Deserialize<ClientMessages.DeniedToRoute>();
+ var route = package.Data.Deserialize<ClientMessage.DeniedToRoute>();
return new InspectionResult(InspectionDecision.Reconnect,
data: new EndpointsPair(route.ExternalTcpEndPoint,
route.ExternalHttpEndPoint));
@@ -112,7 +112,7 @@ public InspectionResult InspectPackage(TcpPackage package)
}
var data = package.Data;
- var dto = data.Deserialize<ClientMessages.WriteEventsCompleted>();
+ var dto = data.Deserialize<ClientMessage.WriteEventsCompleted>();
_result = dto;
switch ((OperationErrorCode)dto.ErrorCode)
View
8 src/EventStore/EventStore.ClientAPI/ClientOperations/CommitTransactionOperation.cs
@@ -39,7 +39,7 @@ namespace EventStore.ClientAPI.ClientOperations
internal class CommitTransactionOperation : IClientOperation
{
private readonly TaskCompletionSource<object> _source;
- private ClientMessages.TransactionCommitCompleted _result;
+ private ClientMessage.TransactionCommitCompleted _result;
private int _completed;
private Guid _corrId;
@@ -82,7 +82,7 @@ public TcpPackage CreateNetworkPackage()
{
lock (_corrIdLock)
{
- var commit = new ClientMessages.TransactionCommit(_transactionId, _stream, _forward);
+ var commit = new ClientMessage.TransactionCommit(_transactionId, _stream, _forward);
return new TcpPackage(TcpCommand.TransactionCommit, _corrId, commit.Serialize());
}
}
@@ -93,7 +93,7 @@ public InspectionResult InspectPackage(TcpPackage package)
{
if (package.Command == TcpCommand.DeniedToRoute)
{
- var route = package.Data.Deserialize<ClientMessages.DeniedToRoute>();
+ var route = package.Data.Deserialize<ClientMessage.DeniedToRoute>();
return new InspectionResult(InspectionDecision.Reconnect,
data: new EndpointsPair(route.ExternalTcpEndPoint,
route.ExternalHttpEndPoint));
@@ -106,7 +106,7 @@ public InspectionResult InspectPackage(TcpPackage package)
}
var data = package.Data;
- var dto = data.Deserialize<ClientMessages.TransactionCommitCompleted>();
+ var dto = data.Deserialize<ClientMessage.TransactionCommitCompleted>();
_result = dto;
switch ((OperationErrorCode)dto.ErrorCode)
View
8 src/EventStore/EventStore.ClientAPI/ClientOperations/CreateStreamOperation.cs
@@ -39,7 +39,7 @@ namespace EventStore.ClientAPI.ClientOperations
internal class CreateStreamOperation : IClientOperation
{
private readonly TaskCompletionSource<object> _source;
- private ClientMessages.CreateStreamCompleted _result;
+ private ClientMessage.CreateStreamCompleted _result;
private int _completed;
private Guid _correlationId;
@@ -82,7 +82,7 @@ public TcpPackage CreateNetworkPackage()
{
lock (_corrIdLock)
{
- var dto = new ClientMessages.CreateStream(_stream, _metadata, _forward);
+ var dto = new ClientMessage.CreateStream(_stream, _metadata, _forward);
return new TcpPackage(TcpCommand.CreateStream, _correlationId, dto.Serialize());
}
}
@@ -93,7 +93,7 @@ public InspectionResult InspectPackage(TcpPackage package)
{
if (package.Command == TcpCommand.DeniedToRoute)
{
- var route = package.Data.Deserialize<ClientMessages.DeniedToRoute>();
+ var route = package.Data.Deserialize<ClientMessage.DeniedToRoute>();
return new InspectionResult(InspectionDecision.Reconnect,
data: new EndpointsPair(route.ExternalTcpEndPoint,
route.ExternalHttpEndPoint));
@@ -104,7 +104,7 @@ public InspectionResult InspectPackage(TcpPackage package)
package.Command.ToString()));
var data = package.Data;
- var dto = data.Deserialize<ClientMessages.CreateStreamCompleted>();
+ var dto = data.Deserialize<ClientMessage.CreateStreamCompleted>();
_result = dto;
switch ((OperationErrorCode)dto.ErrorCode)
View
8 src/EventStore/EventStore.ClientAPI/ClientOperations/DeleteStreamOperation.cs
@@ -39,7 +39,7 @@ namespace EventStore.ClientAPI.ClientOperations
internal class DeleteStreamOperation : IClientOperation
{
private readonly TaskCompletionSource<object> _source;
- private ClientMessages.DeleteStreamCompleted _result;
+ private ClientMessage.DeleteStreamCompleted _result;
private int _completed;
private Guid _correlationId;
@@ -76,7 +76,7 @@ public TcpPackage CreateNetworkPackage()
{
lock (_corrIdLock)
{
- var dto = new ClientMessages.DeleteStream(_stream, _expectedVersion, _forward);
+ var dto = new ClientMessage.DeleteStream(_stream, _expectedVersion, _forward);
return new TcpPackage(TcpCommand.DeleteStream, _correlationId, dto.Serialize());
}
}
@@ -93,7 +93,7 @@ public InspectionResult InspectPackage(TcpPackage package)
{
if (package.Command == TcpCommand.DeniedToRoute)
{
- var route = package.Data.Deserialize<ClientMessages.DeniedToRoute>();
+ var route = package.Data.Deserialize<ClientMessage.DeniedToRoute>();
return new InspectionResult(InspectionDecision.Reconnect,
data: new EndpointsPair(route.ExternalTcpEndPoint,
route.ExternalHttpEndPoint));
@@ -106,7 +106,7 @@ public InspectionResult InspectPackage(TcpPackage package)
}
var data = package.Data;
- var dto = data.Deserialize<ClientMessages.DeleteStreamCompleted>();
+ var dto = data.Deserialize<ClientMessage.DeleteStreamCompleted>();
_result = dto;
switch ((OperationErrorCode)dto.ErrorCode)
View
6 src/EventStore/EventStore.ClientAPI/ClientOperations/ReadAllEventsBackwardOperation.cs
@@ -11,7 +11,7 @@ namespace EventStore.ClientAPI.ClientOperations
internal class ReadAllEventsBackwardOperation : IClientOperation
{
private readonly TaskCompletionSource<AllEventsSlice> _source;
- private ClientMessages.ReadAllEventsBackwardCompleted _result;
+ private ClientMessage.ReadAllEventsBackwardCompleted _result;
private int _completed;
private Guid _corrId;
@@ -54,7 +54,7 @@ public TcpPackage CreateNetworkPackage()
{
lock (_corrIdLock)
{
- var dto = new ClientMessages.ReadAllEventsBackward(_position.CommitPosition,
+ var dto = new ClientMessage.ReadAllEventsBackward(_position.CommitPosition,
_position.PreparePosition,
_maxCount,
_resolveLinkTos);
@@ -74,7 +74,7 @@ public InspectionResult InspectPackage(TcpPackage package)
}
var data = package.Data;
- var dto = data.Deserialize<ClientMessages.ReadAllEventsBackwardCompleted>();
+ var dto = data.Deserialize<ClientMessage.ReadAllEventsBackwardCompleted>();
_result = dto;
return new InspectionResult(InspectionDecision.Succeed);
}
View
6 src/EventStore/EventStore.ClientAPI/ClientOperations/ReadAllEventsForwardOperation.cs
@@ -38,7 +38,7 @@ namespace EventStore.ClientAPI.ClientOperations
internal class ReadAllEventsForwardOperation : IClientOperation
{
private readonly TaskCompletionSource<AllEventsSlice> _source;
- private ClientMessages.ReadAllEventsForwardCompleted _result;
+ private ClientMessage.ReadAllEventsForwardCompleted _result;
private int _completed;
private Guid _corrId;
@@ -81,7 +81,7 @@ public TcpPackage CreateNetworkPackage()
{
lock (_corrIdLock)
{
- var dto = new ClientMessages.ReadAllEventsForward(_position.CommitPosition,
+ var dto = new ClientMessage.ReadAllEventsForward(_position.CommitPosition,
_position.PreparePosition,
_maxCount,
_resolveLinkTos);
@@ -101,7 +101,7 @@ public InspectionResult InspectPackage(TcpPackage package)
}
var data = package.Data;
- var dto = data.Deserialize<ClientMessages.ReadAllEventsForwardCompleted>();
+ var dto = data.Deserialize<ClientMessage.ReadAllEventsForwardCompleted>();
_result = dto;
return new InspectionResult(InspectionDecision.Succeed);
}
View
6 src/EventStore/EventStore.ClientAPI/ClientOperations/ReadStreamEventsBackwardOperation.cs
@@ -11,7 +11,7 @@ namespace EventStore.ClientAPI.ClientOperations
internal class ReadStreamEventsBackwardOperation : IClientOperation
{
private readonly TaskCompletionSource<EventStreamSlice> _source;
- private ClientMessages.ReadStreamEventsBackwardCompleted _result;
+ private ClientMessage.ReadStreamEventsBackwardCompleted _result;
private int _completed;
private Guid _correlationId;
@@ -57,7 +57,7 @@ public TcpPackage CreateNetworkPackage()
{
lock (_corrIdLock)
{
- var dto = new ClientMessages.ReadStreamEventsBackward(_stream, _start, _count, _resolveLinkTos);
+ var dto = new ClientMessage.ReadStreamEventsBackward(_stream, _start, _count, _resolveLinkTos);
return new TcpPackage(TcpCommand.ReadStreamEventsBackward, _correlationId, dto.Serialize());
}
}
@@ -74,7 +74,7 @@ public InspectionResult InspectPackage(TcpPackage package)
}
var data = package.Data;
- var dto = data.Deserialize<ClientMessages.ReadStreamEventsBackwardCompleted>();
+ var dto = data.Deserialize<ClientMessage.ReadStreamEventsBackwardCompleted>();
_result = dto;
switch ((RangeReadResult)dto.Result)
View
11 src/EventStore/EventStore.ClientAPI/ClientOperations/ReadStreamEventsForwardOperation.cs
@@ -39,7 +39,7 @@ namespace EventStore.ClientAPI.ClientOperations
internal class ReadStreamEventsForwardOperation : IClientOperation
{
private readonly TaskCompletionSource<EventStreamSlice> _source;
- private ClientMessages.ReadStreamEventsForwardCompleted _result;
+ private ClientMessage.ReadStreamEventsForwardCompleted _result;
private int _completed;
private Guid _correlationId;
@@ -49,6 +49,7 @@ internal class ReadStreamEventsForwardOperation : IClientOperation
private readonly int _start;
private readonly int _count;
private readonly bool _resolveLinkTos;
+ private readonly bool _returnLastEventNumber;
public Guid CorrelationId
{
@@ -64,7 +65,8 @@ public Guid CorrelationId
string stream,
int start,
int count,
- bool resolveLinkTos)
+ bool resolveLinkTos,
+ bool returnLastEventNumber)
{
_source = source;
@@ -73,6 +75,7 @@ public Guid CorrelationId
_start = start;
_count = count;
_resolveLinkTos = resolveLinkTos;
+ _returnLastEventNumber = returnLastEventNumber;
}
public void SetRetryId(Guid correlationId)
@@ -85,7 +88,7 @@ public TcpPackage CreateNetworkPackage()
{
lock (_corrIdLock)
{
- var dto = new ClientMessages.ReadStreamEventsForward(_stream, _start, _count, _resolveLinkTos);
+ var dto = new ClientMessage.ReadStreamEventsForward(_stream, _start, _count, _resolveLinkTos, _returnLastEventNumber);
return new TcpPackage(TcpCommand.ReadStreamEventsForward, _correlationId, dto.Serialize());
}
}
@@ -102,7 +105,7 @@ public InspectionResult InspectPackage(TcpPackage package)
}
var data = package.Data;
- var dto = data.Deserialize<ClientMessages.ReadStreamEventsForwardCompleted>();
+ var dto = data.Deserialize<ClientMessage.ReadStreamEventsForwardCompleted>();
_result = dto;
switch ((RangeReadResult)dto.Result)
View
8 src/EventStore/EventStore.ClientAPI/ClientOperations/StartTransactionOperation.cs
@@ -39,7 +39,7 @@ namespace EventStore.ClientAPI.ClientOperations
internal class StartTransactionOperation : IClientOperation
{
private readonly TaskCompletionSource<EventStoreTransaction> _source;
- private ClientMessages.TransactionStartCompleted _result;
+ private ClientMessage.TransactionStartCompleted _result;
private int _completed;
private Guid _corrId;
@@ -82,7 +82,7 @@ public TcpPackage CreateNetworkPackage()
{
lock (_corrIdLock)
{
- var startTransaction = new ClientMessages.TransactionStart(_stream, _expectedVersion, _forward);
+ var startTransaction = new ClientMessage.TransactionStart(_stream, _expectedVersion, _forward);
return new TcpPackage(TcpCommand.TransactionStart, _corrId, startTransaction.Serialize());
}
}
@@ -93,7 +93,7 @@ public InspectionResult InspectPackage(TcpPackage package)
{
if (package.Command == TcpCommand.DeniedToRoute)
{
- var route = package.Data.Deserialize<ClientMessages.DeniedToRoute>();
+ var route = package.Data.Deserialize<ClientMessage.DeniedToRoute>();
return new InspectionResult(InspectionDecision.Reconnect,
data: new EndpointsPair(route.ExternalTcpEndPoint,
route.ExternalHttpEndPoint));
@@ -106,7 +106,7 @@ public InspectionResult InspectPackage(TcpPackage package)
}
var data = package.Data;
- var dto = data.Deserialize<ClientMessages.TransactionStartCompleted>();
+ var dto = data.Deserialize<ClientMessage.TransactionStartCompleted>();
_result = dto;
switch ((OperationErrorCode)dto.ErrorCode)
View
10 src/EventStore/EventStore.ClientAPI/ClientOperations/TransactionalWriteOperation.cs
@@ -41,7 +41,7 @@ namespace EventStore.ClientAPI.ClientOperations
internal class TransactionalWriteOperation : IClientOperation
{
private readonly TaskCompletionSource<object> _source;
- private ClientMessages.TransactionWriteCompleted _result;
+ private ClientMessage.TransactionWriteCompleted _result;
private int _completed;
private Guid _corrId;
@@ -87,8 +87,8 @@ public TcpPackage CreateNetworkPackage()
{
lock (_corrIdLock)
{
- var dtos = _events.Select(x => new ClientMessages.ClientEvent(x.EventId.ToByteArray(), x.Type, x.Data, x.Metadata)).ToArray();
- var write = new ClientMessages.TransactionWrite(_transactionId, _stream, dtos, _forward);
+ var dtos = _events.Select(x => new ClientMessage.ClientEvent(x.EventId.ToByteArray(), x.Type, x.Data, x.Metadata)).ToArray();
+ var write = new ClientMessage.TransactionWrite(_transactionId, _stream, dtos, _forward);
return new TcpPackage(TcpCommand.TransactionWrite, _corrId, write.Serialize());
}
}
@@ -99,7 +99,7 @@ public InspectionResult InspectPackage(TcpPackage package)
{
if (package.Command == TcpCommand.DeniedToRoute)
{
- var route = package.Data.Deserialize<ClientMessages.DeniedToRoute>();
+ var route = package.Data.Deserialize<ClientMessage.DeniedToRoute>();
return new InspectionResult(InspectionDecision.Reconnect,
data: new EndpointsPair(route.ExternalTcpEndPoint,
route.ExternalHttpEndPoint));
@@ -112,7 +112,7 @@ public InspectionResult InspectPackage(TcpPackage package)
}
var data = package.Data;
- var dto = data.Deserialize<ClientMessages.TransactionWriteCompleted>();
+ var dto = data.Deserialize<ClientMessage.TransactionWriteCompleted>();
_result = dto;
switch ((OperationErrorCode)dto.ErrorCode)
View
10 src/EventStore/EventStore.ClientAPI/Connection/SubscriptionsChannel.cs
@@ -53,7 +53,7 @@ public Task Subscribe(string stream, Action<RecordedEvent, Position> eventAppear
if (_subscriptions.TryAdd(id, new Subscription(source, id, stream, eventAppeared, subscriptionDropped)))
{
- var subscribe = new ClientMessages.SubscribeToStream(stream);
+ var subscribe = new ClientMessage.SubscribeToStream(stream);
var pkg = new TcpPackage(TcpCommand.SubscribeToStream, id, subscribe.Serialize());
_connection.EnqueueSend(pkg.AsByteArray());
}
@@ -80,7 +80,7 @@ public void Unsubscribe(string stream)
var pkg = new TcpPackage(TcpCommand.UnsubscribeFromStream,
id,
- new ClientMessages.UnsubscribeFromStream(stream).Serialize());
+ new ClientMessage.UnsubscribeFromStream(stream).Serialize());
_connection.EnqueueSend(pkg.AsByteArray());
}
}
@@ -93,7 +93,7 @@ public Task SubscribeToAllStreams(Action<RecordedEvent, Position> eventAppeared,
if (_subscriptions.TryAdd(id, new Subscription(source, id, eventAppeared, subscriptionDropped)))
{
- var subscribe = new ClientMessages.SubscribeToAllStreams();
+ var subscribe = new ClientMessage.SubscribeToAllStreams();
var pkg = new TcpPackage(TcpCommand.SubscribeToAllStreams, id, subscribe.Serialize());
_connection.EnqueueSend(pkg.AsByteArray());
}
@@ -120,7 +120,7 @@ public void UnsubscribeFromAllStreams()
var pkg = new TcpPackage(TcpCommand.UnsubscribeFromAllStreams,
id,
- new ClientMessages.UnsubscribeFromAllStreams().Serialize());
+ new ClientMessage.UnsubscribeFromAllStreams().Serialize());
_connection.EnqueueSend(pkg.AsByteArray());
}
}
@@ -166,7 +166,7 @@ private void OnPackageReceived(TcpTypedConnection connection, TcpPackage package
switch (package.Command)
{
case TcpCommand.StreamEventAppeared:
- var dto = package.Data.Deserialize<ClientMessages.StreamEventAppeared>();
+ var dto = package.Data.Deserialize<ClientMessage.StreamEventAppeared>();
var recordedEvent = new RecordedEvent(dto);
var commitPos = dto.CommitPosition;
var preparePos = dto.PreparePosition;
View
5 src/EventStore/EventStore.ClientAPI/EventStore.ClientAPI.csproj
@@ -117,14 +117,11 @@
<Compile Include="ILogger.cs" />
<Compile Include="IProjectionsManagement.cs" />
<Compile Include="AllEventsSlice.cs" />
- <Compile Include="Messages\ClientEvent.cs" />
<Compile Include="Messages\ClientMessagesExtensions.cs" />
<Compile Include="Position.cs" />
<Compile Include="RecordedEvent.cs" />
<Compile Include="StreamPosition.cs" />
<Compile Include="SystemData\EndpointsPair.cs" />
- <Compile Include="Messages\EventLinkPair.cs" />
- <Compile Include="Messages\EventRecord.cs" />
<Compile Include="ExpectedVersion.cs" />
<Compile Include="SystemData\InspectionResult.cs" />
<Compile Include="SystemData\OperationErrorCode.cs" />
@@ -144,7 +141,7 @@
<Compile Include="Transport.Http\IOStreams.cs" />
<Compile Include="Transport.Http\IPEndpointExtensions.cs" />
<Compile Include="Transport.Http\WebRequestExtensions.cs" />
- <Compile Include="Messages\ClientMessages.cs" />
+ <Compile Include="Messages\ClientMessage.cs" />
<Compile Include="Transport.Tcp\PackageFramingException.cs" />
<Compile Include="Transport.Tcp\ProtobufExtensions.cs" />
<Compile Include="Transport.Tcp\TcpConfiguratin.cs" />
View
2  src/EventStore/EventStore.ClientAPI/EventStoreConnection.cs
@@ -297,7 +297,7 @@ public Task<EventStreamSlice> ReadEventStreamForwardAsync(string stream, int sta
Ensure.Positive(count, "count");
var source = new TaskCompletionSource<EventStreamSlice>();
- var operation = new ReadStreamEventsForwardOperation(source, Guid.NewGuid(), stream, start, count, true);
+ var operation = new ReadStreamEventsForwardOperation(source, Guid.NewGuid(), stream, start, count, true, true);
EnqueueOperation(operation);
return source.Task;
View
2  src/EventStore/EventStore.ClientAPI/EventStreamSlice.cs
@@ -42,7 +42,7 @@ public class EventStreamSlice
public readonly int Count;
public readonly RecordedEvent[] Events;
- internal EventStreamSlice(string stream, int startIndex, int count, IEnumerable<ClientMessages.EventLinkPair> events)
+ internal EventStreamSlice(string stream, int startIndex, int count, IEnumerable<ClientMessage.EventLinkPair> events)
{
Ensure.NotNullOrEmpty(stream, "stream");
View
33 src/EventStore/EventStore.ClientAPI/Messages/ClientEvent.cs
@@ -1,33 +0,0 @@
-//using System;
-//using ProtoBuf;
-
-//namespace EventStore.ClientAPI.Messages
-//{
-// [ProtoContract]
-// internal class ClientEvent
-// {
-// [ProtoMember(1)]
-// public byte[] EventId { get; set; }
-
-// [ProtoMember(2, IsRequired = false)]
-// public string EventType { get; set; }
-
-// [ProtoMember(3)]
-// public byte[] Data { get; set; }
-
-// [ProtoMember(4, IsRequired = false)]
-// public byte[] Metadata { get; set; }
-
-// public ClientEvent()
-// {
-// }
-
-// public ClientEvent(Guid eventId, string eventType, byte[] data, byte[] metadata)
-// {
-// EventId = eventId.ToByteArray();
-// EventType = eventType;
-// Data = data;
-// Metadata = metadata;
-// }
-// }
-//}
View
124 ...e/EventStore.ClientAPI/Messages/ClientMessages.cs → ...re/EventStore.ClientAPI/Messages/ClientMessage.cs
@@ -15,7 +15,7 @@
namespace EventStore.ClientAPI.Messages
{
- public static partial class ClientMessages
+ public static partial class ClientMessage
{
[Serializable, ProtoContract(Name=@"EventLinkPair")]
public partial class EventLinkPair
@@ -23,9 +23,11 @@ public partial class EventLinkPair
[ProtoMember(1, IsRequired = true, Name=@"event", DataFormat = DataFormat.Default)]
public readonly EventRecord Event;
- [ProtoMember(2, IsRequired = false, Name=@"link", DataFormat = DataFormat.Default)]
+ [ProtoMember(2, IsRequired = true, Name=@"link", DataFormat = DataFormat.Default)]
public readonly EventRecord Link;
+ private EventLinkPair() {}
+
public EventLinkPair(EventRecord @event, EventRecord link)
{
Event = @event;
@@ -48,6 +50,8 @@ public partial class ClientEvent
[ProtoMember(4, IsRequired = false, Name=@"metadata", DataFormat = DataFormat.Default)]
public readonly byte[] Metadata;
+ private ClientEvent() {}
+
public ClientEvent(byte[] eventId, string eventType, byte[] data, byte[] metadata)
{
EventId = eventId;
@@ -84,8 +88,8 @@ public partial class EventRecord
[ProtoMember(8, IsRequired = true, Name=@"expected_version", DataFormat = DataFormat.TwosComplement)]
public readonly int ExpectedVersion;
- [ProtoMember(9, IsRequired = true, Name=@"timestamp", DataFormat = DataFormat.TwosComplement)]
- public readonly long Timestamp;
+ [ProtoMember(9, IsRequired = true, Name=@"time_stamp", DataFormat = DataFormat.TwosComplement)]
+ public readonly long TimeStamp;
[ProtoMember(10, IsRequired = true, Name=@"flags", DataFormat = DataFormat.TwosComplement)]
public readonly uint Flags;
@@ -99,7 +103,9 @@ public partial class EventRecord
[ProtoMember(13, IsRequired = true, Name=@"metadata", DataFormat = DataFormat.Default)]
public readonly byte[] Metadata;
- public EventRecord(int eventNumber, long logPosition, byte[] correlationId, byte[] eventId, long transactionPosition, int transactionOffset, string eventStreamId, int expectedVersion, long timestamp, uint flags, string eventType, byte[] data, byte[] metadata)
+ private EventRecord() {}
+
+ public EventRecord(int eventNumber, long logPosition, byte[] correlationId, byte[] eventId, long transactionPosition, int transactionOffset, string eventStreamId, int expectedVersion, long timeStamp, uint flags, string eventType, byte[] data, byte[] metadata)
{
EventNumber = eventNumber;
LogPosition = logPosition;
@@ -109,7 +115,7 @@ public EventRecord(int eventNumber, long logPosition, byte[] correlationId, byte
TransactionOffset = transactionOffset;
EventStreamId = eventStreamId;
ExpectedVersion = expectedVersion;
- Timestamp = timestamp;
+ TimeStamp = timeStamp;
Flags = flags;
EventType = eventType;
Data = data;
@@ -132,6 +138,8 @@ public partial class DeniedToRoute
[ProtoMember(4, IsRequired = true, Name=@"external_http_port", DataFormat = DataFormat.TwosComplement)]
public readonly int ExternalHttpPort;
+ private DeniedToRoute() {}
+
public DeniedToRoute(string externalTcpAddress, int externalTcpPort, string externalHttpAddress, int externalHttpPort)
{
ExternalTcpAddress = externalTcpAddress;
@@ -153,6 +161,8 @@ public partial class CreateStream
[ProtoMember(3, IsRequired = true, Name=@"allow_forwarding", DataFormat = DataFormat.Default)]
public readonly bool AllowForwarding;
+ private CreateStream() {}
+
public CreateStream(string eventStreamId, byte[] metadata, bool allowForwarding)
{
EventStreamId = eventStreamId;
@@ -173,6 +183,8 @@ public partial class CreateStreamCompleted
[ProtoMember(3, IsRequired = true, Name=@"error", DataFormat = DataFormat.Default)]
public readonly string Error;
+ private CreateStreamCompleted() {}
+
public CreateStreamCompleted(string eventStreamId, int errorCode, string error)
{
EventStreamId = eventStreamId;
@@ -196,6 +208,8 @@ public partial class Event
[ProtoMember(4, IsRequired = false, Name=@"metadata", DataFormat = DataFormat.Default)]
public readonly byte[] Metadata;
+ private Event() {}
+
public Event(byte[] eventId, string eventType, byte[] data, byte[] metadata)
{
EventId = eventId;
@@ -220,6 +234,8 @@ public partial class WriteEvents
[ProtoMember(4, IsRequired = true, Name=@"allow_forwarding", DataFormat = DataFormat.Default)]
public readonly bool AllowForwarding;
+ private WriteEvents() {}
+
public WriteEvents(string eventStreamId, int expectedVersion, ClientEvent[] events, bool allowForwarding)
{
EventStreamId = eventStreamId;
@@ -244,6 +260,8 @@ public partial class WriteEventsCompleted
[ProtoMember(4, IsRequired = true, Name=@"event_number", DataFormat = DataFormat.TwosComplement)]
public readonly int EventNumber;
+ private WriteEventsCompleted() {}
+
public WriteEventsCompleted(string eventStreamId, int errorCode, string error, int eventNumber)
{
EventStreamId = eventStreamId;
@@ -265,6 +283,8 @@ public partial class DeleteStream
[ProtoMember(3, IsRequired = true, Name=@"allow_forwarding", DataFormat = DataFormat.Default)]
public readonly bool AllowForwarding;
+ private DeleteStream() {}
+
public DeleteStream(string eventStreamId, int expectedVersion, bool allowForwarding)
{
EventStreamId = eventStreamId;
@@ -285,6 +305,8 @@ public partial class DeleteStreamCompleted
[ProtoMember(3, IsRequired = true, Name=@"error", DataFormat = DataFormat.Default)]
public readonly string Error;
+ private DeleteStreamCompleted() {}
+
public DeleteStreamCompleted(string eventStreamId, int errorCode, string error)
{
EventStreamId = eventStreamId;
@@ -302,14 +324,16 @@ public partial class ReadEvent
[ProtoMember(2, IsRequired = true, Name=@"event_number", DataFormat = DataFormat.TwosComplement)]
public readonly int EventNumber;
- [ProtoMember(3, IsRequired = true, Name=@"resolve_linktos", DataFormat = DataFormat.Default)]
- public readonly bool ResolveLinktos;
+ [ProtoMember(3, IsRequired = true, Name=@"resolve_link_tos", DataFormat = DataFormat.Default)]
+ public readonly bool ResolveLinkTos;
+
+ private ReadEvent() {}
- public ReadEvent(string eventStreamId, int eventNumber, bool resolveLinktos)
+ public ReadEvent(string eventStreamId, int eventNumber, bool resolveLinkTos)
{
EventStreamId = eventStreamId;
EventNumber = eventNumber;
- ResolveLinktos = resolveLinktos;
+ ResolveLinkTos = resolveLinkTos;
}
}
@@ -337,6 +361,8 @@ public partial class ReadEventCompleted
[ProtoMember(7, IsRequired = true, Name=@"log_position", DataFormat = DataFormat.TwosComplement)]
public readonly long LogPosition;
+ private ReadEventCompleted() {}
+
public ReadEventCompleted(string eventStreamId, int eventNumber, int result, string eventType, byte[] data, byte[] metadata, long logPosition)
{
EventStreamId = eventStreamId;
@@ -361,18 +387,20 @@ public partial class ReadStreamEventsForward
[ProtoMember(3, IsRequired = true, Name=@"max_count", DataFormat = DataFormat.TwosComplement)]
public readonly int MaxCount;
- [ProtoMember(4, IsRequired = true, Name=@"resolve_linktos", DataFormat = DataFormat.Default)]
- public readonly bool ResolveLinktos;
+ [ProtoMember(4, IsRequired = true, Name=@"resolve_link_tos", DataFormat = DataFormat.Default)]
+ public readonly bool ResolveLinkTos;
[ProtoMember(5, IsRequired = true, Name=@"return_last_event_number", DataFormat = DataFormat.Default)]
public readonly bool ReturnLastEventNumber;
- public ReadStreamEventsForward(string eventStreamId, int startIndex, int maxCount, bool resolveLinktos, bool returnLastEventNumber)
+ private ReadStreamEventsForward() {}
+
+ public ReadStreamEventsForward(string eventStreamId, int startIndex, int maxCount, bool resolveLinkTos, bool returnLastEventNumber)
{
EventStreamId = eventStreamId;
StartIndex = startIndex;
MaxCount = maxCount;
- ResolveLinktos = resolveLinktos;
+ ResolveLinkTos = resolveLinkTos;
ReturnLastEventNumber = returnLastEventNumber;
}
}
@@ -390,12 +418,14 @@ public partial class ReadStreamEventsForwardCompleted
public readonly int Result;
[ProtoMember(4, IsRequired = false, Name=@"last_commit_position", DataFormat = DataFormat.TwosComplement)]
- public readonly long LastCommitPosition;
+ public readonly long? LastCommitPosition;
[ProtoMember(5, IsRequired = false, Name=@"last_event_number", DataFormat = DataFormat.TwosComplement)]
- public readonly int LastEventNumber;
+ public readonly int? LastEventNumber;
- public ReadStreamEventsForwardCompleted(string eventStreamId, EventLinkPair[] events, int result, long lastCommitPosition, int lastEventNumber)
+ private ReadStreamEventsForwardCompleted() {}
+
+ public ReadStreamEventsForwardCompleted(string eventStreamId, EventLinkPair[] events, int result, long? lastCommitPosition, int? lastEventNumber)
{
EventStreamId = eventStreamId;
Events = events;
@@ -417,15 +447,17 @@ public partial class ReadStreamEventsBackward
[ProtoMember(3, IsRequired = true, Name=@"max_count", DataFormat = DataFormat.TwosComplement)]
public readonly int MaxCount;
- [ProtoMember(4, IsRequired = true, Name=@"resolve_linktos", DataFormat = DataFormat.Default)]
- public readonly bool ResolveLinktos;
+ [ProtoMember(4, IsRequired = true, Name=@"resolve_link_tos", DataFormat = DataFormat.Default)]
+ public readonly bool ResolveLinkTos;
+
+ private ReadStreamEventsBackward() {}
- public ReadStreamEventsBackward(string eventStreamId, int startIndex, int maxCount, bool resolveLinktos)
+ public ReadStreamEventsBackward(string eventStreamId, int startIndex, int maxCount, bool resolveLinkTos)
{
EventStreamId = eventStreamId;
StartIndex = startIndex;
MaxCount = maxCount;
- ResolveLinktos = resolveLinktos;
+ ResolveLinkTos = resolveLinkTos;
}
}
@@ -442,9 +474,11 @@ public partial class ReadStreamEventsBackwardCompleted
public readonly int Result;
[ProtoMember(4, IsRequired = false, Name=@"last_commit_position", DataFormat = DataFormat.TwosComplement)]
- public readonly long LastCommitPosition;
+ public readonly long? LastCommitPosition;
- public ReadStreamEventsBackwardCompleted(string eventStreamId, EventLinkPair[] events, int result, long lastCommitPosition)
+ private ReadStreamEventsBackwardCompleted() {}
+
+ public ReadStreamEventsBackwardCompleted(string eventStreamId, EventLinkPair[] events, int result, long? lastCommitPosition)
{
EventStreamId = eventStreamId;
Events = events;
@@ -465,15 +499,17 @@ public partial class ReadAllEventsForward
[ProtoMember(3, IsRequired = true, Name=@"max_count", DataFormat = DataFormat.TwosComplement)]
public readonly int MaxCount;
- [ProtoMember(4, IsRequired = true, Name=@"resolve_linktos", DataFormat = DataFormat.Default)]
- public readonly bool ResolveLinktos;
+ [ProtoMember(4, IsRequired = true, Name=@"resolve_link_tos", DataFormat = DataFormat.Default)]
+ public readonly bool ResolveLinkTos;
+
+ private ReadAllEventsForward() {}
- public ReadAllEventsForward(long commitPosition, long preparePosition, int maxCount, bool resolveLinktos)
+ public ReadAllEventsForward(long commitPosition, long preparePosition, int maxCount, bool resolveLinkTos)
{
CommitPosition = commitPosition;
PreparePosition = preparePosition;
MaxCount = maxCount;
- ResolveLinktos = resolveLinktos;
+ ResolveLinkTos = resolveLinkTos;
}
}
@@ -495,6 +531,8 @@ public partial class ReadAllEventsForwardCompleted
[ProtoMember(5, IsRequired = true, Name=@"next_prepare_position", DataFormat = DataFormat.TwosComplement)]
public readonly long NextPreparePosition;
+ private ReadAllEventsForwardCompleted() {}
+
public ReadAllEventsForwardCompleted(long commitPosition, long preparePosition, EventLinkPair[] events, long nextCommitPosition, long nextPreparePosition)
{
CommitPosition = commitPosition;
@@ -517,15 +555,17 @@ public partial class ReadAllEventsBackward
[ProtoMember(3, IsRequired = true, Name=@"max_count", DataFormat = DataFormat.TwosComplement)]
public readonly int MaxCount;
- [ProtoMember(4, IsRequired = true, Name=@"resolve_linktos", DataFormat = DataFormat.Default)]
- public readonly bool ResolveLinktos;
+ [ProtoMember(4, IsRequired = true, Name=@"resolve_link_tos", DataFormat = DataFormat.Default)]
+ public readonly bool ResolveLinkTos;
+
+ private ReadAllEventsBackward() {}
- public ReadAllEventsBackward(long commitPosition, long preparePosition, int maxCount, bool resolveLinktos)
+ public ReadAllEventsBackward(long commitPosition, long preparePosition, int maxCount, bool resolveLinkTos)
{
CommitPosition = commitPosition;
PreparePosition = preparePosition;
MaxCount = maxCount;
- ResolveLinktos = resolveLinktos;
+ ResolveLinkTos = resolveLinkTos;
}
}
@@ -547,6 +587,8 @@ public partial class ReadAllEventsBackwardCompleted
[ProtoMember(5, IsRequired = true, Name=@"next_prepare_position", DataFormat = DataFormat.TwosComplement)]
public readonly long NextPreparePosition;
+ private ReadAllEventsBackwardCompleted() {}
+
public ReadAllEventsBackwardCompleted(long commitPosition, long preparePosition, EventLinkPair[] events, long nextCommitPosition, long nextPreparePosition)
{
CommitPosition = commitPosition;
@@ -569,6 +611,8 @@ public partial class TransactionStart
[ProtoMember(3, IsRequired = true, Name=@"allow_forwarding", DataFormat = DataFormat.Default)]
public readonly bool AllowForwarding;
+ private TransactionStart() {}
+
public TransactionStart(string eventStreamId, int expectedVersion, bool allowForwarding)
{
EventStreamId = eventStreamId;
@@ -592,6 +636,8 @@ public partial class TransactionStartCompleted
[ProtoMember(4, IsRequired = true, Name=@"error", DataFormat = DataFormat.Default)]
public readonly string Error;
+ private TransactionStartCompleted() {}
+
public TransactionStartCompleted(long transactionId, string eventStreamId, int errorCode, string error)
{
TransactionId = transactionId;
@@ -616,6 +662,8 @@ public partial class TransactionWrite
[ProtoMember(4, IsRequired = true, Name=@"allow_forwarding", DataFormat = DataFormat.Default)]
public readonly bool AllowForwarding;
+ private TransactionWrite() {}
+
public TransactionWrite(long transactionId, string eventStreamId, ClientEvent[] events, bool allowForwarding)
{
TransactionId = transactionId;
@@ -640,6 +688,8 @@ public partial class TransactionWriteCompleted
[ProtoMember(4, IsRequired = true, Name=@"error", DataFormat = DataFormat.Default)]
public readonly string Error;
+ private TransactionWriteCompleted() {}
+
public TransactionWriteCompleted(long transactionId, string eventStreamId, int errorCode, string error)
{
TransactionId = transactionId;
@@ -661,6 +711,8 @@ public partial class TransactionCommit
[ProtoMember(3, IsRequired = true, Name=@"allow_forwarding", DataFormat = DataFormat.Default)]
public readonly bool AllowForwarding;
+ private TransactionCommit() {}
+
public TransactionCommit(long transactionId, string eventStreamId, bool allowForwarding)
{
TransactionId = transactionId;
@@ -681,6 +733,8 @@ public partial class TransactionCommitCompleted
[ProtoMember(3, IsRequired = true, Name=@"error", DataFormat = DataFormat.Default)]
public readonly string Error;
+ private TransactionCommitCompleted() {}
+
public TransactionCommitCompleted(long transactionId, int errorCode, string error)
{
TransactionId = transactionId;
@@ -695,6 +749,8 @@ public partial class SubscribeToStream
[ProtoMember(1, IsRequired = true, Name=@"event_stream_id", DataFormat = DataFormat.Default)]
public readonly string EventStreamId;
+ private SubscribeToStream() {}
+
public SubscribeToStream(string eventStreamId)
{
EventStreamId = eventStreamId;
@@ -707,6 +763,8 @@ public partial class UnsubscribeFromStream
[ProtoMember(1, IsRequired = true, Name=@"event_stream_id", DataFormat = DataFormat.Default)]
public readonly string EventStreamId;
+ private UnsubscribeFromStream() {}
+
public UnsubscribeFromStream(string eventStreamId)
{
EventStreamId = eventStreamId;
@@ -756,6 +814,8 @@ public partial class StreamEventAppeared
[ProtoMember(8, IsRequired = true, Name=@"prepare_position", DataFormat = DataFormat.TwosComplement)]
public readonly long PreparePosition;
+ private StreamEventAppeared() {}
+
public StreamEventAppeared(string eventStreamId, int eventNumber, byte[] eventId, string eventType, byte[] data, byte[] metadata, long commitPosition, long preparePosition)
{
EventStreamId = eventStreamId;
@@ -775,6 +835,8 @@ public partial class SubscriptionDropped
[ProtoMember(1, IsRequired = true, Name=@"event_stream_id", DataFormat = DataFormat.Default)]
public readonly string EventStreamId;
+ private SubscriptionDropped() {}
+
public SubscriptionDropped(string eventStreamId)
{
EventStreamId = eventStreamId;
View
31 src/EventStore/EventStore.ClientAPI/Messages/ClientMessagesExtensions.cs
@@ -1,8 +1,35 @@
-using System.Net;
+// Copyright (c) 2012, Event Store LLP
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// Neither the name of the Event Store LLP nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System.Net;
namespace EventStore.ClientAPI.Messages
{
- public static partial class ClientMessages
+ public static partial class ClientMessage
{
public partial class DeniedToRoute
{
View
26 src/EventStore/EventStore.ClientAPI/Messages/EventLinkPair.cs
@@ -1,26 +0,0 @@
-//using EventStore.ClientAPI.Common.Utils;
-//using ProtoBuf;
-
-//namespace EventStore.ClientAPI.Messages
-//{
-// [ProtoContract]
-// internal class EventLinkPair
-// {
-// [ProtoMember(1)]
-// public EventRecord Event { get; set; }
-
-// [ProtoMember(2)]
-// public EventRecord Link { get; set; }
-
-// public EventLinkPair()
-// {
-// }
-
-// public EventLinkPair(EventRecord @event, EventRecord link)
-// {
-// Ensure.NotNull(@event, "event");
-// Event = @event;
-// Link = link;
-// }
-// }
-//}
View
76 src/EventStore/EventStore.ClientAPI/Messages/EventRecord.cs
@@ -1,76 +0,0 @@
-//// Copyright (c) 2012, Event Store LLP
-//// All rights reserved.
-////
-//// Redistribution and use in source and binary forms, with or without
-//// modification, are permitted provided that the following conditions are
-//// met:
-////
-//// Redistributions of source code must retain the above copyright notice,
-//// this list of conditions and the following disclaimer.
-//// Redistributions in binary form must reproduce the above copyright
-//// notice, this list of conditions and the following disclaimer in the
-//// documentation and/or other materials provided with the distribution.
-//// Neither the name of the Event Store LLP nor the names of its
-//// contributors may be used to endorse or promote products derived from
-//// this software without specific prior written permission
-//// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-//// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-//// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-//// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-//// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-//// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-//// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-//// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-////
-
-//using System;
-//using ProtoBuf;
-
-//namespace EventStore.ClientAPI.Messages
-//{
-// [ProtoContract]
-// internal class EventRecord
-// {
-// [ProtoMember(1)]
-// public readonly int EventNumber;
-
-// [ProtoMember(2)]
-// public readonly long LogPosition;
-
-// [ProtoMember(3)]
-// public readonly byte[] CorrelationId;
-
-// [ProtoMember(4)]
-// public readonly byte[] EventId;
-
-// [ProtoMember(5)]
-// public readonly long TransactionPosition;
-
-// [ProtoMember(6)]
-// public readonly int TransactionOffset;
-
-// [ProtoMember(7)]
-// public readonly string EventStreamId;
-
-// [ProtoMember(8)]
-// public readonly int ExpectedVersion;
-
-// [ProtoMember(9)]
-// public readonly DateTime TimeStamp;
-
-// [ProtoMember(10)]
-// public readonly ushort Flags;
-
-// [ProtoMember(11)]
-// public readonly string EventType;
-
-// [ProtoMember(12)]
-// public readonly byte[] Data;
-
-// [ProtoMember(13)]
-// public readonly byte[] Metadata;
-// }
-//}
View
4 src/EventStore/EventStore.ClientAPI/RecordedEvent.cs
@@ -42,7 +42,7 @@ public class RecordedEvent
public readonly byte[] Data;
public readonly byte[] Metadata;
- internal RecordedEvent(ClientMessages.EventRecord systemRecord)
+ internal RecordedEvent(ClientMessage.EventRecord systemRecord)
{
EventStreamId = systemRecord.EventStreamId;
@@ -55,7 +55,7 @@ internal RecordedEvent(ClientMessages.EventRecord systemRecord)
Metadata = systemRecord.Metadata;
}
- internal RecordedEvent(ClientMessages.StreamEventAppeared streamEvent)
+ internal RecordedEvent(ClientMessage.StreamEventAppeared streamEvent)
{
EventStreamId = streamEvent.EventStreamId;
View
6 src/EventStore/EventStore.Core/EventStore.Core.csproj
@@ -114,7 +114,9 @@
<Compile Include="Index\PTable.cs" />
<Compile Include="Index\PTableHeader.cs" />
<Compile Include="Index\SortedListExtensions.cs" />
+ <Compile Include="Messages\HttpClientMessageDto.cs" />
<Compile Include="Messages\IAmOnlyCaredAboutForTime.cs" />
+ <Compile Include="Messages\TcpClientMessageDtoExtensions.cs" />
<Compile Include="Services\ClientService.cs" />
<Compile Include="Services\RequestManager\Managers\CreateStreamTwoPhaseRequestManager.cs" />
<Compile Include="Services\RequestManager\Managers\DeleteStreamTwoPhaseRequestManager.cs" />
@@ -143,7 +145,7 @@
<Compile Include="TransactionLog\Chunks\TFChunkBulkReader.cs" />
<Compile Include="TransactionLog\Chunks\TFChunkScavenger.cs" />
<Compile Include="Services\Transport\Http\Configure.cs" />
- <Compile Include="Services\Transport\Http\EventConvertion.cs" />
+ <Compile Include="Services\Transport\Http\EventConversion.cs" />
<Compile Include="Services\Transport\Http\Format.cs" />
<Compile Include="Services\Transport\Http\SendToHttpWithConversionEnvelope.cs" />
<Compile Include="TransactionLog\Chunks\ChunkFooter.cs" />
@@ -168,7 +170,7 @@
<Compile Include="TransactionLog\RecordWriteResult.cs" />
<Compile Include="TransactionLog\VersionedPatternFileNamingStrategy.cs" />
<Compile Include="Util\MD5Hash.cs" />
- <Compile Include="Messages\ClientMessageDtos.cs" />
+ <Compile Include="Messages\TcpClientMessageDto.cs" />
<Compile Include="Messages\MonitoringMessage.cs" />
<Compile Include="Messages\ReplicationMessageDtos.cs" />
<Compile Include="Messages\StorageMessage.cs" />
View
1,118 src/EventStore/EventStore.Core/Messages/ClientMessageDtos.cs
@@ -1,1118 +0,0 @@
-// Copyright (c) 2012, Event Store LLP
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// Redistributions of source code must retain the above copyright notice,
-// this list of conditions and the following disclaimer.
-// Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-// Neither the name of the Event Store LLP nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-using System;
-using System.Net;
-using System.Runtime.Serialization;
-using System.Text;
-using EventStore.Common.Utils;
-using EventStore.Core.Services.Storage.ReaderIndex;
-using EventStore.Core.TransactionLog.LogRecords;
-using ProtoBuf;
-
-namespace EventStore.Core.Messages
-{
- public static class ClientMessageDto
- {
- #region TCP DTO
- [ProtoContract]
- public class DeniedToRoute
- {
- [ProtoMember(1)]
- public string ExternalTcpAddress { get; set; }
-
- [ProtoMember(2)]
- public int ExternalTcpPort { get; set; }
-
- [ProtoMember(3)]
- public string ExternalHttpAddress { get; set; }
-
- [ProtoMember(4)]
- public int ExternalHttpPort { get; set; }
-
- public DeniedToRoute()
- {
- }
-
- public DeniedToRoute(IPEndPoint externalTcpEndPoint, IPEndPoint externalHttpEndPoint)
- {
- ExternalTcpAddress = externalTcpEndPoint.Address.ToString();
- ExternalTcpPort = externalTcpEndPoint.Port;
-
- ExternalHttpAddress = externalHttpEndPoint.Address.ToString();
- ExternalHttpPort = externalHttpEndPoint.Port;
- }
- }
-
- [ProtoContract]
- public class CreateStream
- {
- [ProtoMember(1)]
- public string EventStreamId { get; set; }
-
- [ProtoMember(2, IsRequired = false)]
- public byte[] Metadata { get; set; }
-
- [ProtoMember(3)]
- public bool AllowForwarding { get; set; }
-
- public CreateStream()
- {
- }
-
- public CreateStream(string eventStreamId, byte[] metadata, bool allowForwarding = true)
- {
- Ensure.NotNull(eventStreamId, "streamId");
-
- EventStreamId = eventStreamId;
- Metadata = metadata;
- AllowForwarding = allowForwarding;
- }
- }
-
- [ProtoContract]
- public class CreateStreamCompleted
- {
- [ProtoMember(1)]
- public string EventStreamId { get; set; }
-
- [ProtoMember(2)]
- public int ErrorCode { get; set; }
-
- [ProtoMember(3)]
- public string Error { get; set; }
-
- public CreateStreamCompleted()
- {
- }
-
- public CreateStreamCompleted(string eventStreamId, OperationErrorCode errorCode, string error)
- {
- EventStreamId = eventStreamId;
- ErrorCode = (int)errorCode;
- Error = error;
- }
- }
-
- [ProtoContract]
- public class ClientEvent
- {
- [ProtoMember(1)]
- public byte[] EventId { get; set; }
-
- [ProtoMember(2, IsRequired = false)]
- public string EventType { get; set; }
-
- [ProtoMember(3)]
- public byte[] Data { get; set; }
-
- [ProtoMember(4, IsRequired = false)]
- public byte[] Metadata { get; set; }
-
- public ClientEvent()
- {
- }
-
- public ClientEvent(Guid eventId, string eventType, byte[] data, byte[] metadata)
- {
- EventId = eventId.ToByteArray();
- EventType = eventType;
- Data = data;
- Metadata = metadata;
- }
-
- public ClientEvent(Data.Event evnt)
- {
- EventId = evnt.EventId.ToByteArray();
- EventType = evnt.EventType;
- Data = evnt.Data;
- Metadata = evnt.Metadata;
- }
- }
-
- [ProtoContract]
- public class WriteEvents
- {
- [ProtoMember(1)]
- public string EventStreamId { get; set; }
-
- [ProtoMember(2)]
- public int ExpectedVersion { get; set; }
-
- [ProtoMember(3)]
- public ClientEvent[] Events { get; set; }
-
- [ProtoMember(4)]
- public bool AllowForwarding { get; set; }
-
- public WriteEvents()
- {
- }
-
- public WriteEvents(string eventStreamId,
- int expectedVersion,
- ClientEvent[] events,
- bool allowForwarding = true)
- {
- Ensure.NotNull(events, "events");
- Ensure.Positive(events.Length, "events.Length");
-
- EventStreamId = eventStreamId;
- ExpectedVersion = expectedVersion;
- Events = events;
- AllowForwarding = allowForwarding;
- }
- }
-
- [ProtoContract]
- public class WriteEventsCompleted
- {
- [ProtoMember(1)]
- public string EventStreamId { get; set; }
-
- [ProtoMember(2)]
- public int ErrorCode { get; set; }
-
- [ProtoMember(3)]
- public string Error { get; set; }
-
- [ProtoMember(4)]
- public int EventNumber { get; set; }
-
- public WriteEventsCompleted()
- {
- }
-
- public WriteEventsCompleted(string eventStreamId, OperationErrorCode errorCode, string error, int eventNumber)
- {
- EventStreamId = eventStreamId;
- ErrorCode = (int) errorCode;
- Error = error;
- EventNumber = eventNumber;
- }
- }
-
- [ProtoContract]
- public class DeleteStream
- {
- [ProtoMember(1)]
- public string EventStreamId { get; set; }
-
- [ProtoMember(2)]
- public int ExpectedVersion { get; set; }
-
- [ProtoMember(3)]
- public bool AllowForwarding { get; set; }
-
- public DeleteStream()
- {
- }
-
- public DeleteStream(string eventStreamId,
- int expectedVersion,
- bool allowForwarding = true)
- {
- Ensure.NotNull(eventStreamId, "streamId");
-
- EventStreamId = eventStreamId;
- ExpectedVersion = expectedVersion;
- AllowForwarding = allowForwarding;
- }
- }
-
- [ProtoContract]
- public class DeleteStreamCompleted
- {
- [ProtoMember(1)]
- public string EventStreamId { get; set; }
-
- [ProtoMember(2)]
- public int ErrorCode { get; set; }
-
- [ProtoMember(3)]
- public string Error { get; set; }
-
- public DeleteStreamCompleted()
- {
- }
-
- public DeleteStreamCompleted(string eventStreamId, OperationErrorCode errorCode, string error)
- {
- EventStreamId = eventStreamId;
- ErrorCode = (int)errorCode;
- Error = error;
- }
- }
-
- [ProtoContract]
- public class ReadEvent
- {
- [ProtoMember(1)]
- public string EventStreamId { get; set; }
-
- [ProtoMember(2)]
- public int EventNumber { get; set; }
-
- [ProtoMember(3)]
- public bool ResolveLinktos { get; set; }
-
- public ReadEvent()
- {
- }
-
- public ReadEvent(string eventStreamId, int eventNumber, bool resolveLinkTos)
- {
- EventStreamId = eventStreamId;
- EventNumber = eventNumber;
- ResolveLinktos = resolveLinkTos;
- }
- }
-
- [ProtoContract]
- public class ReadEventCompleted
- {
- [ProtoMember(1)]
- public string EventStreamId { get; set; }
-
- [ProtoMember(2)]
- public int EventNumber { get; set; }
-
- [ProtoMember(3)]
- public int Result { get; set; }
-
- [ProtoMember(4)]
- public string EventType { get; set; }
-
- [ProtoMember(5)]
- public byte[] Data { get; set; }
-
- [ProtoMember(6)]
- public byte[] Metadata { get; set; }
-
- [ProtoMember(7)]
- public long LogPosition { get; set; }
-
- public ReadEventCompleted()
- {
- }
-
- public ReadEventCompleted(string eventStreamId,
- int eventNumber,
- SingleReadResult result,
- string eventType,
- byte[] data,
- byte[] metadata, long logPosition)
- {
- Ensure.NotNullOrEmpty(eventStreamId, "streamId");
- Ensure.Nonnegative(eventNumber, "eventNumber");
- if (result == SingleReadResult.Success)
- Ensure.NotNull(data, "data");
-
- EventStreamId = eventStreamId;
- EventNumber = eventNumber;
- Result = (int)result;
- EventType = eventType;
- Data = data;
- Metadata = metadata;
- LogPosition = logPosition;
- }
- }
-
- [ProtoContract]
- public class ReadStreamEventsForward
- {
- [ProtoMember(1)]
- public string EventStreamId { get; set; }
-
- [ProtoMember(2)]
- public int StartIndex { get; set; }
-
- [ProtoMember(3)]
- public int MaxCount { get; set; }
-
- [ProtoMember(4)]
- public bool ResolveLinkTos { get; set; }
-
- [ProtoMember(5)]
- public bool ReturnLastEventNumber { get; set; }
-
- public ReadStreamEventsForward()
- {
- }
-
- public ReadStreamEventsForward(string eventStreamId, int startIndex, int maxCount, bool resolveLinkTos)
- {
- EventStreamId = eventStreamId;
- StartIndex = startIndex;
- MaxCount = maxCount;
- ResolveLinkTos = resolveLinkTos;
- }
- }
-
- [ProtoContract]
- public class ReadStreamEventsForwardCompleted
- {
- [ProtoMember(1)]
- public string EventStreamId { get; set; }
-
- [ProtoMember(2)]
- public EventLinkPair[] Events { get; set; }
-
- [ProtoMember(3)]
- public int Result { get; set; }
-
- [ProtoMember(4)]
- public long? LastCommitPosition { get; set; }
-
- [ProtoMember(5)]
- public int? LastEventNumber { get; set; }
-
- public ReadStreamEventsForwardCompleted()
- {
- }
-
- public ReadStreamEventsForwardCompleted(string eventStreamId,
- EventLinkPair[] events,
- RangeReadResult result,
- long? lastCommitPosition,
- int? lastEventNumber)
- {
- Ensure.NotNullOrEmpty(eventStreamId, "streamId");
-
- EventStreamId = eventStreamId;
- Events = events;
- Result = (int)result;
- LastCommitPosition = lastCommitPosition;
- LastEventNumber = lastEventNumber;
- }
- }
-
- [ProtoContract]
- public class ReadStreamEventsBackward
- {
- [ProtoMember(1)]
- public string EventStreamId { get; set; }
-
- [ProtoMember(2)]
- public int StartIndex { get; set; }
-
- [ProtoMember(3)]
- public int MaxCount { get; set; }
-
- [ProtoMember(4)]
- public bool ResolveLinkTos { get; set; }
-
- public ReadStreamEventsBackward()
- {
- }
-
- public ReadStreamEventsBackward(string eventStreamId, int startIndex, int maxCount, bool resolveLinkTos)
- {
- EventStreamId = eventStreamId;
- StartIndex = startIndex;
- MaxCount = maxCount;
- ResolveLinkTos = resolveLinkTos;
- }
- }
-
- [ProtoContract]
- public class ReadStreamEventsBackwardCompleted
- {
- [ProtoMember(1)]
- public string EventStreamId { get; set; }
-
- [ProtoMember(2)]
- public EventLinkPair[] Events { get; set; }
-
- [ProtoMember(3)]
- public int Result { get; set; }
-
- [ProtoMember(4)]
- public long? LastCommitPosition { get; set; }
-
- public ReadStreamEventsBackwardCompleted()
- {
- }
-
- public ReadStreamEventsBackwardCompleted(string eventStreamId,
- EventLinkPair[] events,
- RangeReadResult result,
- long? lastCommitPosition)
- {
- Ensure.NotNullOrEmpty(eventStreamId, "streamId");
-
- EventStreamId = eventStreamId;
- Events = events;
- Result = (int)result;
- LastCommitPosition = lastCommitPosition;
- }
- }
-
- [ProtoContract]
- public class EventLinkPair
- {
- [ProtoMember(1)]
- public EventRecord Event { get; set; }
-
- [ProtoMember(2)]
- public EventRecord Link { get; set; }
-
- public EventLinkPair()
- {
- }
-
- public EventLinkPair(Data.EventRecord @event, Data.EventRecord link)
- {
- Ensure.NotNull(@event, "event");
- Event = new EventRecord(@event);
- Link = link == null ? null : new EventRecord(link);
- }
- }
-
- [ProtoContract]
- public class EventRecord
- {
- [ProtoMember(1)]
- public readonly int EventNumber;
-
- [ProtoMember(2)]
- public readonly long LogPosition;
-
- [ProtoMember(3)]
- public readonly byte[] CorrelationId;
-
- [ProtoMember(4)]
- public readonly byte[] EventId;
-
- [ProtoMember(5)]
- public readonly long TransactionPosition;
-
- [ProtoMember(6)]
- public readonly int TransactionOffset;
-
- [ProtoMember(7)]
- public readonly string EventStreamId;
-
- [ProtoMember(8)]
- public readonly int ExpectedVersion;
-
- [ProtoMember(9)]
- public readonly DateTime TimeStamp;
-
- [ProtoMember(10)]
- public readonly ushort Flags;
-
- [ProtoMember(11)]
- public readonly string EventType;
-
- [ProtoMember(12)]
- public readonly byte[] Data;
-
- [ProtoMember(13)]
- public readonly byte[] Metadata;
-
- public EventRecord()
- {
- }
-
- public EventRecord(Data.EventRecord eventRecord)
- {
- EventNumber = eventRecord.EventNumber;
- LogPosition = eventRecord.LogPosition;
- CorrelationId = eventRecord.CorrelationId.ToByteArray();
- EventId = eventRecord.EventId.ToByteArray();
- TransactionPosition = eventRecord.TransactionPosition;
- TransactionOffset = eventRecord.TransactionOffset;
- EventStreamId = eventRecord.EventStreamId;
- ExpectedVersion = eventRecord.ExpectedVersion;
- TimeStamp = eventRecord.TimeStamp;
- Flags = (ushort)eventRecord.Flags;
- EventType = eventRecord.EventType;
- Data = eventRecord.Data;
- Metadata = eventRecord.Metadata;
- }
- }
-
- [ProtoContract]
- public class ReadAllEventsForward
- {
- [ProtoMember(1)]
- public long CommitPosition { get; set; }
-
- [ProtoMember(2)]
- public long PreparePosition { get; set; }
-
- [ProtoMember(3)]
- public int MaxCount { get; set; }
-
- [ProtoMember(4)]
- public bool ResolveLinktos { get; set; }
-
- public ReadAllEventsForward()
- {
- }
-
- public ReadAllEventsForward(long commitPosition, long preparePosition, int maxCount, bool resolveLinktos)
- {
- CommitPosition = commitPosition;
- PreparePosition = preparePosition;
- MaxCount = maxCount;
- ResolveLinktos = resolveLinktos;
- }
- }
-
- [ProtoContract]
- public class ReadAllEventsForwardCompleted
- {
- [ProtoMember(1)]
- public long CommitPosition { get; set; }
-
- [ProtoMember(2)]
- public long PreparePosition { get; set; }
-
- [ProtoMember(3)]
- public EventLinkPair[] Events { get; set; }
-
- [ProtoMember(4)]
- public long NextCommitPosition { get; set; }
-
- [ProtoMember(5)]
- public long NextPreparePosition { get; set; }
-
- public ReadAllEventsForwardCompleted()
- {
- }
-
- public ReadAllEventsForwardCompleted(long commitPosition,
- long preparePosition,
- EventLinkPair[] events,
- long nextCommitPosition,
- long nextPreparePosition)
- {
- CommitPosition = commitPosition;
- PreparePosition = preparePosition;
- Events = events;
- NextCommitPosition = nextCommitPosition;
- NextPreparePosition = nextPreparePosition;
- }
- }
-
- [ProtoContract]
- public class ReadAllEventsBackward
- {
- [ProtoMember(1)]
- public long CommitPosition { get; set; }
-
- [ProtoMember(2)]
- public long PreparePosition { get; set; }
-
- [ProtoMember(3)]
- public int MaxCount { get; set; }
-
- [ProtoMember(4)]
- public bool ResolveLinkTos { get; set; }
-
- public ReadAllEventsBackward()
- {
- }
-
- public ReadAllEventsBackward(long commitPosition, long preparePosition, int maxCount, bool resolveLinktos)
- {
- CommitPosition = commitPosition;
- PreparePosition = preparePosition;
- MaxCount = maxCount;
- ResolveLinkTos = resolveLinktos;
- }
- }
-
- [ProtoContract]
- public class ReadAllEventsBackwardCompleted
- {
- [ProtoMember(1)]
- public long CommitPosition { get; set; }
-
- [ProtoMember(2)]
- public long PreparePosition { get; set; }
-
- [ProtoMember(3)]
- public EventLinkPair[] Events { get; set; }
-
- [ProtoMember(4)]
- public long NextCommitPosition { get; set; }
-
- [ProtoMember(5)]
- public long NextPreparePosition { get; set; }
-
- public ReadAllEventsBackwardCompleted()
- {
- }
-
- public ReadAllEventsBackwardCompleted(long commitPosition,
- long preparePosition,
- EventLinkPair[] events,
- long nextCommitPosition,
- long nextPreparePosition)
- {
- CommitPosition = commitPosition;
- PreparePosition = preparePosition;
- Events = events;
- NextCommitPosition = nextCommitPosition;
- NextPreparePosition = nextPreparePosition;
- }
- }
-
- [ProtoContract]
- public class TransactionStart
- {
- [ProtoMember(1)]
- public string EventStreamId { get; set; }
-
- [ProtoMember(2)]
- public int ExpectedVersion { get; set; }
-
- [ProtoMember(3)]
- public bool AllowForwarding { get; set; }
-
- public TransactionStart()
- {
- }
-
- public TransactionStart(string eventStreamId,
- int expectedVersion,
- bool allowForwarding = true)
- {
- EventStreamId = eventStreamId;
- ExpectedVersion = expectedVersion;
- AllowForwarding = allowForwarding;
- }
- }
-
- [ProtoContract]
- public class TransactionStartCompleted
- {
- [ProtoMember(1)]
- public long TransactionId { get; set; }
-
- [ProtoMember(2)]
- public string EventStreamId { get; set; }
-
- [ProtoMember(3)]
- public int ErrorCode { get; set; }
-
- [ProtoMember(4)]
- public string Error { get; set; }
-
- public TransactionStartCompleted()
- {
- }
-
- public TransactionStartCompleted(long transactionId,
- string eventStreamId,
- OperationErrorCode errorCode,
- string error)
- {
- TransactionId = transactionId;
- EventStreamId = eventStreamId;
- ErrorCode = (int) errorCode;
- Error = error;
- }
- }
-
- [ProtoContract]
- public class TransactionWrite
- {
- [ProtoMember(1)]
- public long TransactionId { get; set; }
-
- [ProtoMember(2)]
- public string EventStreamId { get; set; }
-
- [ProtoMember(3)]
- public ClientEvent[] Events { get; set; }
-
- [ProtoMember(4)]
- public bool AllowForwarding { get; set; }
-
- public TransactionWrite()
- {
- }
-
- public TransactionWrite(long transactionId,
- string eventStreamId,
- ClientEvent[] events,
- bool allowForwarding = true)
- {
- TransactionId = transactionId;
- EventStreamId = eventStreamId;
- Events = events;
- AllowForwarding = allowForwarding;
- }
- }
-
- [ProtoContract]
- public class TransactionWriteCompleted
- {
- [ProtoMember(1)]
- public long TransactionId { get; set; }
-
- [ProtoMember(2)]
- public string EventStreamId { get; set; }
-
- [ProtoMember(3)]
- public int ErrorCode { get; set; }
-
- [ProtoMember(4)]
- public string Error { get; set; }
-
- public TransactionWriteCompleted()
- {
- }
-
- public TransactionWriteCompleted(long transactionId, string eventStreamId, OperationErrorCode errorCode, string error)
- {
- TransactionId = transactionId;
- EventStreamId = eventStreamId;
- ErrorCode = (int) errorCode;
- Error = error;
- }
- }
-
- [ProtoContract]
- public class TransactionCommit
- {
- [ProtoMember(1)]
- public long TransactionId { get; set; }
-
- [ProtoMember(2)]
- public string EventStreamId { get; set; }
-
- [ProtoMember(3)]
- public bool AllowForwarding { get; set; }
-
- public TransactionCommit()
- {
- }
-
- public TransactionCommit(long transactionId,
- string eventStreamId,
- bool allowForwarding = true)
- {
- TransactionId = transactionId;
- EventStreamId = eventStreamId;
- AllowForwarding = allowForwarding;
- }
- }
-
- [ProtoContract]
- public class TransactionCommitCompleted
- {
- [ProtoMember(1)]
- public long TransactionId;
-
- [ProtoMember(2)]
- public int ErrorCode;
-
- [ProtoMember(3)]
- public string Error;
-
- public TransactionCommitCompleted()
- {
- }
-
- public TransactionCommitCompleted(long transactionId, OperationErrorCode errorCode, string error)
- {
- TransactionId = transactionId;
- ErrorCode = (int) errorCode;
- Error = error;
- }
- }
-
- [ProtoContract]
- public class SubscribeToStream
- {
- [ProtoMember(1)]
- public string EventStreamId { get; set; }
-
- public SubscribeToStream()
- {
- }
-
- public SubscribeToStream(string eventStreamId)
- {
- EventStreamId = eventStreamId;
- }
- }
-
- [ProtoContract]
- public class UnsubscribeFromStream
- {
- [ProtoMember(1)]
- public string EventStreamId { get; set; }
-
- public UnsubscribeFromStream()
- {
- }
-
- public UnsubscribeFromStream(string eventStreamId)
- {
- EventStreamId = eventStreamId;
- }
- }
-
- [ProtoContract]
- public class SubscribeToAllStreams
- {
- }
-
- [ProtoContract]
- public class UnsubscribeFromAllStreams
- {
- }
-
- [ProtoContract]
- public class StreamEventAppeared
- {
- [ProtoMember(1)]
- public string EventStreamId { get; set; }
-
- [ProtoMember(2)]
- public int EventNumber { get; set; }
-
- [ProtoMember(3)]
- public byte[] EventId { get; set; }
-
- [ProtoMember(4)]
- public string EventType { get; set; }
-
- [ProtoMember(5)]
- public byte[] Data { get; set; }
-
- [ProtoMember(6)]
- public byte[] Metadata { get; set; }
-
- [ProtoMember(7)]
- public long CommitPosition { get; set; }
-
- [ProtoMember(8)]
- public long PreparePosition { get; set; }
-
- public StreamEventAppeared()
- {
- }
-
- public StreamEventAppeared(int eventNumber, PrepareLogRecord @event, long commitPosition)
- {
- EventStreamId = @event.EventStreamId;
- EventNumber = eventNumber;
- EventId = @event.EventId.ToByteArray();
- EventType = @event.EventType;
- Data = @event.Data;
- Metadata = @event.Metadata;
- CommitPosition = commitPosition;
- PreparePosition = @event.LogPosition;
- }
- }
-
- [ProtoContract]
- public class SubscriptionDropped
- {
- [ProtoMember(1)]
- public string EventStreamId { get; set; }
-
- public SubscriptionDropped()
- {
- }
-
- public SubscriptionDropped(string eventStreamId)
- {
- EventStreamId = eventStreamId;
- }
- }
-
- [ProtoContract]
- public class SubscriptionToAllDropped
- {
- }
- #endregion
-
- #region HTTP DTO
-
- [DataContract(Name = "event", Namespace = "")]
- public class ClientEventText
- {
- [DataMember]
- public Guid EventId { get; set; }
- [DataMember]
- public string EventType { get; set; }
-
- [DataMember]
- public object Data { get; set; }
- [DataMember]
- public object Metadata { get; set; }
-
- public ClientEventText()
- {
- }
-
- public ClientEventText(Guid eventId, string eventType, object data, object metadata)
- {
- Ensure.NotEmptyGuid(eventId, "eventId");
- Ensure.NotNull(data, "data");
-
- EventId = eventId;
- EventType = eventType;
-
- Data = data;
- Metadata = metadata;
- }
-
- public ClientEventText(Guid eventId, string eventType, byte[] data, byte[] metaData)
- {