/** * @fileoverview * @enhanceable * @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! var jspb = require('google-protobuf'); var goog = jspb; var global = Function('return this')(); goog.exportSymbol('proto.eraftpb.ConfChange', null, global); goog.exportSymbol('proto.eraftpb.ConfChangeType', null, global); goog.exportSymbol('proto.eraftpb.ConfState', null, global); goog.exportSymbol('proto.eraftpb.Entry', null, global); goog.exportSymbol('proto.eraftpb.EntryType', null, global); goog.exportSymbol('proto.eraftpb.HardState', null, global); goog.exportSymbol('proto.eraftpb.Message', null, global); goog.exportSymbol('proto.eraftpb.MessageType', null, global); goog.exportSymbol('proto.eraftpb.Snapshot', null, global); goog.exportSymbol('proto.eraftpb.SnapshotMetadata', 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.eraftpb.Entry = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.eraftpb.Entry, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.eraftpb.Entry.displayName = 'proto.eraftpb.Entry'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.eraftpb.Entry.prototype.toObject = function(opt_includeInstance) { return proto.eraftpb.Entry.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.eraftpb.Entry} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.eraftpb.Entry.toObject = function(includeInstance, msg) { var f, obj = { entryType: jspb.Message.getFieldWithDefault(msg, 1, 0), term: jspb.Message.getFieldWithDefault(msg, 2, 0), index: jspb.Message.getFieldWithDefault(msg, 3, 0), data: msg.getData_asB64(), context: msg.getContext_asB64(), syncLog: jspb.Message.getFieldWithDefault(msg, 5, false) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.eraftpb.Entry} */ proto.eraftpb.Entry.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.eraftpb.Entry; return proto.eraftpb.Entry.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.eraftpb.Entry} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.eraftpb.Entry} */ proto.eraftpb.Entry.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {!proto.eraftpb.EntryType} */ (reader.readEnum()); msg.setEntryType(value); break; case 2: var value = /** @type {number} */ (reader.readUint64()); msg.setTerm(value); break; case 3: var value = /** @type {number} */ (reader.readUint64()); msg.setIndex(value); break; case 4: var value = /** @type {!Uint8Array} */ (reader.readBytes()); msg.setData(value); break; case 6: var value = /** @type {!Uint8Array} */ (reader.readBytes()); msg.setContext(value); break; case 5: var value = /** @type {boolean} */ (reader.readBool()); msg.setSyncLog(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.eraftpb.Entry.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.eraftpb.Entry.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.eraftpb.Entry} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.eraftpb.Entry.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getEntryType(); if (f !== 0.0) { writer.writeEnum( 1, f ); } f = message.getTerm(); if (f !== 0) { writer.writeUint64( 2, f ); } f = message.getIndex(); if (f !== 0) { writer.writeUint64( 3, f ); } f = message.getData_asU8(); if (f.length > 0) { writer.writeBytes( 4, f ); } f = message.getContext_asU8(); if (f.length > 0) { writer.writeBytes( 6, f ); } f = message.getSyncLog(); if (f) { writer.writeBool( 5, f ); } }; /** * optional EntryType entry_type = 1; * @return {!proto.eraftpb.EntryType} */ proto.eraftpb.Entry.prototype.getEntryType = function() { return /** @type {!proto.eraftpb.EntryType} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** @param {!proto.eraftpb.EntryType} value */ proto.eraftpb.Entry.prototype.setEntryType = function(value) { jspb.Message.setProto3EnumField(this, 1, value); }; /** * optional uint64 term = 2; * @return {number} */ proto.eraftpb.Entry.prototype.getTerm = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** @param {number} value */ proto.eraftpb.Entry.prototype.setTerm = function(value) { jspb.Message.setProto3IntField(this, 2, value); }; /** * optional uint64 index = 3; * @return {number} */ proto.eraftpb.Entry.prototype.getIndex = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** @param {number} value */ proto.eraftpb.Entry.prototype.setIndex = function(value) { jspb.Message.setProto3IntField(this, 3, value); }; /** * optional bytes data = 4; * @return {string} */ proto.eraftpb.Entry.prototype.getData = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; /** * optional bytes data = 4; * This is a type-conversion wrapper around `getData()` * @return {string} */ proto.eraftpb.Entry.prototype.getData_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getData())); }; /** * optional bytes data = 4; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array * This is a type-conversion wrapper around `getData()` * @return {!Uint8Array} */ proto.eraftpb.Entry.prototype.getData_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getData())); }; /** @param {!(string|Uint8Array)} value */ proto.eraftpb.Entry.prototype.setData = function(value) { jspb.Message.setProto3BytesField(this, 4, value); }; /** * optional bytes context = 6; * @return {string} */ proto.eraftpb.Entry.prototype.getContext = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); }; /** * optional bytes context = 6; * This is a type-conversion wrapper around `getContext()` * @return {string} */ proto.eraftpb.Entry.prototype.getContext_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getContext())); }; /** * optional bytes context = 6; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array * This is a type-conversion wrapper around `getContext()` * @return {!Uint8Array} */ proto.eraftpb.Entry.prototype.getContext_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getContext())); }; /** @param {!(string|Uint8Array)} value */ proto.eraftpb.Entry.prototype.setContext = function(value) { jspb.Message.setProto3BytesField(this, 6, value); }; /** * optional bool sync_log = 5; * Note that Boolean fields may be set to 0/1 when serialized from a Java server. * You should avoid comparisons like {@code val === true/false} in those cases. * @return {boolean} */ proto.eraftpb.Entry.prototype.getSyncLog = function() { return /** @type {boolean} */ (jspb.Message.getFieldWithDefault(this, 5, false)); }; /** @param {boolean} value */ proto.eraftpb.Entry.prototype.setSyncLog = function(value) { jspb.Message.setProto3BooleanField(this, 5, value); }; /** * 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.eraftpb.SnapshotMetadata = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.eraftpb.SnapshotMetadata, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.eraftpb.SnapshotMetadata.displayName = 'proto.eraftpb.SnapshotMetadata'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.eraftpb.SnapshotMetadata.prototype.toObject = function(opt_includeInstance) { return proto.eraftpb.SnapshotMetadata.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.eraftpb.SnapshotMetadata} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.eraftpb.SnapshotMetadata.toObject = function(includeInstance, msg) { var f, obj = { confState: (f = msg.getConfState()) && proto.eraftpb.ConfState.toObject(includeInstance, f), index: jspb.Message.getFieldWithDefault(msg, 2, 0), term: jspb.Message.getFieldWithDefault(msg, 3, 0) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.eraftpb.SnapshotMetadata} */ proto.eraftpb.SnapshotMetadata.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.eraftpb.SnapshotMetadata; return proto.eraftpb.SnapshotMetadata.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.eraftpb.SnapshotMetadata} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.eraftpb.SnapshotMetadata} */ proto.eraftpb.SnapshotMetadata.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto.eraftpb.ConfState; reader.readMessage(value,proto.eraftpb.ConfState.deserializeBinaryFromReader); msg.setConfState(value); break; case 2: var value = /** @type {number} */ (reader.readUint64()); msg.setIndex(value); break; case 3: var value = /** @type {number} */ (reader.readUint64()); msg.setTerm(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.eraftpb.SnapshotMetadata.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.eraftpb.SnapshotMetadata.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.eraftpb.SnapshotMetadata} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.eraftpb.SnapshotMetadata.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getConfState(); if (f != null) { writer.writeMessage( 1, f, proto.eraftpb.ConfState.serializeBinaryToWriter ); } f = message.getIndex(); if (f !== 0) { writer.writeUint64( 2, f ); } f = message.getTerm(); if (f !== 0) { writer.writeUint64( 3, f ); } }; /** * optional ConfState conf_state = 1; * @return {?proto.eraftpb.ConfState} */ proto.eraftpb.SnapshotMetadata.prototype.getConfState = function() { return /** @type{?proto.eraftpb.ConfState} */ ( jspb.Message.getWrapperField(this, proto.eraftpb.ConfState, 1)); }; /** @param {?proto.eraftpb.ConfState|undefined} value */ proto.eraftpb.SnapshotMetadata.prototype.setConfState = function(value) { jspb.Message.setWrapperField(this, 1, value); }; proto.eraftpb.SnapshotMetadata.prototype.clearConfState = function() { this.setConfState(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.eraftpb.SnapshotMetadata.prototype.hasConfState = function() { return jspb.Message.getField(this, 1) != null; }; /** * optional uint64 index = 2; * @return {number} */ proto.eraftpb.SnapshotMetadata.prototype.getIndex = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** @param {number} value */ proto.eraftpb.SnapshotMetadata.prototype.setIndex = function(value) { jspb.Message.setProto3IntField(this, 2, value); }; /** * optional uint64 term = 3; * @return {number} */ proto.eraftpb.SnapshotMetadata.prototype.getTerm = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** @param {number} value */ proto.eraftpb.SnapshotMetadata.prototype.setTerm = function(value) { jspb.Message.setProto3IntField(this, 3, value); }; /** * 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.eraftpb.Snapshot = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.eraftpb.Snapshot, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.eraftpb.Snapshot.displayName = 'proto.eraftpb.Snapshot'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.eraftpb.Snapshot.prototype.toObject = function(opt_includeInstance) { return proto.eraftpb.Snapshot.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.eraftpb.Snapshot} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.eraftpb.Snapshot.toObject = function(includeInstance, msg) { var f, obj = { data: msg.getData_asB64(), metadata: (f = msg.getMetadata()) && proto.eraftpb.SnapshotMetadata.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.eraftpb.Snapshot} */ proto.eraftpb.Snapshot.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.eraftpb.Snapshot; return proto.eraftpb.Snapshot.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.eraftpb.Snapshot} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.eraftpb.Snapshot} */ proto.eraftpb.Snapshot.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); msg.setData(value); break; case 2: var value = new proto.eraftpb.SnapshotMetadata; reader.readMessage(value,proto.eraftpb.SnapshotMetadata.deserializeBinaryFromReader); msg.setMetadata(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.eraftpb.Snapshot.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.eraftpb.Snapshot.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.eraftpb.Snapshot} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.eraftpb.Snapshot.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getData_asU8(); if (f.length > 0) { writer.writeBytes( 1, f ); } f = message.getMetadata(); if (f != null) { writer.writeMessage( 2, f, proto.eraftpb.SnapshotMetadata.serializeBinaryToWriter ); } }; /** * optional bytes data = 1; * @return {string} */ proto.eraftpb.Snapshot.prototype.getData = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * optional bytes data = 1; * This is a type-conversion wrapper around `getData()` * @return {string} */ proto.eraftpb.Snapshot.prototype.getData_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getData())); }; /** * optional bytes data = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array * This is a type-conversion wrapper around `getData()` * @return {!Uint8Array} */ proto.eraftpb.Snapshot.prototype.getData_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getData())); }; /** @param {!(string|Uint8Array)} value */ proto.eraftpb.Snapshot.prototype.setData = function(value) { jspb.Message.setProto3BytesField(this, 1, value); }; /** * optional SnapshotMetadata metadata = 2; * @return {?proto.eraftpb.SnapshotMetadata} */ proto.eraftpb.Snapshot.prototype.getMetadata = function() { return /** @type{?proto.eraftpb.SnapshotMetadata} */ ( jspb.Message.getWrapperField(this, proto.eraftpb.SnapshotMetadata, 2)); }; /** @param {?proto.eraftpb.SnapshotMetadata|undefined} value */ proto.eraftpb.Snapshot.prototype.setMetadata = function(value) { jspb.Message.setWrapperField(this, 2, value); }; proto.eraftpb.Snapshot.prototype.clearMetadata = function() { this.setMetadata(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.eraftpb.Snapshot.prototype.hasMetadata = function() { return jspb.Message.getField(this, 2) != null; }; /** * 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.eraftpb.Message = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, proto.eraftpb.Message.repeatedFields_, null); }; goog.inherits(proto.eraftpb.Message, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.eraftpb.Message.displayName = 'proto.eraftpb.Message'; } /** * List of repeated fields within this message type. * @private {!Array} * @const */ proto.eraftpb.Message.repeatedFields_ = [7]; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.eraftpb.Message.prototype.toObject = function(opt_includeInstance) { return proto.eraftpb.Message.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.eraftpb.Message} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.eraftpb.Message.toObject = function(includeInstance, msg) { var f, obj = { msgType: jspb.Message.getFieldWithDefault(msg, 1, 0), to: jspb.Message.getFieldWithDefault(msg, 2, 0), from: jspb.Message.getFieldWithDefault(msg, 3, 0), term: jspb.Message.getFieldWithDefault(msg, 4, 0), logTerm: jspb.Message.getFieldWithDefault(msg, 5, 0), index: jspb.Message.getFieldWithDefault(msg, 6, 0), entriesList: jspb.Message.toObjectList(msg.getEntriesList(), proto.eraftpb.Entry.toObject, includeInstance), commit: jspb.Message.getFieldWithDefault(msg, 8, 0), snapshot: (f = msg.getSnapshot()) && proto.eraftpb.Snapshot.toObject(includeInstance, f), reject: jspb.Message.getFieldWithDefault(msg, 10, false), rejectHint: jspb.Message.getFieldWithDefault(msg, 11, 0), context: msg.getContext_asB64() }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.eraftpb.Message} */ proto.eraftpb.Message.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.eraftpb.Message; return proto.eraftpb.Message.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.eraftpb.Message} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.eraftpb.Message} */ proto.eraftpb.Message.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {!proto.eraftpb.MessageType} */ (reader.readEnum()); msg.setMsgType(value); break; case 2: var value = /** @type {number} */ (reader.readUint64()); msg.setTo(value); break; case 3: var value = /** @type {number} */ (reader.readUint64()); msg.setFrom(value); break; case 4: var value = /** @type {number} */ (reader.readUint64()); msg.setTerm(value); break; case 5: var value = /** @type {number} */ (reader.readUint64()); msg.setLogTerm(value); break; case 6: var value = /** @type {number} */ (reader.readUint64()); msg.setIndex(value); break; case 7: var value = new proto.eraftpb.Entry; reader.readMessage(value,proto.eraftpb.Entry.deserializeBinaryFromReader); msg.addEntries(value); break; case 8: var value = /** @type {number} */ (reader.readUint64()); msg.setCommit(value); break; case 9: var value = new proto.eraftpb.Snapshot; reader.readMessage(value,proto.eraftpb.Snapshot.deserializeBinaryFromReader); msg.setSnapshot(value); break; case 10: var value = /** @type {boolean} */ (reader.readBool()); msg.setReject(value); break; case 11: var value = /** @type {number} */ (reader.readUint64()); msg.setRejectHint(value); break; case 12: var value = /** @type {!Uint8Array} */ (reader.readBytes()); msg.setContext(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.eraftpb.Message.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.eraftpb.Message.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.eraftpb.Message} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.eraftpb.Message.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getMsgType(); if (f !== 0.0) { writer.writeEnum( 1, f ); } f = message.getTo(); if (f !== 0) { writer.writeUint64( 2, f ); } f = message.getFrom(); if (f !== 0) { writer.writeUint64( 3, f ); } f = message.getTerm(); if (f !== 0) { writer.writeUint64( 4, f ); } f = message.getLogTerm(); if (f !== 0) { writer.writeUint64( 5, f ); } f = message.getIndex(); if (f !== 0) { writer.writeUint64( 6, f ); } f = message.getEntriesList(); if (f.length > 0) { writer.writeRepeatedMessage( 7, f, proto.eraftpb.Entry.serializeBinaryToWriter ); } f = message.getCommit(); if (f !== 0) { writer.writeUint64( 8, f ); } f = message.getSnapshot(); if (f != null) { writer.writeMessage( 9, f, proto.eraftpb.Snapshot.serializeBinaryToWriter ); } f = message.getReject(); if (f) { writer.writeBool( 10, f ); } f = message.getRejectHint(); if (f !== 0) { writer.writeUint64( 11, f ); } f = message.getContext_asU8(); if (f.length > 0) { writer.writeBytes( 12, f ); } }; /** * optional MessageType msg_type = 1; * @return {!proto.eraftpb.MessageType} */ proto.eraftpb.Message.prototype.getMsgType = function() { return /** @type {!proto.eraftpb.MessageType} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** @param {!proto.eraftpb.MessageType} value */ proto.eraftpb.Message.prototype.setMsgType = function(value) { jspb.Message.setProto3EnumField(this, 1, value); }; /** * optional uint64 to = 2; * @return {number} */ proto.eraftpb.Message.prototype.getTo = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** @param {number} value */ proto.eraftpb.Message.prototype.setTo = function(value) { jspb.Message.setProto3IntField(this, 2, value); }; /** * optional uint64 from = 3; * @return {number} */ proto.eraftpb.Message.prototype.getFrom = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** @param {number} value */ proto.eraftpb.Message.prototype.setFrom = function(value) { jspb.Message.setProto3IntField(this, 3, value); }; /** * optional uint64 term = 4; * @return {number} */ proto.eraftpb.Message.prototype.getTerm = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); }; /** @param {number} value */ proto.eraftpb.Message.prototype.setTerm = function(value) { jspb.Message.setProto3IntField(this, 4, value); }; /** * optional uint64 log_term = 5; * @return {number} */ proto.eraftpb.Message.prototype.getLogTerm = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); }; /** @param {number} value */ proto.eraftpb.Message.prototype.setLogTerm = function(value) { jspb.Message.setProto3IntField(this, 5, value); }; /** * optional uint64 index = 6; * @return {number} */ proto.eraftpb.Message.prototype.getIndex = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); }; /** @param {number} value */ proto.eraftpb.Message.prototype.setIndex = function(value) { jspb.Message.setProto3IntField(this, 6, value); }; /** * repeated Entry entries = 7; * @return {!Array} */ proto.eraftpb.Message.prototype.getEntriesList = function() { return /** @type{!Array} */ ( jspb.Message.getRepeatedWrapperField(this, proto.eraftpb.Entry, 7)); }; /** @param {!Array} value */ proto.eraftpb.Message.prototype.setEntriesList = function(value) { jspb.Message.setRepeatedWrapperField(this, 7, value); }; /** * @param {!proto.eraftpb.Entry=} opt_value * @param {number=} opt_index * @return {!proto.eraftpb.Entry} */ proto.eraftpb.Message.prototype.addEntries = function(opt_value, opt_index) { return jspb.Message.addToRepeatedWrapperField(this, 7, opt_value, proto.eraftpb.Entry, opt_index); }; proto.eraftpb.Message.prototype.clearEntriesList = function() { this.setEntriesList([]); }; /** * optional uint64 commit = 8; * @return {number} */ proto.eraftpb.Message.prototype.getCommit = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 8, 0)); }; /** @param {number} value */ proto.eraftpb.Message.prototype.setCommit = function(value) { jspb.Message.setProto3IntField(this, 8, value); }; /** * optional Snapshot snapshot = 9; * @return {?proto.eraftpb.Snapshot} */ proto.eraftpb.Message.prototype.getSnapshot = function() { return /** @type{?proto.eraftpb.Snapshot} */ ( jspb.Message.getWrapperField(this, proto.eraftpb.Snapshot, 9)); }; /** @param {?proto.eraftpb.Snapshot|undefined} value */ proto.eraftpb.Message.prototype.setSnapshot = function(value) { jspb.Message.setWrapperField(this, 9, value); }; proto.eraftpb.Message.prototype.clearSnapshot = function() { this.setSnapshot(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.eraftpb.Message.prototype.hasSnapshot = function() { return jspb.Message.getField(this, 9) != null; }; /** * optional bool reject = 10; * Note that Boolean fields may be set to 0/1 when serialized from a Java server. * You should avoid comparisons like {@code val === true/false} in those cases. * @return {boolean} */ proto.eraftpb.Message.prototype.getReject = function() { return /** @type {boolean} */ (jspb.Message.getFieldWithDefault(this, 10, false)); }; /** @param {boolean} value */ proto.eraftpb.Message.prototype.setReject = function(value) { jspb.Message.setProto3BooleanField(this, 10, value); }; /** * optional uint64 reject_hint = 11; * @return {number} */ proto.eraftpb.Message.prototype.getRejectHint = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 11, 0)); }; /** @param {number} value */ proto.eraftpb.Message.prototype.setRejectHint = function(value) { jspb.Message.setProto3IntField(this, 11, value); }; /** * optional bytes context = 12; * @return {string} */ proto.eraftpb.Message.prototype.getContext = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 12, "")); }; /** * optional bytes context = 12; * This is a type-conversion wrapper around `getContext()` * @return {string} */ proto.eraftpb.Message.prototype.getContext_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getContext())); }; /** * optional bytes context = 12; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array * This is a type-conversion wrapper around `getContext()` * @return {!Uint8Array} */ proto.eraftpb.Message.prototype.getContext_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getContext())); }; /** @param {!(string|Uint8Array)} value */ proto.eraftpb.Message.prototype.setContext = function(value) { jspb.Message.setProto3BytesField(this, 12, value); }; /** * 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.eraftpb.HardState = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.eraftpb.HardState, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.eraftpb.HardState.displayName = 'proto.eraftpb.HardState'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.eraftpb.HardState.prototype.toObject = function(opt_includeInstance) { return proto.eraftpb.HardState.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.eraftpb.HardState} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.eraftpb.HardState.toObject = function(includeInstance, msg) { var f, obj = { term: jspb.Message.getFieldWithDefault(msg, 1, 0), vote: jspb.Message.getFieldWithDefault(msg, 2, 0), commit: jspb.Message.getFieldWithDefault(msg, 3, 0) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.eraftpb.HardState} */ proto.eraftpb.HardState.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.eraftpb.HardState; return proto.eraftpb.HardState.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.eraftpb.HardState} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.eraftpb.HardState} */ proto.eraftpb.HardState.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readUint64()); msg.setTerm(value); break; case 2: var value = /** @type {number} */ (reader.readUint64()); msg.setVote(value); break; case 3: var value = /** @type {number} */ (reader.readUint64()); msg.setCommit(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.eraftpb.HardState.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.eraftpb.HardState.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.eraftpb.HardState} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.eraftpb.HardState.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getTerm(); if (f !== 0) { writer.writeUint64( 1, f ); } f = message.getVote(); if (f !== 0) { writer.writeUint64( 2, f ); } f = message.getCommit(); if (f !== 0) { writer.writeUint64( 3, f ); } }; /** * optional uint64 term = 1; * @return {number} */ proto.eraftpb.HardState.prototype.getTerm = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** @param {number} value */ proto.eraftpb.HardState.prototype.setTerm = function(value) { jspb.Message.setProto3IntField(this, 1, value); }; /** * optional uint64 vote = 2; * @return {number} */ proto.eraftpb.HardState.prototype.getVote = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** @param {number} value */ proto.eraftpb.HardState.prototype.setVote = function(value) { jspb.Message.setProto3IntField(this, 2, value); }; /** * optional uint64 commit = 3; * @return {number} */ proto.eraftpb.HardState.prototype.getCommit = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** @param {number} value */ proto.eraftpb.HardState.prototype.setCommit = function(value) { jspb.Message.setProto3IntField(this, 3, value); }; /** * 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.eraftpb.ConfState = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, proto.eraftpb.ConfState.repeatedFields_, null); }; goog.inherits(proto.eraftpb.ConfState, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.eraftpb.ConfState.displayName = 'proto.eraftpb.ConfState'; } /** * List of repeated fields within this message type. * @private {!Array} * @const */ proto.eraftpb.ConfState.repeatedFields_ = [1,2]; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.eraftpb.ConfState.prototype.toObject = function(opt_includeInstance) { return proto.eraftpb.ConfState.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.eraftpb.ConfState} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.eraftpb.ConfState.toObject = function(includeInstance, msg) { var f, obj = { nodesList: jspb.Message.getRepeatedField(msg, 1), learnersList: jspb.Message.getRepeatedField(msg, 2) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.eraftpb.ConfState} */ proto.eraftpb.ConfState.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.eraftpb.ConfState; return proto.eraftpb.ConfState.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.eraftpb.ConfState} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.eraftpb.ConfState} */ proto.eraftpb.ConfState.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {!Array} */ (reader.readPackedUint64()); msg.setNodesList(value); break; case 2: var value = /** @type {!Array} */ (reader.readPackedUint64()); msg.setLearnersList(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.eraftpb.ConfState.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.eraftpb.ConfState.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.eraftpb.ConfState} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.eraftpb.ConfState.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getNodesList(); if (f.length > 0) { writer.writePackedUint64( 1, f ); } f = message.getLearnersList(); if (f.length > 0) { writer.writePackedUint64( 2, f ); } }; /** * repeated uint64 nodes = 1; * @return {!Array} */ proto.eraftpb.ConfState.prototype.getNodesList = function() { return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); }; /** @param {!Array} value */ proto.eraftpb.ConfState.prototype.setNodesList = function(value) { jspb.Message.setField(this, 1, value || []); }; /** * @param {!number} value * @param {number=} opt_index */ proto.eraftpb.ConfState.prototype.addNodes = function(value, opt_index) { jspb.Message.addToRepeatedField(this, 1, value, opt_index); }; proto.eraftpb.ConfState.prototype.clearNodesList = function() { this.setNodesList([]); }; /** * repeated uint64 learners = 2; * @return {!Array} */ proto.eraftpb.ConfState.prototype.getLearnersList = function() { return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); }; /** @param {!Array} value */ proto.eraftpb.ConfState.prototype.setLearnersList = function(value) { jspb.Message.setField(this, 2, value || []); }; /** * @param {!number} value * @param {number=} opt_index */ proto.eraftpb.ConfState.prototype.addLearners = function(value, opt_index) { jspb.Message.addToRepeatedField(this, 2, value, opt_index); }; proto.eraftpb.ConfState.prototype.clearLearnersList = function() { this.setLearnersList([]); }; /** * 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.eraftpb.ConfChange = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.eraftpb.ConfChange, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.eraftpb.ConfChange.displayName = 'proto.eraftpb.ConfChange'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.eraftpb.ConfChange.prototype.toObject = function(opt_includeInstance) { return proto.eraftpb.ConfChange.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.eraftpb.ConfChange} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.eraftpb.ConfChange.toObject = function(includeInstance, msg) { var f, obj = { id: jspb.Message.getFieldWithDefault(msg, 1, 0), changeType: jspb.Message.getFieldWithDefault(msg, 2, 0), nodeId: jspb.Message.getFieldWithDefault(msg, 3, 0), context: msg.getContext_asB64() }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.eraftpb.ConfChange} */ proto.eraftpb.ConfChange.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.eraftpb.ConfChange; return proto.eraftpb.ConfChange.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.eraftpb.ConfChange} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.eraftpb.ConfChange} */ proto.eraftpb.ConfChange.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readUint64()); msg.setId(value); break; case 2: var value = /** @type {!proto.eraftpb.ConfChangeType} */ (reader.readEnum()); msg.setChangeType(value); break; case 3: var value = /** @type {number} */ (reader.readUint64()); msg.setNodeId(value); break; case 4: var value = /** @type {!Uint8Array} */ (reader.readBytes()); msg.setContext(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.eraftpb.ConfChange.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.eraftpb.ConfChange.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.eraftpb.ConfChange} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.eraftpb.ConfChange.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getId(); if (f !== 0) { writer.writeUint64( 1, f ); } f = message.getChangeType(); if (f !== 0.0) { writer.writeEnum( 2, f ); } f = message.getNodeId(); if (f !== 0) { writer.writeUint64( 3, f ); } f = message.getContext_asU8(); if (f.length > 0) { writer.writeBytes( 4, f ); } }; /** * optional uint64 id = 1; * @return {number} */ proto.eraftpb.ConfChange.prototype.getId = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** @param {number} value */ proto.eraftpb.ConfChange.prototype.setId = function(value) { jspb.Message.setProto3IntField(this, 1, value); }; /** * optional ConfChangeType change_type = 2; * @return {!proto.eraftpb.ConfChangeType} */ proto.eraftpb.ConfChange.prototype.getChangeType = function() { return /** @type {!proto.eraftpb.ConfChangeType} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** @param {!proto.eraftpb.ConfChangeType} value */ proto.eraftpb.ConfChange.prototype.setChangeType = function(value) { jspb.Message.setProto3EnumField(this, 2, value); }; /** * optional uint64 node_id = 3; * @return {number} */ proto.eraftpb.ConfChange.prototype.getNodeId = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** @param {number} value */ proto.eraftpb.ConfChange.prototype.setNodeId = function(value) { jspb.Message.setProto3IntField(this, 3, value); }; /** * optional bytes context = 4; * @return {string} */ proto.eraftpb.ConfChange.prototype.getContext = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; /** * optional bytes context = 4; * This is a type-conversion wrapper around `getContext()` * @return {string} */ proto.eraftpb.ConfChange.prototype.getContext_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getContext())); }; /** * optional bytes context = 4; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array * This is a type-conversion wrapper around `getContext()` * @return {!Uint8Array} */ proto.eraftpb.ConfChange.prototype.getContext_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getContext())); }; /** @param {!(string|Uint8Array)} value */ proto.eraftpb.ConfChange.prototype.setContext = function(value) { jspb.Message.setProto3BytesField(this, 4, value); }; /** * @enum {number} */ proto.eraftpb.EntryType = { ENTRYNORMAL: 0, ENTRYCONFCHANGE: 1 }; /** * @enum {number} */ proto.eraftpb.MessageType = { MSGHUP: 0, MSGBEAT: 1, MSGPROPOSE: 2, MSGAPPEND: 3, MSGAPPENDRESPONSE: 4, MSGREQUESTVOTE: 5, MSGREQUESTVOTERESPONSE: 6, MSGSNAPSHOT: 7, MSGHEARTBEAT: 8, MSGHEARTBEATRESPONSE: 9, MSGUNREACHABLE: 10, MSGSNAPSTATUS: 11, MSGCHECKQUORUM: 12, MSGTRANSFERLEADER: 13, MSGTIMEOUTNOW: 14, MSGREADINDEX: 15, MSGREADINDEXRESP: 16, MSGREQUESTPREVOTE: 17, MSGREQUESTPREVOTERESPONSE: 18 }; /** * @enum {number} */ proto.eraftpb.ConfChangeType = { ADDNODE: 0, REMOVENODE: 1, ADDLEARNERNODE: 2 }; goog.object.extend(exports, proto.eraftpb);