@kurrent/kurrentdb-client
Version:
KurrentDB gRPC NodeJS Client SDK
693 lines (597 loc) • 21.8 kB
JavaScript
// source: kurrentdb/protocols/v2/errors.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
var jspb = require('google-protobuf');
var goog = jspb;
var global = (function() {
if (this) { return this; }
if (typeof window !== 'undefined') { return window; }
if (typeof global !== 'undefined') { return global; }
if (typeof self !== 'undefined') { return self; }
return Function('return this')();
}.call(null));
var kurrentdb_protocols_v2_rpc_pb = require('../../../kurrentdb/protocols/v2/rpc_pb.js');
goog.object.extend(proto, kurrentdb_protocols_v2_rpc_pb);
goog.exportSymbol('proto.kurrent.rpc.AccessDeniedErrorDetails', null, global);
goog.exportSymbol('proto.kurrent.rpc.NotLeaderNodeErrorDetails', null, global);
goog.exportSymbol('proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo', null, global);
goog.exportSymbol('proto.kurrent.rpc.ServerError', null, global);
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.kurrent.rpc.AccessDeniedErrorDetails = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.kurrent.rpc.AccessDeniedErrorDetails, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.kurrent.rpc.AccessDeniedErrorDetails.displayName = 'proto.kurrent.rpc.AccessDeniedErrorDetails';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.kurrent.rpc.NotLeaderNodeErrorDetails = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.kurrent.rpc.NotLeaderNodeErrorDetails, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.kurrent.rpc.NotLeaderNodeErrorDetails.displayName = 'proto.kurrent.rpc.NotLeaderNodeErrorDetails';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo.displayName = 'proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.kurrent.rpc.AccessDeniedErrorDetails.prototype.toObject = function(opt_includeInstance) {
return proto.kurrent.rpc.AccessDeniedErrorDetails.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.kurrent.rpc.AccessDeniedErrorDetails} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.kurrent.rpc.AccessDeniedErrorDetails.toObject = function(includeInstance, msg) {
var f, obj = {
operation: jspb.Message.getFieldWithDefault(msg, 1, ""),
username: jspb.Message.getFieldWithDefault(msg, 2, ""),
permission: jspb.Message.getFieldWithDefault(msg, 3, "")
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.kurrent.rpc.AccessDeniedErrorDetails}
*/
proto.kurrent.rpc.AccessDeniedErrorDetails.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.kurrent.rpc.AccessDeniedErrorDetails;
return proto.kurrent.rpc.AccessDeniedErrorDetails.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.kurrent.rpc.AccessDeniedErrorDetails} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.kurrent.rpc.AccessDeniedErrorDetails}
*/
proto.kurrent.rpc.AccessDeniedErrorDetails.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setOperation(value);
break;
case 2:
var value = /** @type {string} */ (reader.readString());
msg.setUsername(value);
break;
case 3:
var value = /** @type {string} */ (reader.readString());
msg.setPermission(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.kurrent.rpc.AccessDeniedErrorDetails.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.kurrent.rpc.AccessDeniedErrorDetails.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.kurrent.rpc.AccessDeniedErrorDetails} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.kurrent.rpc.AccessDeniedErrorDetails.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getOperation();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = /** @type {string} */ (jspb.Message.getField(message, 2));
if (f != null) {
writer.writeString(
2,
f
);
}
f = /** @type {string} */ (jspb.Message.getField(message, 3));
if (f != null) {
writer.writeString(
3,
f
);
}
};
/**
* optional string operation = 1;
* @return {string}
*/
proto.kurrent.rpc.AccessDeniedErrorDetails.prototype.getOperation = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.kurrent.rpc.AccessDeniedErrorDetails} returns this
*/
proto.kurrent.rpc.AccessDeniedErrorDetails.prototype.setOperation = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
/**
* optional string username = 2;
* @return {string}
*/
proto.kurrent.rpc.AccessDeniedErrorDetails.prototype.getUsername = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};
/**
* @param {string} value
* @return {!proto.kurrent.rpc.AccessDeniedErrorDetails} returns this
*/
proto.kurrent.rpc.AccessDeniedErrorDetails.prototype.setUsername = function(value) {
return jspb.Message.setField(this, 2, value);
};
/**
* Clears the field making it undefined.
* @return {!proto.kurrent.rpc.AccessDeniedErrorDetails} returns this
*/
proto.kurrent.rpc.AccessDeniedErrorDetails.prototype.clearUsername = function() {
return jspb.Message.setField(this, 2, undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.kurrent.rpc.AccessDeniedErrorDetails.prototype.hasUsername = function() {
return jspb.Message.getField(this, 2) != null;
};
/**
* optional string permission = 3;
* @return {string}
*/
proto.kurrent.rpc.AccessDeniedErrorDetails.prototype.getPermission = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
};
/**
* @param {string} value
* @return {!proto.kurrent.rpc.AccessDeniedErrorDetails} returns this
*/
proto.kurrent.rpc.AccessDeniedErrorDetails.prototype.setPermission = function(value) {
return jspb.Message.setField(this, 3, value);
};
/**
* Clears the field making it undefined.
* @return {!proto.kurrent.rpc.AccessDeniedErrorDetails} returns this
*/
proto.kurrent.rpc.AccessDeniedErrorDetails.prototype.clearPermission = function() {
return jspb.Message.setField(this, 3, undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.kurrent.rpc.AccessDeniedErrorDetails.prototype.hasPermission = function() {
return jspb.Message.getField(this, 3) != null;
};
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.kurrent.rpc.NotLeaderNodeErrorDetails.prototype.toObject = function(opt_includeInstance) {
return proto.kurrent.rpc.NotLeaderNodeErrorDetails.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.kurrent.rpc.NotLeaderNodeErrorDetails} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.kurrent.rpc.NotLeaderNodeErrorDetails.toObject = function(includeInstance, msg) {
var f, obj = {
currentLeader: (f = msg.getCurrentLeader()) && proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo.toObject(includeInstance, f)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.kurrent.rpc.NotLeaderNodeErrorDetails}
*/
proto.kurrent.rpc.NotLeaderNodeErrorDetails.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.kurrent.rpc.NotLeaderNodeErrorDetails;
return proto.kurrent.rpc.NotLeaderNodeErrorDetails.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.kurrent.rpc.NotLeaderNodeErrorDetails} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.kurrent.rpc.NotLeaderNodeErrorDetails}
*/
proto.kurrent.rpc.NotLeaderNodeErrorDetails.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo;
reader.readMessage(value,proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo.deserializeBinaryFromReader);
msg.setCurrentLeader(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.kurrent.rpc.NotLeaderNodeErrorDetails.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.kurrent.rpc.NotLeaderNodeErrorDetails.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.kurrent.rpc.NotLeaderNodeErrorDetails} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.kurrent.rpc.NotLeaderNodeErrorDetails.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getCurrentLeader();
if (f != null) {
writer.writeMessage(
1,
f,
proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo.serializeBinaryToWriter
);
}
};
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo.prototype.toObject = function(opt_includeInstance) {
return proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo.toObject = function(includeInstance, msg) {
var f, obj = {
host: jspb.Message.getFieldWithDefault(msg, 1, ""),
port: jspb.Message.getFieldWithDefault(msg, 2, 0),
nodeId: jspb.Message.getFieldWithDefault(msg, 3, "")
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo}
*/
proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo;
return proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo}
*/
proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setHost(value);
break;
case 2:
var value = /** @type {number} */ (reader.readInt32());
msg.setPort(value);
break;
case 3:
var value = /** @type {string} */ (reader.readString());
msg.setNodeId(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getHost();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = message.getPort();
if (f !== 0) {
writer.writeInt32(
2,
f
);
}
f = /** @type {string} */ (jspb.Message.getField(message, 3));
if (f != null) {
writer.writeString(
3,
f
);
}
};
/**
* optional string host = 1;
* @return {string}
*/
proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo.prototype.getHost = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo} returns this
*/
proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo.prototype.setHost = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
/**
* optional int32 port = 2;
* @return {number}
*/
proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo.prototype.getPort = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
};
/**
* @param {number} value
* @return {!proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo} returns this
*/
proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo.prototype.setPort = function(value) {
return jspb.Message.setProto3IntField(this, 2, value);
};
/**
* optional string node_id = 3;
* @return {string}
*/
proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo.prototype.getNodeId = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
};
/**
* @param {string} value
* @return {!proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo} returns this
*/
proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo.prototype.setNodeId = function(value) {
return jspb.Message.setField(this, 3, value);
};
/**
* Clears the field making it undefined.
* @return {!proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo} returns this
*/
proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo.prototype.clearNodeId = function() {
return jspb.Message.setField(this, 3, undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo.prototype.hasNodeId = function() {
return jspb.Message.getField(this, 3) != null;
};
/**
* optional NodeInfo current_leader = 1;
* @return {?proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo}
*/
proto.kurrent.rpc.NotLeaderNodeErrorDetails.prototype.getCurrentLeader = function() {
return /** @type{?proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo} */ (
jspb.Message.getWrapperField(this, proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo, 1));
};
/**
* @param {?proto.kurrent.rpc.NotLeaderNodeErrorDetails.NodeInfo|undefined} value
* @return {!proto.kurrent.rpc.NotLeaderNodeErrorDetails} returns this
*/
proto.kurrent.rpc.NotLeaderNodeErrorDetails.prototype.setCurrentLeader = function(value) {
return jspb.Message.setWrapperField(this, 1, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.kurrent.rpc.NotLeaderNodeErrorDetails} returns this
*/
proto.kurrent.rpc.NotLeaderNodeErrorDetails.prototype.clearCurrentLeader = function() {
return this.setCurrentLeader(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.kurrent.rpc.NotLeaderNodeErrorDetails.prototype.hasCurrentLeader = function() {
return jspb.Message.getField(this, 1) != null;
};
/**
* @enum {number}
*/
proto.kurrent.rpc.ServerError = {
UNSPECIFIED: 0,
SERVER_ERROR_ACCESS_DENIED: 1,
SERVER_ERROR_BAD_REQUEST: 2,
SERVER_ERROR_NOT_LEADER_NODE: 5,
SERVER_ERROR_OPERATION_TIMEOUT: 6,
SERVER_ERROR_SERVER_NOT_READY: 7,
SERVER_ERROR_SERVER_OVERLOADED: 8,
SERVER_ERROR_SERVER_MALFUNCTION: 9
};
goog.object.extend(exports, proto.kurrent.rpc);