Update proto
This commit is contained in:
parent
18e35c56f9
commit
990351738c
14
index.d.ts
vendored
14
index.d.ts
vendored
|
@ -41,7 +41,7 @@ export class WrongExpectedVersionError {
|
||||||
readonly action: string;
|
readonly action: string;
|
||||||
readonly message: string;
|
readonly message: string;
|
||||||
readonly stream?: string;
|
readonly stream?: string;
|
||||||
readonly expectedVersion?: number;
|
readonly expectedVersion?: Long;
|
||||||
readonly transactionId?: Long;
|
readonly transactionId?: Long;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ export class FileLogger implements Logger {
|
||||||
//
|
//
|
||||||
|
|
||||||
export interface WriteResult {
|
export interface WriteResult {
|
||||||
readonly nextExpectedVersion: number;
|
readonly nextExpectedVersion: Long;
|
||||||
readonly logPosition: Position;
|
readonly logPosition: Position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ export interface EventStorePersistentSubscription {
|
||||||
export interface RawStreamMetadataResult {
|
export interface RawStreamMetadataResult {
|
||||||
readonly stream: string;
|
readonly stream: string;
|
||||||
readonly isStreamDeleted: boolean;
|
readonly isStreamDeleted: boolean;
|
||||||
readonly metastreamVersion: number;
|
readonly metastreamVersion: Long;
|
||||||
readonly streamMetadata: any;
|
readonly streamMetadata: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,9 +249,9 @@ export interface EventStoreNodeConnection {
|
||||||
connect(): Promise<void>;
|
connect(): Promise<void>;
|
||||||
close(): void;
|
close(): void;
|
||||||
// write actions
|
// write actions
|
||||||
deleteStream(stream: string, expectedVersion: number, hardDelete?: boolean, userCredentials?: UserCredentials): Promise<DeleteResult>;
|
deleteStream(stream: string, expectedVersion: Long|number, hardDelete?: boolean, userCredentials?: UserCredentials): Promise<DeleteResult>;
|
||||||
appendToStream(stream: string, expectedVersion: number, eventOrEvents: EventData | EventData[], userCredentials?: UserCredentials): Promise<WriteResult>;
|
appendToStream(stream: string, expectedVersion: Long|number, eventOrEvents: EventData | EventData[], userCredentials?: UserCredentials): Promise<WriteResult>;
|
||||||
startTransaction(stream: string, expectedVersion: number, userCredentials?: UserCredentials): Promise<EventStoreTransaction>;
|
startTransaction(stream: string, expectedVersion: Long|number, userCredentials?: UserCredentials): Promise<EventStoreTransaction>;
|
||||||
continueTransaction(transactionId: number, userCredentials?: UserCredentials): EventStoreTransaction;
|
continueTransaction(transactionId: number, userCredentials?: UserCredentials): EventStoreTransaction;
|
||||||
// read actions
|
// read actions
|
||||||
readEvent(stream: string, eventNumber: number, resolveLinkTos?: boolean, userCredentials?: UserCredentials): Promise<EventReadResult>;
|
readEvent(stream: string, eventNumber: number, resolveLinkTos?: boolean, userCredentials?: UserCredentials): Promise<EventReadResult>;
|
||||||
|
@ -270,7 +270,7 @@ export interface EventStoreNodeConnection {
|
||||||
deletePersistentSubscription(stream: string, groupName: string, userCredentials?: PersistentSubscriptionSettings): Promise<PersistentSubscriptionDeleteResult>
|
deletePersistentSubscription(stream: string, groupName: string, userCredentials?: PersistentSubscriptionSettings): Promise<PersistentSubscriptionDeleteResult>
|
||||||
connectToPersistentSubscription(stream: string, groupName: string, eventAppeared: EventAppearedCallback<EventStorePersistentSubscription>, subscriptionDropped?: SubscriptionDroppedCallback<EventStorePersistentSubscription>, userCredentials?: UserCredentials, bufferSize?: number, autoAck?: boolean): Promise<EventStorePersistentSubscription>;
|
connectToPersistentSubscription(stream: string, groupName: string, eventAppeared: EventAppearedCallback<EventStorePersistentSubscription>, subscriptionDropped?: SubscriptionDroppedCallback<EventStorePersistentSubscription>, userCredentials?: UserCredentials, bufferSize?: number, autoAck?: boolean): Promise<EventStorePersistentSubscription>;
|
||||||
// metadata actions
|
// metadata actions
|
||||||
setStreamMetadataRaw(stream: string, expectedMetastreamVersion: number, metadata: any, userCredentials?: UserCredentials): Promise<WriteResult>;
|
setStreamMetadataRaw(stream: string, expectedMetastreamVersion: Long|number, metadata: any, userCredentials?: UserCredentials): Promise<WriteResult>;
|
||||||
getStreamMetadataRaw(stream: string, userCredentials?: UserCredentials): Promise<RawStreamMetadataResult>;
|
getStreamMetadataRaw(stream: string, userCredentials?: UserCredentials): Promise<RawStreamMetadataResult>;
|
||||||
|
|
||||||
on(event: "connected" | "disconnected" | "reconnecting" | "closed" | "error" | "heartbeatInfo", listener: (arg: Error | string | TcpEndPoint | HeartbeatInfo) => void): this;
|
on(event: "connected" | "disconnected" | "reconnecting" | "closed" | "error" | "heartbeatInfo", listener: (arg: Error | string | TcpEndPoint | HeartbeatInfo) => void): this;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
var Long = require('long');
|
||||||
|
|
||||||
module.exports.notNullOrEmpty = function(value, name) {
|
module.exports.notNullOrEmpty = function(value, name) {
|
||||||
if (value === null)
|
if (value === null)
|
||||||
throw new TypeError(name + " should not be null.");
|
throw new TypeError(name + " should not be null.");
|
||||||
|
@ -10,11 +12,19 @@ module.exports.notNull = function(value, name) {
|
||||||
throw new TypeError(name + " should not be null.");
|
throw new TypeError(name + " should not be null.");
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.isInteger = function(value, name) {
|
module.exports.isInteger = function isInteger(value, name) {
|
||||||
if (typeof value !== 'number' || value % 1 !== 0)
|
if (typeof value !== 'number' || value % 1 !== 0)
|
||||||
throw new TypeError(name + " should be an integer.");
|
throw new TypeError(name + " should be an integer.");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports.isLongOrInteger = function(value, name) {
|
||||||
|
if (typeof value === 'number') {
|
||||||
|
return isInteger(value, name);
|
||||||
|
} else if (!Long.isLong(value)) {
|
||||||
|
throw new TypeError(name + " should be a Long|number.");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
module.exports.isArrayOf = function(expectedType, value, name) {
|
module.exports.isArrayOf = function(expectedType, value, name) {
|
||||||
if (!Array.isArray(value))
|
if (!Array.isArray(value))
|
||||||
throw new TypeError(name + " should be an array.");
|
throw new TypeError(name + " should be an array.");
|
||||||
|
|
|
@ -9,6 +9,7 @@ var SubscriptionsManager = require('./subscriptionsManager');
|
||||||
var VolatileSubscriptionOperation = require('../clientOperations/volatileSubscriptionOperation');
|
var VolatileSubscriptionOperation = require('../clientOperations/volatileSubscriptionOperation');
|
||||||
var ConnectToPersistentSubscriptionOperation = require('../clientOperations/connectToPersistentSubscriptionOperation');
|
var ConnectToPersistentSubscriptionOperation = require('../clientOperations/connectToPersistentSubscriptionOperation');
|
||||||
var messages = require('./messages');
|
var messages = require('./messages');
|
||||||
|
var ClientMessage = require('../messages/clientMessage');
|
||||||
|
|
||||||
var TcpPackage = require('../systemData/tcpPackage');
|
var TcpPackage = require('../systemData/tcpPackage');
|
||||||
var TcpCommand = require('../systemData/tcpCommand');
|
var TcpCommand = require('../systemData/tcpCommand');
|
||||||
|
@ -28,12 +29,14 @@ const ConnectingPhase = {
|
||||||
EndPointDiscovery: 'endpointDiscovery',
|
EndPointDiscovery: 'endpointDiscovery',
|
||||||
ConnectionEstablishing: 'connectionEstablishing',
|
ConnectionEstablishing: 'connectionEstablishing',
|
||||||
Authentication: 'authentication',
|
Authentication: 'authentication',
|
||||||
|
Identification: 'identification',
|
||||||
Connected: 'connected'
|
Connected: 'connected'
|
||||||
};
|
};
|
||||||
|
|
||||||
const TimerPeriod = 200;
|
const TimerPeriod = 200;
|
||||||
const TimerTickMessage = new messages.TimerTickMessage();
|
const TimerTickMessage = new messages.TimerTickMessage();
|
||||||
const EmptyGuid = '00000000-0000-0000-0000-000000000000';
|
const EmptyGuid = '00000000-0000-0000-0000-000000000000';
|
||||||
|
const ClientVersion = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
@ -391,10 +394,20 @@ EventStoreConnectionLogicHandler.prototype._tcpConnectionEstablished = function(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this._goToConnectedState();
|
this._goToIdentifiedState();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
EventStoreConnectionLogicHandler.prototype._goToIdentifiedState = function() {
|
||||||
|
this._connectingPhase = ConnectingPhase.Identification;
|
||||||
|
this._identityInfo = {
|
||||||
|
correlationId: uuid.v4(),
|
||||||
|
timeStamp: Date.now()
|
||||||
|
};
|
||||||
|
var dto = new ClientMessage.IdentifyClient({version: ClientVersion, connectionName: this._esConnection.connectionName});
|
||||||
|
this._connection.enqueueSend(new TcpPackage(TcpCommand.IdentifyClient, this._identityInfo.correlationId, null, null, dto.serialize()))
|
||||||
|
};
|
||||||
|
|
||||||
EventStoreConnectionLogicHandler.prototype._goToConnectedState = function() {
|
EventStoreConnectionLogicHandler.prototype._goToConnectedState = function() {
|
||||||
this._state = ConnectionState.Connected;
|
this._state = ConnectionState.Connected;
|
||||||
this._connectingPhase = ConnectingPhase.Connected;
|
this._connectingPhase = ConnectingPhase.Connected;
|
||||||
|
@ -498,6 +511,16 @@ EventStoreConnectionLogicHandler.prototype._handleTcpPackage = function(connecti
|
||||||
if (pkg.command === TcpCommand.NotAuthenticated)
|
if (pkg.command === TcpCommand.NotAuthenticated)
|
||||||
this.emit('authenticationFailed', "Not authenticated");
|
this.emit('authenticationFailed', "Not authenticated");
|
||||||
|
|
||||||
|
this._goToIdentifiedState();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pkg.command === TcpCommand.ClientIdentified)
|
||||||
|
{
|
||||||
|
if (this._state === ConnectionState.Connecting
|
||||||
|
&& this._identityInfo.correlationId === pkg.correlationId)
|
||||||
|
{
|
||||||
this._goToConnectedState();
|
this._goToConnectedState();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -617,8 +640,12 @@ EventStoreConnectionLogicHandler.prototype._timerTick = function() {
|
||||||
else if (this._connectingPhase === ConnectingPhase.Authentication && (Date.now() - this._authInfo.timeStamp) >= this._settings.operationTimeout)
|
else if (this._connectingPhase === ConnectingPhase.Authentication && (Date.now() - this._authInfo.timeStamp) >= this._settings.operationTimeout)
|
||||||
{
|
{
|
||||||
this.emit('authenticationFailed', "Authentication timed out.");
|
this.emit('authenticationFailed', "Authentication timed out.");
|
||||||
|
if (this._clientVersion === 1) {
|
||||||
|
this._goToIdentifiedState();
|
||||||
|
} else {
|
||||||
this._goToConnectedState();
|
this._goToConnectedState();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (this._connectingPhase === ConnectingPhase.Authentication || this._connectingPhase === ConnectingPhase.Connected)
|
else if (this._connectingPhase === ConnectingPhase.Authentication || this._connectingPhase === ConnectingPhase.Connected)
|
||||||
this._manageHeartbeats();
|
this._manageHeartbeats();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -100,15 +100,16 @@ EventStoreNodeConnection.prototype.close = function() {
|
||||||
* Delete a stream (async)
|
* Delete a stream (async)
|
||||||
* @public
|
* @public
|
||||||
* @param {string} stream
|
* @param {string} stream
|
||||||
* @param {number} expectedVersion
|
* @param {Long|number} expectedVersion
|
||||||
* @param {boolean} [hardDelete]
|
* @param {boolean} [hardDelete]
|
||||||
* @param {UserCredentials} [userCredentials]
|
* @param {UserCredentials} [userCredentials]
|
||||||
* @returns {Promise.<DeleteResult>}
|
* @returns {Promise.<DeleteResult>}
|
||||||
*/
|
*/
|
||||||
EventStoreNodeConnection.prototype.deleteStream = function(stream, expectedVersion, hardDelete, userCredentials) {
|
EventStoreNodeConnection.prototype.deleteStream = function(stream, expectedVersion, hardDelete, userCredentials) {
|
||||||
ensure.notNullOrEmpty(stream, "stream");
|
ensure.notNullOrEmpty(stream, "stream");
|
||||||
ensure.isInteger(expectedVersion, "expectedVersion");
|
ensure.isLongOrInteger(expectedVersion, "expectedVersion");
|
||||||
hardDelete = !!hardDelete;
|
expectedVersion = Long.fromValue(expectedVersion);
|
||||||
|
hardDelete = Boolean(hardDelete);
|
||||||
userCredentials = userCredentials || null;
|
userCredentials = userCredentials || null;
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
@ -128,14 +129,15 @@ EventStoreNodeConnection.prototype.deleteStream = function(stream, expectedVersi
|
||||||
* Append events to a stream (async)
|
* Append events to a stream (async)
|
||||||
* @public
|
* @public
|
||||||
* @param {string} stream The name of the stream to which to append.
|
* @param {string} stream The name of the stream to which to append.
|
||||||
* @param {number} expectedVersion The version at which we currently expect the stream to be in order that an optimistic concurrency check can be performed.
|
* @param {Long|number} expectedVersion The version at which we currently expect the stream to be in order that an optimistic concurrency check can be performed.
|
||||||
* @param {EventData[]|EventData} events The event(s) to append.
|
* @param {EventData[]|EventData} events The event(s) to append.
|
||||||
* @param {UserCredentials} [userCredentials] User credentials
|
* @param {UserCredentials} [userCredentials] User credentials
|
||||||
* @returns {Promise.<WriteResult>}
|
* @returns {Promise.<WriteResult>}
|
||||||
*/
|
*/
|
||||||
EventStoreNodeConnection.prototype.appendToStream = function(stream, expectedVersion, events, userCredentials) {
|
EventStoreNodeConnection.prototype.appendToStream = function(stream, expectedVersion, events, userCredentials) {
|
||||||
ensure.notNullOrEmpty(stream, "stream");
|
ensure.notNullOrEmpty(stream, "stream");
|
||||||
ensure.isInteger(expectedVersion, "expectedVersion");
|
ensure.isLongOrInteger(expectedVersion, "expectedVersion");
|
||||||
|
expectedVersion = Long.fromValue(expectedVersion);
|
||||||
if (!Array.isArray(events))
|
if (!Array.isArray(events))
|
||||||
events = [events];
|
events = [events];
|
||||||
ensure.isArrayOf(EventData, events, "events");
|
ensure.isArrayOf(EventData, events, "events");
|
||||||
|
@ -157,13 +159,14 @@ EventStoreNodeConnection.prototype.appendToStream = function(stream, expectedVer
|
||||||
* Start a transaction (async)
|
* Start a transaction (async)
|
||||||
* @public
|
* @public
|
||||||
* @param {string} stream
|
* @param {string} stream
|
||||||
* @param {number} expectedVersion
|
* @param {Long|number} expectedVersion
|
||||||
* @param {UserCredentials} [userCredentials]
|
* @param {UserCredentials} [userCredentials]
|
||||||
* @returns {Promise.<EventStoreTransaction>}
|
* @returns {Promise.<EventStoreTransaction>}
|
||||||
*/
|
*/
|
||||||
EventStoreNodeConnection.prototype.startTransaction = function(stream, expectedVersion, userCredentials) {
|
EventStoreNodeConnection.prototype.startTransaction = function(stream, expectedVersion, userCredentials) {
|
||||||
ensure.notNullOrEmpty(stream, "stream");
|
ensure.notNullOrEmpty(stream, "stream");
|
||||||
ensure.isInteger(expectedVersion, "expectedVersion");
|
ensure.isLongOrInteger(expectedVersion, "expectedVersion");
|
||||||
|
expectedVersion = Long.fromValue(expectedVersion);
|
||||||
userCredentials = userCredentials || null;
|
userCredentials = userCredentials || null;
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
@ -234,21 +237,20 @@ EventStoreNodeConnection.prototype.commitTransaction = function(transaction, use
|
||||||
* Read a single event (async)
|
* Read a single event (async)
|
||||||
* @public
|
* @public
|
||||||
* @param {string} stream
|
* @param {string} stream
|
||||||
* @param {number} eventNumber
|
* @param {Long|number} eventNumber
|
||||||
* @param {boolean} [resolveLinkTos]
|
* @param {boolean} [resolveLinkTos]
|
||||||
* @param {UserCredentials} [userCredentials]
|
* @param {UserCredentials} [userCredentials]
|
||||||
* @returns {Promise.<EventReadResult>}
|
* @returns {Promise.<EventReadResult>}
|
||||||
*/
|
*/
|
||||||
EventStoreNodeConnection.prototype.readEvent = function(stream, eventNumber, resolveLinkTos, userCredentials) {
|
EventStoreNodeConnection.prototype.readEvent = function(stream, eventNumber, resolveLinkTos, userCredentials) {
|
||||||
ensure.notNullOrEmpty(stream, "stream");
|
ensure.notNullOrEmpty(stream, "stream");
|
||||||
ensure.isInteger(eventNumber, "eventNumber");
|
ensure.isLongOrInteger(eventNumber, "eventNumber");
|
||||||
if (eventNumber < -1) throw new Error("eventNumber out of range.");
|
eventNumber = Long.fromValue(eventNumber);
|
||||||
resolveLinkTos = !!resolveLinkTos;
|
resolveLinkTos = !!resolveLinkTos;
|
||||||
userCredentials = userCredentials || null;
|
userCredentials = userCredentials || null;
|
||||||
|
|
||||||
if (typeof stream !== 'string' || stream === '') throw new TypeError("stream must be an non-empty string.");
|
if (typeof stream !== 'string' || stream === '') throw new TypeError("stream must be an non-empty string.");
|
||||||
if (typeof eventNumber !== 'number' || eventNumber % 1 !== 0) throw new TypeError("eventNumber must be an integer.");
|
if (eventNumber.compare(-1) < 0) throw new Error("eventNumber out of range.");
|
||||||
if (eventNumber < -1) throw new Error("eventNumber out of range.");
|
|
||||||
if (resolveLinkTos && typeof resolveLinkTos !== 'boolean') throw new TypeError("resolveLinkTos must be a boolean.");
|
if (resolveLinkTos && typeof resolveLinkTos !== 'boolean') throw new TypeError("resolveLinkTos must be a boolean.");
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
@ -623,7 +625,7 @@ EventStoreNodeConnection.prototype.setStreamMetadata = function() {
|
||||||
* Set stream metadata with raw object (async)
|
* Set stream metadata with raw object (async)
|
||||||
* @public
|
* @public
|
||||||
* @param {string} stream
|
* @param {string} stream
|
||||||
* @param {number} expectedMetastreamVersion
|
* @param {Long|number} expectedMetastreamVersion
|
||||||
* @param {object} metadata
|
* @param {object} metadata
|
||||||
* @param {UserCredentials} [userCredentials]
|
* @param {UserCredentials} [userCredentials]
|
||||||
* @returns {Promise.<WriteResult>}
|
* @returns {Promise.<WriteResult>}
|
||||||
|
@ -634,6 +636,8 @@ EventStoreNodeConnection.prototype.setStreamMetadataRaw = function(
|
||||||
ensure.notNullOrEmpty(stream, "stream");
|
ensure.notNullOrEmpty(stream, "stream");
|
||||||
if (systemStreams.isMetastream(stream))
|
if (systemStreams.isMetastream(stream))
|
||||||
throw new Error(util.format("Setting metadata for metastream '%s' is not supported.", stream));
|
throw new Error(util.format("Setting metadata for metastream '%s' is not supported.", stream));
|
||||||
|
ensure.isLongOrInteger(expectedMetastreamVersion, "expectedMetastreamVersion");
|
||||||
|
expectedMetastreamVersion = Long.fromValue(expectedMetastreamVersion);
|
||||||
var self = this;
|
var self = this;
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
function cb(err, result) {
|
function cb(err, result) {
|
||||||
|
@ -676,7 +680,7 @@ EventStoreNodeConnection.prototype.getStreamMetadataRaw = function(stream, userC
|
||||||
var evnt = res.event.originalEvent;
|
var evnt = res.event.originalEvent;
|
||||||
var version = evnt ? evnt.eventNumber : -1;
|
var version = evnt ? evnt.eventNumber : -1;
|
||||||
var data = evnt ? JSON.parse(evnt.data.toString()) : null;
|
var data = evnt ? JSON.parse(evnt.data.toString()) : null;
|
||||||
return new results.RawStreamMetadataResult(stream, false, version, data);
|
return new results.RawStreamMetadataResult(stream, false, Long.fromValue(version), data);
|
||||||
case results.EventReadStatus.NotFound:
|
case results.EventReadStatus.NotFound:
|
||||||
case results.EventReadStatus.NoStream:
|
case results.EventReadStatus.NoStream:
|
||||||
return new results.RawStreamMetadataResult(stream, false, -1, null);
|
return new results.RawStreamMetadataResult(stream, false, -1, null);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -23,7 +23,7 @@ message NewEvent {
|
||||||
|
|
||||||
message EventRecord {
|
message EventRecord {
|
||||||
required string event_stream_id = 1;
|
required string event_stream_id = 1;
|
||||||
required int32 event_number = 2;
|
required int64 event_number = 2;
|
||||||
required bytes event_id = 3;
|
required bytes event_id = 3;
|
||||||
required string event_type = 4;
|
required string event_type = 4;
|
||||||
required int32 data_content_type = 5;
|
required int32 data_content_type = 5;
|
||||||
|
@ -48,7 +48,7 @@ message ResolvedEvent {
|
||||||
|
|
||||||
message WriteEvents {
|
message WriteEvents {
|
||||||
required string event_stream_id = 1;
|
required string event_stream_id = 1;
|
||||||
required int32 expected_version = 2;
|
required int64 expected_version = 2;
|
||||||
repeated NewEvent events = 3;
|
repeated NewEvent events = 3;
|
||||||
required bool require_master = 4;
|
required bool require_master = 4;
|
||||||
}
|
}
|
||||||
|
@ -56,15 +56,16 @@ message WriteEvents {
|
||||||
message WriteEventsCompleted {
|
message WriteEventsCompleted {
|
||||||
required OperationResult result = 1;
|
required OperationResult result = 1;
|
||||||
optional string message = 2;
|
optional string message = 2;
|
||||||
required int32 first_event_number = 3;
|
required int64 first_event_number = 3;
|
||||||
required int32 last_event_number = 4;
|
required int64 last_event_number = 4;
|
||||||
optional int64 prepare_position = 5;
|
optional int64 prepare_position = 5;
|
||||||
optional int64 commit_position = 6;
|
optional int64 commit_position = 6;
|
||||||
|
optional int64 current_version = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
message DeleteStream {
|
message DeleteStream {
|
||||||
required string event_stream_id = 1;
|
required string event_stream_id = 1;
|
||||||
required int32 expected_version = 2;
|
required int64 expected_version = 2;
|
||||||
required bool require_master = 3;
|
required bool require_master = 3;
|
||||||
optional bool hard_delete = 4;
|
optional bool hard_delete = 4;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +79,7 @@ message DeleteStreamCompleted {
|
||||||
|
|
||||||
message TransactionStart {
|
message TransactionStart {
|
||||||
required string event_stream_id = 1;
|
required string event_stream_id = 1;
|
||||||
required int32 expected_version = 2;
|
required int64 expected_version = 2;
|
||||||
required bool require_master = 3;
|
required bool require_master = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,15 +110,15 @@ message TransactionCommitCompleted {
|
||||||
required int64 transaction_id = 1;
|
required int64 transaction_id = 1;
|
||||||
required OperationResult result = 2;
|
required OperationResult result = 2;
|
||||||
optional string message = 3;
|
optional string message = 3;
|
||||||
required int32 first_event_number = 4;
|
required int64 first_event_number = 4;
|
||||||
required int32 last_event_number = 5;
|
required int64 last_event_number = 5;
|
||||||
optional int64 prepare_position = 6;
|
optional int64 prepare_position = 6;
|
||||||
optional int64 commit_position = 7;
|
optional int64 commit_position = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ReadEvent {
|
message ReadEvent {
|
||||||
required string event_stream_id = 1;
|
required string event_stream_id = 1;
|
||||||
required int32 event_number = 2;
|
required int64 event_number = 2;
|
||||||
required bool resolve_link_tos = 3;
|
required bool resolve_link_tos = 3;
|
||||||
required bool require_master = 4;
|
required bool require_master = 4;
|
||||||
}
|
}
|
||||||
|
@ -141,7 +142,7 @@ message ReadEventCompleted {
|
||||||
|
|
||||||
message ReadStreamEvents {
|
message ReadStreamEvents {
|
||||||
required string event_stream_id = 1;
|
required string event_stream_id = 1;
|
||||||
required int32 from_event_number = 2;
|
required int64 from_event_number = 2;
|
||||||
required int32 max_count = 3;
|
required int32 max_count = 3;
|
||||||
required bool resolve_link_tos = 4;
|
required bool resolve_link_tos = 4;
|
||||||
required bool require_master = 5;
|
required bool require_master = 5;
|
||||||
|
@ -160,8 +161,8 @@ message ReadStreamEventsCompleted {
|
||||||
|
|
||||||
repeated ResolvedIndexedEvent events = 1;
|
repeated ResolvedIndexedEvent events = 1;
|
||||||
required ReadStreamResult result = 2;
|
required ReadStreamResult result = 2;
|
||||||
required int32 next_event_number = 3;
|
required int64 next_event_number = 3;
|
||||||
required int32 last_event_number = 4;
|
required int64 last_event_number = 4;
|
||||||
required bool is_end_of_stream = 5;
|
required bool is_end_of_stream = 5;
|
||||||
required int64 last_commit_position = 6;
|
required int64 last_commit_position = 6;
|
||||||
|
|
||||||
|
@ -199,7 +200,7 @@ message CreatePersistentSubscription {
|
||||||
required string subscription_group_name = 1;
|
required string subscription_group_name = 1;
|
||||||
required string event_stream_id = 2;
|
required string event_stream_id = 2;
|
||||||
required bool resolve_link_tos = 3;
|
required bool resolve_link_tos = 3;
|
||||||
required int32 start_from = 4;
|
required int64 start_from = 4;
|
||||||
required int32 message_timeout_milliseconds = 5;
|
required int32 message_timeout_milliseconds = 5;
|
||||||
required bool record_statistics = 6;
|
required bool record_statistics = 6;
|
||||||
required int32 live_buffer_size = 7;
|
required int32 live_buffer_size = 7;
|
||||||
|
@ -223,7 +224,7 @@ message UpdatePersistentSubscription {
|
||||||
required string subscription_group_name = 1;
|
required string subscription_group_name = 1;
|
||||||
required string event_stream_id = 2;
|
required string event_stream_id = 2;
|
||||||
required bool resolve_link_tos = 3;
|
required bool resolve_link_tos = 3;
|
||||||
required int32 start_from = 4;
|
required int64 start_from = 4;
|
||||||
required int32 message_timeout_milliseconds = 5;
|
required int32 message_timeout_milliseconds = 5;
|
||||||
required bool record_statistics = 6;
|
required bool record_statistics = 6;
|
||||||
required int32 live_buffer_size = 7;
|
required int32 live_buffer_size = 7;
|
||||||
|
@ -301,7 +302,7 @@ message PersistentSubscriptionNakEvents {
|
||||||
message PersistentSubscriptionConfirmation {
|
message PersistentSubscriptionConfirmation {
|
||||||
required int64 last_commit_position = 1;
|
required int64 last_commit_position = 1;
|
||||||
required string subscription_id = 2;
|
required string subscription_id = 2;
|
||||||
optional int32 last_event_number = 3;
|
optional int64 last_event_number = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message PersistentSubscriptionStreamEventAppeared {
|
message PersistentSubscriptionStreamEventAppeared {
|
||||||
|
@ -315,7 +316,7 @@ message SubscribeToStream {
|
||||||
|
|
||||||
message SubscriptionConfirmation {
|
message SubscriptionConfirmation {
|
||||||
required int64 last_commit_position = 1;
|
required int64 last_commit_position = 1;
|
||||||
optional int32 last_event_number = 2;
|
optional int64 last_event_number = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message StreamEventAppeared {
|
message StreamEventAppeared {
|
||||||
|
@ -375,3 +376,11 @@ message ScavengeDatabaseCompleted {
|
||||||
required int32 total_time_ms = 3;
|
required int32 total_time_ms = 3;
|
||||||
required int64 total_space_saved = 4;
|
required int64 total_space_saved = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message IdentifyClient {
|
||||||
|
required int32 version = 1;
|
||||||
|
optional string connection_name = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ClientIdentified {
|
||||||
|
}
|
|
@ -44,7 +44,7 @@ Object.freeze(EventReadStatus);
|
||||||
* @constructor
|
* @constructor
|
||||||
* @property {string} eventStreamId
|
* @property {string} eventStreamId
|
||||||
* @property {string} eventId
|
* @property {string} eventId
|
||||||
* @property {number} eventNumber
|
* @property {Long} eventNumber
|
||||||
* @property {string} eventType
|
* @property {string} eventType
|
||||||
* @property {number} createdEpoch
|
* @property {number} createdEpoch
|
||||||
* @property {?Buffer} data
|
* @property {?Buffer} data
|
||||||
|
@ -73,7 +73,7 @@ function RecordedEvent(ev) {
|
||||||
* @property {boolean} isResolved
|
* @property {boolean} isResolved
|
||||||
* @property {?Position} originalPosition
|
* @property {?Position} originalPosition
|
||||||
* @property {string} originalStreamId
|
* @property {string} originalStreamId
|
||||||
* @property {number} originalEventNumber
|
* @property {Long} originalEventNumber
|
||||||
*/
|
*/
|
||||||
function ResolvedEvent(ev) {
|
function ResolvedEvent(ev) {
|
||||||
this.event = ev.event === null ? null : new RecordedEvent(ev.event);
|
this.event = ev.event === null ? null : new RecordedEvent(ev.event);
|
||||||
|
@ -90,12 +90,12 @@ function ResolvedEvent(ev) {
|
||||||
*
|
*
|
||||||
* @param {string} status
|
* @param {string} status
|
||||||
* @param {string} stream
|
* @param {string} stream
|
||||||
* @param {number} eventNumber
|
* @param {Long} eventNumber
|
||||||
* @param {object} event
|
* @param {object} event
|
||||||
* @constructor
|
* @constructor
|
||||||
* @property {string} status
|
* @property {string} status
|
||||||
* @property {string} stream
|
* @property {string} stream
|
||||||
* @property {number} eventNumber
|
* @property {Long} eventNumber
|
||||||
* @property {ResolvedEvent} event
|
* @property {ResolvedEvent} event
|
||||||
*/
|
*/
|
||||||
function EventReadResult(status, stream, eventNumber, event) {
|
function EventReadResult(status, stream, eventNumber, event) {
|
||||||
|
@ -110,7 +110,7 @@ function EventReadResult(status, stream, eventNumber, event) {
|
||||||
* @param {number} nextExpectedVersion
|
* @param {number} nextExpectedVersion
|
||||||
* @param {Position} logPosition
|
* @param {Position} logPosition
|
||||||
* @constructor
|
* @constructor
|
||||||
* @property {number} nextExpectedVersion
|
* @property {Long} nextExpectedVersion
|
||||||
* @property {Position} logPosition
|
* @property {Position} logPosition
|
||||||
*/
|
*/
|
||||||
function WriteResult(nextExpectedVersion, logPosition) {
|
function WriteResult(nextExpectedVersion, logPosition) {
|
||||||
|
@ -122,20 +122,20 @@ function WriteResult(nextExpectedVersion, logPosition) {
|
||||||
/**
|
/**
|
||||||
* @param {string} status
|
* @param {string} status
|
||||||
* @param {string} stream
|
* @param {string} stream
|
||||||
* @param {number} fromEventNumber
|
* @param {Long} fromEventNumber
|
||||||
* @param {string} readDirection
|
* @param {string} readDirection
|
||||||
* @param {object[]} events
|
* @param {object[]} events
|
||||||
* @param {number} nextEventNumber
|
* @param {Long} nextEventNumber
|
||||||
* @param {number} lastEventNumber
|
* @param {Long} lastEventNumber
|
||||||
* @param {boolean} isEndOfStream
|
* @param {boolean} isEndOfStream
|
||||||
* @constructor
|
* @constructor
|
||||||
* @property {string} status
|
* @property {string} status
|
||||||
* @property {string} stream
|
* @property {string} stream
|
||||||
* @property {number} fromEventNumber
|
* @property {Long} fromEventNumber
|
||||||
* @property {string} readDirection
|
* @property {string} readDirection
|
||||||
* @property {ResolvedEvent[]} events
|
* @property {ResolvedEvent[]} events
|
||||||
* @property {number} nextEventNumber
|
* @property {Long} nextEventNumber
|
||||||
* @property {number} lastEventNumber
|
* @property {Long} lastEventNumber
|
||||||
* @property {boolean} isEndOfStream
|
* @property {boolean} isEndOfStream
|
||||||
*/
|
*/
|
||||||
function StreamEventsSlice(
|
function StreamEventsSlice(
|
||||||
|
@ -185,12 +185,12 @@ function DeleteResult(logPosition) {
|
||||||
/**
|
/**
|
||||||
* @param {string} stream
|
* @param {string} stream
|
||||||
* @param {boolean} isStreamDeleted
|
* @param {boolean} isStreamDeleted
|
||||||
* @param {number} metastreamVersion
|
* @param {Long} metastreamVersion
|
||||||
* @param {object} streamMetadata
|
* @param {object} streamMetadata
|
||||||
* @constructor
|
* @constructor
|
||||||
* @property {string} stream
|
* @property {string} stream
|
||||||
* @property {boolean} isStreamDeleted
|
* @property {boolean} isStreamDeleted
|
||||||
* @property {number} metastreamVersion
|
* @property {Long} metastreamVersion
|
||||||
* @property {object} streamMetadata
|
* @property {object} streamMetadata
|
||||||
*/
|
*/
|
||||||
function RawStreamMetadataResult(stream, isStreamDeleted, metastreamVersion, streamMetadata) {
|
function RawStreamMetadataResult(stream, isStreamDeleted, metastreamVersion, streamMetadata) {
|
||||||
|
|
|
@ -71,7 +71,9 @@ const TcpCommand = {
|
||||||
NotHandled: 0xF1,
|
NotHandled: 0xF1,
|
||||||
Authenticate: 0xF2,
|
Authenticate: 0xF2,
|
||||||
Authenticated: 0xF3,
|
Authenticated: 0xF3,
|
||||||
NotAuthenticated: 0xF4
|
NotAuthenticated: 0xF4,
|
||||||
|
IdentifyClient: 0xF5,
|
||||||
|
ClientIdentified: 0xF6
|
||||||
};
|
};
|
||||||
|
|
||||||
var _reverseLookup = {};
|
var _reverseLookup = {};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user