UNPKG

@x5e/gink

Version:

an eventually consistent database

282 lines 10.1 kB
// source: bundle.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 change_pb = require('./change_pb.js'); goog.object.extend(proto, change_pb); goog.exportSymbol('proto.google.gink.Bundle', 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.google.gink.Bundle = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.google.gink.Bundle, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.google.gink.Bundle.displayName = 'proto.google.gink.Bundle'; } 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.google.gink.Bundle.prototype.toObject = function (opt_includeInstance) { return proto.google.gink.Bundle.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.google.gink.Bundle} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.google.gink.Bundle.toObject = function (includeInstance, msg) { var f, obj = { timestamp: jspb.Message.getFieldWithDefault(msg, 1, 0), medallion: jspb.Message.getFieldWithDefault(msg, 2, 0), previous: jspb.Message.getFieldWithDefault(msg, 3, 0), comment: jspb.Message.getFieldWithDefault(msg, 4, ""), chainStart: jspb.Message.getFieldWithDefault(msg, 5, 0), changesMap: (f = msg.getChangesMap()) ? f.toObject(includeInstance, proto.google.gink.Change.toObject) : [] }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.google.gink.Bundle} */ proto.google.gink.Bundle.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.google.gink.Bundle; return proto.google.gink.Bundle.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.google.gink.Bundle} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.google.gink.Bundle} */ proto.google.gink.Bundle.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.setTimestamp(value); break; case 2: var value = /** @type {number} */ (reader.readUint64()); msg.setMedallion(value); break; case 3: var value = /** @type {number} */ (reader.readUint64()); msg.setPrevious(value); break; case 4: var value = /** @type {string} */ (reader.readString()); msg.setComment(value); break; case 5: var value = /** @type {number} */ (reader.readUint64()); msg.setChainStart(value); break; case 6: var value = msg.getChangesMap(); reader.readMessage(value, function (message, reader) { jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readUint32, jspb.BinaryReader.prototype.readMessage, proto.google.gink.Change.deserializeBinaryFromReader, 0, new proto.google.gink.Change()); }); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.google.gink.Bundle.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.google.gink.Bundle.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.google.gink.Bundle} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.google.gink.Bundle.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getTimestamp(); if (f !== 0) { writer.writeUint64(1, f); } f = message.getMedallion(); if (f !== 0) { writer.writeUint64(2, f); } f = message.getPrevious(); if (f !== 0) { writer.writeUint64(3, f); } f = message.getComment(); if (f.length > 0) { writer.writeString(4, f); } f = message.getChainStart(); if (f !== 0) { writer.writeUint64(5, f); } f = message.getChangesMap(true); if (f && f.getLength() > 0) { f.serializeBinary(6, writer, jspb.BinaryWriter.prototype.writeUint32, jspb.BinaryWriter.prototype.writeMessage, proto.google.gink.Change.serializeBinaryToWriter); } }; /** * optional uint64 timestamp = 1; * @return {number} */ proto.google.gink.Bundle.prototype.getTimestamp = function () { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** * @param {number} value * @return {!proto.google.gink.Bundle} returns this */ proto.google.gink.Bundle.prototype.setTimestamp = function (value) { return jspb.Message.setProto3IntField(this, 1, value); }; /** * optional uint64 medallion = 2; * @return {number} */ proto.google.gink.Bundle.prototype.getMedallion = function () { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** * @param {number} value * @return {!proto.google.gink.Bundle} returns this */ proto.google.gink.Bundle.prototype.setMedallion = function (value) { return jspb.Message.setProto3IntField(this, 2, value); }; /** * optional uint64 previous = 3; * @return {number} */ proto.google.gink.Bundle.prototype.getPrevious = function () { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** * @param {number} value * @return {!proto.google.gink.Bundle} returns this */ proto.google.gink.Bundle.prototype.setPrevious = function (value) { return jspb.Message.setProto3IntField(this, 3, value); }; /** * optional string comment = 4; * @return {string} */ proto.google.gink.Bundle.prototype.getComment = function () { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; /** * @param {string} value * @return {!proto.google.gink.Bundle} returns this */ proto.google.gink.Bundle.prototype.setComment = function (value) { return jspb.Message.setProto3StringField(this, 4, value); }; /** * optional uint64 chain_start = 5; * @return {number} */ proto.google.gink.Bundle.prototype.getChainStart = function () { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); }; /** * @param {number} value * @return {!proto.google.gink.Bundle} returns this */ proto.google.gink.Bundle.prototype.setChainStart = function (value) { return jspb.Message.setProto3IntField(this, 5, value); }; /** * map<uint32, Change> changes = 6; * @param {boolean=} opt_noLazyCreate Do not create the map if * empty, instead returning `undefined` * @return {!jspb.Map<number,!proto.google.gink.Change>} */ proto.google.gink.Bundle.prototype.getChangesMap = function (opt_noLazyCreate) { return /** @type {!jspb.Map<number,!proto.google.gink.Change>} */ (jspb.Message.getMapField(this, 6, opt_noLazyCreate, proto.google.gink.Change)); }; /** * Clears values from the map. The map will be non-null. * @return {!proto.google.gink.Bundle} returns this */ proto.google.gink.Bundle.prototype.clearChangesMap = function () { this.getChangesMap().clear(); return this; }; goog.object.extend(exports, proto.google.gink); //# sourceMappingURL=bundle_pb.js.map