UNPKG

@tronscan/client

Version:
1,382 lines (1,174 loc) 39.9 kB
/** * @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.protocol.BackupMessage', null, global); goog.exportSymbol('proto.protocol.Endpoint', null, global); goog.exportSymbol('proto.protocol.FindNeighbours', null, global); goog.exportSymbol('proto.protocol.Neighbours', null, global); goog.exportSymbol('proto.protocol.PingMessage', null, global); goog.exportSymbol('proto.protocol.PongMessage', 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.protocol.Endpoint = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.protocol.Endpoint, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.protocol.Endpoint.displayName = 'proto.protocol.Endpoint'; } 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_<name>, 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.protocol.Endpoint.prototype.toObject = function(opt_includeInstance) { return proto.protocol.Endpoint.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.protocol.Endpoint} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.protocol.Endpoint.toObject = function(includeInstance, msg) { var f, obj = { address: msg.getAddress_asB64(), port: jspb.Message.getFieldWithDefault(msg, 2, 0), nodeid: msg.getNodeid_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.protocol.Endpoint} */ proto.protocol.Endpoint.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.protocol.Endpoint; return proto.protocol.Endpoint.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.protocol.Endpoint} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.protocol.Endpoint} */ proto.protocol.Endpoint.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.setAddress(value); break; case 2: var value = /** @type {number} */ (reader.readInt32()); msg.setPort(value); break; case 3: var value = /** @type {!Uint8Array} */ (reader.readBytes()); msg.setNodeid(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.protocol.Endpoint.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.protocol.Endpoint.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.protocol.Endpoint} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.protocol.Endpoint.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getAddress_asU8(); if (f.length > 0) { writer.writeBytes( 1, f ); } f = message.getPort(); if (f !== 0) { writer.writeInt32( 2, f ); } f = message.getNodeid_asU8(); if (f.length > 0) { writer.writeBytes( 3, f ); } }; /** * optional bytes address = 1; * @return {!(string|Uint8Array)} */ proto.protocol.Endpoint.prototype.getAddress = function() { return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * optional bytes address = 1; * This is a type-conversion wrapper around `getAddress()` * @return {string} */ proto.protocol.Endpoint.prototype.getAddress_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getAddress())); }; /** * optional bytes address = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array * This is a type-conversion wrapper around `getAddress()` * @return {!Uint8Array} */ proto.protocol.Endpoint.prototype.getAddress_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getAddress())); }; /** @param {!(string|Uint8Array)} value */ proto.protocol.Endpoint.prototype.setAddress = function(value) { jspb.Message.setProto3BytesField(this, 1, value); }; /** * optional int32 port = 2; * @return {number} */ proto.protocol.Endpoint.prototype.getPort = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** @param {number} value */ proto.protocol.Endpoint.prototype.setPort = function(value) { jspb.Message.setProto3IntField(this, 2, value); }; /** * optional bytes nodeId = 3; * @return {!(string|Uint8Array)} */ proto.protocol.Endpoint.prototype.getNodeid = function() { return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** * optional bytes nodeId = 3; * This is a type-conversion wrapper around `getNodeid()` * @return {string} */ proto.protocol.Endpoint.prototype.getNodeid_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getNodeid())); }; /** * optional bytes nodeId = 3; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array * This is a type-conversion wrapper around `getNodeid()` * @return {!Uint8Array} */ proto.protocol.Endpoint.prototype.getNodeid_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getNodeid())); }; /** @param {!(string|Uint8Array)} value */ proto.protocol.Endpoint.prototype.setNodeid = function(value) { jspb.Message.setProto3BytesField(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.protocol.PingMessage = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.protocol.PingMessage, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.protocol.PingMessage.displayName = 'proto.protocol.PingMessage'; } 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_<name>, 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.protocol.PingMessage.prototype.toObject = function(opt_includeInstance) { return proto.protocol.PingMessage.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.protocol.PingMessage} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.protocol.PingMessage.toObject = function(includeInstance, msg) { var f, obj = { from: (f = msg.getFrom()) && proto.protocol.Endpoint.toObject(includeInstance, f), to: (f = msg.getTo()) && proto.protocol.Endpoint.toObject(includeInstance, f), version: jspb.Message.getFieldWithDefault(msg, 3, 0), timestamp: jspb.Message.getFieldWithDefault(msg, 4, 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.protocol.PingMessage} */ proto.protocol.PingMessage.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.protocol.PingMessage; return proto.protocol.PingMessage.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.protocol.PingMessage} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.protocol.PingMessage} */ proto.protocol.PingMessage.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto.protocol.Endpoint; reader.readMessage(value,proto.protocol.Endpoint.deserializeBinaryFromReader); msg.setFrom(value); break; case 2: var value = new proto.protocol.Endpoint; reader.readMessage(value,proto.protocol.Endpoint.deserializeBinaryFromReader); msg.setTo(value); break; case 3: var value = /** @type {number} */ (reader.readInt32()); msg.setVersion(value); break; case 4: var value = /** @type {number} */ (reader.readInt64()); msg.setTimestamp(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.protocol.PingMessage.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.protocol.PingMessage.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.protocol.PingMessage} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.protocol.PingMessage.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getFrom(); if (f != null) { writer.writeMessage( 1, f, proto.protocol.Endpoint.serializeBinaryToWriter ); } f = message.getTo(); if (f != null) { writer.writeMessage( 2, f, proto.protocol.Endpoint.serializeBinaryToWriter ); } f = message.getVersion(); if (f !== 0) { writer.writeInt32( 3, f ); } f = message.getTimestamp(); if (f !== 0) { writer.writeInt64( 4, f ); } }; /** * optional Endpoint from = 1; * @return {?proto.protocol.Endpoint} */ proto.protocol.PingMessage.prototype.getFrom = function() { return /** @type{?proto.protocol.Endpoint} */ ( jspb.Message.getWrapperField(this, proto.protocol.Endpoint, 1)); }; /** @param {?proto.protocol.Endpoint|undefined} value */ proto.protocol.PingMessage.prototype.setFrom = function(value) { jspb.Message.setWrapperField(this, 1, value); }; proto.protocol.PingMessage.prototype.clearFrom = function() { this.setFrom(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.protocol.PingMessage.prototype.hasFrom = function() { return jspb.Message.getField(this, 1) != null; }; /** * optional Endpoint to = 2; * @return {?proto.protocol.Endpoint} */ proto.protocol.PingMessage.prototype.getTo = function() { return /** @type{?proto.protocol.Endpoint} */ ( jspb.Message.getWrapperField(this, proto.protocol.Endpoint, 2)); }; /** @param {?proto.protocol.Endpoint|undefined} value */ proto.protocol.PingMessage.prototype.setTo = function(value) { jspb.Message.setWrapperField(this, 2, value); }; proto.protocol.PingMessage.prototype.clearTo = function() { this.setTo(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.protocol.PingMessage.prototype.hasTo = function() { return jspb.Message.getField(this, 2) != null; }; /** * optional int32 version = 3; * @return {number} */ proto.protocol.PingMessage.prototype.getVersion = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** @param {number} value */ proto.protocol.PingMessage.prototype.setVersion = function(value) { jspb.Message.setProto3IntField(this, 3, value); }; /** * optional int64 timestamp = 4; * @return {number} */ proto.protocol.PingMessage.prototype.getTimestamp = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); }; /** @param {number} value */ proto.protocol.PingMessage.prototype.setTimestamp = function(value) { jspb.Message.setProto3IntField(this, 4, 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.protocol.PongMessage = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.protocol.PongMessage, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.protocol.PongMessage.displayName = 'proto.protocol.PongMessage'; } 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_<name>, 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.protocol.PongMessage.prototype.toObject = function(opt_includeInstance) { return proto.protocol.PongMessage.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.protocol.PongMessage} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.protocol.PongMessage.toObject = function(includeInstance, msg) { var f, obj = { from: (f = msg.getFrom()) && proto.protocol.Endpoint.toObject(includeInstance, f), echo: jspb.Message.getFieldWithDefault(msg, 2, 0), timestamp: 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.protocol.PongMessage} */ proto.protocol.PongMessage.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.protocol.PongMessage; return proto.protocol.PongMessage.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.protocol.PongMessage} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.protocol.PongMessage} */ proto.protocol.PongMessage.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto.protocol.Endpoint; reader.readMessage(value,proto.protocol.Endpoint.deserializeBinaryFromReader); msg.setFrom(value); break; case 2: var value = /** @type {number} */ (reader.readInt32()); msg.setEcho(value); break; case 3: var value = /** @type {number} */ (reader.readInt64()); msg.setTimestamp(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.protocol.PongMessage.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.protocol.PongMessage.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.protocol.PongMessage} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.protocol.PongMessage.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getFrom(); if (f != null) { writer.writeMessage( 1, f, proto.protocol.Endpoint.serializeBinaryToWriter ); } f = message.getEcho(); if (f !== 0) { writer.writeInt32( 2, f ); } f = message.getTimestamp(); if (f !== 0) { writer.writeInt64( 3, f ); } }; /** * optional Endpoint from = 1; * @return {?proto.protocol.Endpoint} */ proto.protocol.PongMessage.prototype.getFrom = function() { return /** @type{?proto.protocol.Endpoint} */ ( jspb.Message.getWrapperField(this, proto.protocol.Endpoint, 1)); }; /** @param {?proto.protocol.Endpoint|undefined} value */ proto.protocol.PongMessage.prototype.setFrom = function(value) { jspb.Message.setWrapperField(this, 1, value); }; proto.protocol.PongMessage.prototype.clearFrom = function() { this.setFrom(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.protocol.PongMessage.prototype.hasFrom = function() { return jspb.Message.getField(this, 1) != null; }; /** * optional int32 echo = 2; * @return {number} */ proto.protocol.PongMessage.prototype.getEcho = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** @param {number} value */ proto.protocol.PongMessage.prototype.setEcho = function(value) { jspb.Message.setProto3IntField(this, 2, value); }; /** * optional int64 timestamp = 3; * @return {number} */ proto.protocol.PongMessage.prototype.getTimestamp = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** @param {number} value */ proto.protocol.PongMessage.prototype.setTimestamp = 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.protocol.FindNeighbours = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.protocol.FindNeighbours, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.protocol.FindNeighbours.displayName = 'proto.protocol.FindNeighbours'; } 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_<name>, 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.protocol.FindNeighbours.prototype.toObject = function(opt_includeInstance) { return proto.protocol.FindNeighbours.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.protocol.FindNeighbours} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.protocol.FindNeighbours.toObject = function(includeInstance, msg) { var f, obj = { from: (f = msg.getFrom()) && proto.protocol.Endpoint.toObject(includeInstance, f), targetid: msg.getTargetid_asB64(), timestamp: 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.protocol.FindNeighbours} */ proto.protocol.FindNeighbours.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.protocol.FindNeighbours; return proto.protocol.FindNeighbours.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.protocol.FindNeighbours} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.protocol.FindNeighbours} */ proto.protocol.FindNeighbours.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto.protocol.Endpoint; reader.readMessage(value,proto.protocol.Endpoint.deserializeBinaryFromReader); msg.setFrom(value); break; case 2: var value = /** @type {!Uint8Array} */ (reader.readBytes()); msg.setTargetid(value); break; case 3: var value = /** @type {number} */ (reader.readInt64()); msg.setTimestamp(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.protocol.FindNeighbours.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.protocol.FindNeighbours.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.protocol.FindNeighbours} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.protocol.FindNeighbours.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getFrom(); if (f != null) { writer.writeMessage( 1, f, proto.protocol.Endpoint.serializeBinaryToWriter ); } f = message.getTargetid_asU8(); if (f.length > 0) { writer.writeBytes( 2, f ); } f = message.getTimestamp(); if (f !== 0) { writer.writeInt64( 3, f ); } }; /** * optional Endpoint from = 1; * @return {?proto.protocol.Endpoint} */ proto.protocol.FindNeighbours.prototype.getFrom = function() { return /** @type{?proto.protocol.Endpoint} */ ( jspb.Message.getWrapperField(this, proto.protocol.Endpoint, 1)); }; /** @param {?proto.protocol.Endpoint|undefined} value */ proto.protocol.FindNeighbours.prototype.setFrom = function(value) { jspb.Message.setWrapperField(this, 1, value); }; proto.protocol.FindNeighbours.prototype.clearFrom = function() { this.setFrom(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.protocol.FindNeighbours.prototype.hasFrom = function() { return jspb.Message.getField(this, 1) != null; }; /** * optional bytes targetId = 2; * @return {!(string|Uint8Array)} */ proto.protocol.FindNeighbours.prototype.getTargetid = function() { return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * optional bytes targetId = 2; * This is a type-conversion wrapper around `getTargetid()` * @return {string} */ proto.protocol.FindNeighbours.prototype.getTargetid_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getTargetid())); }; /** * optional bytes targetId = 2; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array * This is a type-conversion wrapper around `getTargetid()` * @return {!Uint8Array} */ proto.protocol.FindNeighbours.prototype.getTargetid_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getTargetid())); }; /** @param {!(string|Uint8Array)} value */ proto.protocol.FindNeighbours.prototype.setTargetid = function(value) { jspb.Message.setProto3BytesField(this, 2, value); }; /** * optional int64 timestamp = 3; * @return {number} */ proto.protocol.FindNeighbours.prototype.getTimestamp = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** @param {number} value */ proto.protocol.FindNeighbours.prototype.setTimestamp = 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.protocol.Neighbours = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, proto.protocol.Neighbours.repeatedFields_, null); }; goog.inherits(proto.protocol.Neighbours, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.protocol.Neighbours.displayName = 'proto.protocol.Neighbours'; } /** * List of repeated fields within this message type. * @private {!Array<number>} * @const */ proto.protocol.Neighbours.repeatedFields_ = [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_<name>, 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.protocol.Neighbours.prototype.toObject = function(opt_includeInstance) { return proto.protocol.Neighbours.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.protocol.Neighbours} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.protocol.Neighbours.toObject = function(includeInstance, msg) { var f, obj = { from: (f = msg.getFrom()) && proto.protocol.Endpoint.toObject(includeInstance, f), neighboursList: jspb.Message.toObjectList(msg.getNeighboursList(), proto.protocol.Endpoint.toObject, includeInstance), timestamp: 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.protocol.Neighbours} */ proto.protocol.Neighbours.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.protocol.Neighbours; return proto.protocol.Neighbours.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.protocol.Neighbours} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.protocol.Neighbours} */ proto.protocol.Neighbours.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto.protocol.Endpoint; reader.readMessage(value,proto.protocol.Endpoint.deserializeBinaryFromReader); msg.setFrom(value); break; case 2: var value = new proto.protocol.Endpoint; reader.readMessage(value,proto.protocol.Endpoint.deserializeBinaryFromReader); msg.addNeighbours(value); break; case 3: var value = /** @type {number} */ (reader.readInt64()); msg.setTimestamp(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.protocol.Neighbours.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.protocol.Neighbours.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.protocol.Neighbours} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.protocol.Neighbours.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getFrom(); if (f != null) { writer.writeMessage( 1, f, proto.protocol.Endpoint.serializeBinaryToWriter ); } f = message.getNeighboursList(); if (f.length > 0) { writer.writeRepeatedMessage( 2, f, proto.protocol.Endpoint.serializeBinaryToWriter ); } f = message.getTimestamp(); if (f !== 0) { writer.writeInt64( 3, f ); } }; /** * optional Endpoint from = 1; * @return {?proto.protocol.Endpoint} */ proto.protocol.Neighbours.prototype.getFrom = function() { return /** @type{?proto.protocol.Endpoint} */ ( jspb.Message.getWrapperField(this, proto.protocol.Endpoint, 1)); }; /** @param {?proto.protocol.Endpoint|undefined} value */ proto.protocol.Neighbours.prototype.setFrom = function(value) { jspb.Message.setWrapperField(this, 1, value); }; proto.protocol.Neighbours.prototype.clearFrom = function() { this.setFrom(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.protocol.Neighbours.prototype.hasFrom = function() { return jspb.Message.getField(this, 1) != null; }; /** * repeated Endpoint neighbours = 2; * @return {!Array.<!proto.protocol.Endpoint>} */ proto.protocol.Neighbours.prototype.getNeighboursList = function() { return /** @type{!Array.<!proto.protocol.Endpoint>} */ ( jspb.Message.getRepeatedWrapperField(this, proto.protocol.Endpoint, 2)); }; /** @param {!Array.<!proto.protocol.Endpoint>} value */ proto.protocol.Neighbours.prototype.setNeighboursList = function(value) { jspb.Message.setRepeatedWrapperField(this, 2, value); }; /** * @param {!proto.protocol.Endpoint=} opt_value * @param {number=} opt_index * @return {!proto.protocol.Endpoint} */ proto.protocol.Neighbours.prototype.addNeighbours = function(opt_value, opt_index) { return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.protocol.Endpoint, opt_index); }; proto.protocol.Neighbours.prototype.clearNeighboursList = function() { this.setNeighboursList([]); }; /** * optional int64 timestamp = 3; * @return {number} */ proto.protocol.Neighbours.prototype.getTimestamp = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** @param {number} value */ proto.protocol.Neighbours.prototype.setTimestamp = 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.protocol.BackupMessage = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.protocol.BackupMessage, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.protocol.BackupMessage.displayName = 'proto.protocol.BackupMessage'; } 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_<name>, 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.protocol.BackupMessage.prototype.toObject = function(opt_includeInstance) { return proto.protocol.BackupMessage.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.protocol.BackupMessage} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.protocol.BackupMessage.toObject = function(includeInstance, msg) { var f, obj = { flag: jspb.Message.getFieldWithDefault(msg, 1, false), priority: jspb.Message.getFieldWithDefault(msg, 2, 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.protocol.BackupMessage} */ proto.protocol.BackupMessage.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.protocol.BackupMessage; return proto.protocol.BackupMessage.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.protocol.BackupMessage} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.protocol.BackupMessage} */ proto.protocol.BackupMessage.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {boolean} */ (reader.readBool()); msg.setFlag(value); break; case 2: var value = /** @type {number} */ (reader.readInt32()); msg.setPriority(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.protocol.BackupMessage.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.protocol.BackupMessage.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.protocol.BackupMessage} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.protocol.BackupMessage.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getFlag(); if (f) { writer.writeBool( 1, f ); } f = message.getPriority(); if (f !== 0) { writer.writeInt32( 2, f ); } }; /** * optional bool flag = 1; * 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.protocol.BackupMessage.prototype.getFlag = function() { return /** @type {boolean} */ (jspb.Message.getFieldWithDefault(this, 1, false)); }; /** @param {boolean} value */ proto.protocol.BackupMessage.prototype.setFlag = function(value) { jspb.Message.setProto3BooleanField(this, 1, value); }; /** * optional int32 priority = 2; * @return {number} */ proto.protocol.BackupMessage.prototype.getPriority = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** @param {number} value */ proto.protocol.BackupMessage.prototype.setPriority = function(value) { jspb.Message.setProto3IntField(this, 2, value); }; goog.object.extend(exports, proto.protocol);