@digitalasset/daml-ledger
Version:
DAML Ledger API Node.js bindings
311 lines (268 loc) • 9.46 kB
JavaScript
// source: com/daml/ledger/api/v1/trace_context.proto
/**
* @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')();
var google_protobuf_wrappers_pb = require('google-protobuf/google/protobuf/wrappers_pb.js');
goog.object.extend(proto, google_protobuf_wrappers_pb);
goog.exportSymbol('proto.com.daml.ledger.api.v1.TraceContext', 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.com.daml.ledger.api.v1.TraceContext = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.com.daml.ledger.api.v1.TraceContext, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.com.daml.ledger.api.v1.TraceContext.displayName = 'proto.com.daml.ledger.api.v1.TraceContext';
}
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.com.daml.ledger.api.v1.TraceContext.prototype.toObject = function(opt_includeInstance) {
return proto.com.daml.ledger.api.v1.TraceContext.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.com.daml.ledger.api.v1.TraceContext} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.com.daml.ledger.api.v1.TraceContext.toObject = function(includeInstance, msg) {
var f, obj = {
traceIdHigh: jspb.Message.getFieldWithDefault(msg, 1, "0"),
traceId: jspb.Message.getFieldWithDefault(msg, 2, "0"),
spanId: jspb.Message.getFieldWithDefault(msg, 3, "0"),
parentSpanId: (f = msg.getParentSpanId()) && google_protobuf_wrappers_pb.UInt64Value.toObject(includeInstance, f),
sampled: jspb.Message.getBooleanFieldWithDefault(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.com.daml.ledger.api.v1.TraceContext}
*/
proto.com.daml.ledger.api.v1.TraceContext.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.com.daml.ledger.api.v1.TraceContext;
return proto.com.daml.ledger.api.v1.TraceContext.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.com.daml.ledger.api.v1.TraceContext} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.com.daml.ledger.api.v1.TraceContext}
*/
proto.com.daml.ledger.api.v1.TraceContext.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readUint64String());
msg.setTraceIdHigh(value);
break;
case 2:
var value = /** @type {string} */ (reader.readUint64String());
msg.setTraceId(value);
break;
case 3:
var value = /** @type {string} */ (reader.readUint64String());
msg.setSpanId(value);
break;
case 4:
var value = new google_protobuf_wrappers_pb.UInt64Value;
reader.readMessage(value,google_protobuf_wrappers_pb.UInt64Value.deserializeBinaryFromReader);
msg.setParentSpanId(value);
break;
case 5:
var value = /** @type {boolean} */ (reader.readBool());
msg.setSampled(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.com.daml.ledger.api.v1.TraceContext.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.com.daml.ledger.api.v1.TraceContext.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.com.daml.ledger.api.v1.TraceContext} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.com.daml.ledger.api.v1.TraceContext.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getTraceIdHigh();
if (parseInt(f, 10) !== 0) {
writer.writeUint64String(
1,
f
);
}
f = message.getTraceId();
if (parseInt(f, 10) !== 0) {
writer.writeUint64String(
2,
f
);
}
f = message.getSpanId();
if (parseInt(f, 10) !== 0) {
writer.writeUint64String(
3,
f
);
}
f = message.getParentSpanId();
if (f != null) {
writer.writeMessage(
4,
f,
google_protobuf_wrappers_pb.UInt64Value.serializeBinaryToWriter
);
}
f = message.getSampled();
if (f) {
writer.writeBool(
5,
f
);
}
};
/**
* optional uint64 trace_id_high = 1;
* @return {string}
*/
proto.com.daml.ledger.api.v1.TraceContext.prototype.getTraceIdHigh = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0"));
};
/**
* @param {string} value
* @return {!proto.com.daml.ledger.api.v1.TraceContext} returns this
*/
proto.com.daml.ledger.api.v1.TraceContext.prototype.setTraceIdHigh = function(value) {
return jspb.Message.setProto3StringIntField(this, 1, value);
};
/**
* optional uint64 trace_id = 2;
* @return {string}
*/
proto.com.daml.ledger.api.v1.TraceContext.prototype.getTraceId = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "0"));
};
/**
* @param {string} value
* @return {!proto.com.daml.ledger.api.v1.TraceContext} returns this
*/
proto.com.daml.ledger.api.v1.TraceContext.prototype.setTraceId = function(value) {
return jspb.Message.setProto3StringIntField(this, 2, value);
};
/**
* optional uint64 span_id = 3;
* @return {string}
*/
proto.com.daml.ledger.api.v1.TraceContext.prototype.getSpanId = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "0"));
};
/**
* @param {string} value
* @return {!proto.com.daml.ledger.api.v1.TraceContext} returns this
*/
proto.com.daml.ledger.api.v1.TraceContext.prototype.setSpanId = function(value) {
return jspb.Message.setProto3StringIntField(this, 3, value);
};
/**
* optional google.protobuf.UInt64Value parent_span_id = 4;
* @return {?proto.google.protobuf.UInt64Value}
*/
proto.com.daml.ledger.api.v1.TraceContext.prototype.getParentSpanId = function() {
return /** @type{?proto.google.protobuf.UInt64Value} */ (
jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.UInt64Value, 4));
};
/**
* @param {?proto.google.protobuf.UInt64Value|undefined} value
* @return {!proto.com.daml.ledger.api.v1.TraceContext} returns this
*/
proto.com.daml.ledger.api.v1.TraceContext.prototype.setParentSpanId = function(value) {
return jspb.Message.setWrapperField(this, 4, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.com.daml.ledger.api.v1.TraceContext} returns this
*/
proto.com.daml.ledger.api.v1.TraceContext.prototype.clearParentSpanId = function() {
return this.setParentSpanId(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.com.daml.ledger.api.v1.TraceContext.prototype.hasParentSpanId = function() {
return jspb.Message.getField(this, 4) != null;
};
/**
* optional bool sampled = 5;
* @return {boolean}
*/
proto.com.daml.ledger.api.v1.TraceContext.prototype.getSampled = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false));
};
/**
* @param {boolean} value
* @return {!proto.com.daml.ledger.api.v1.TraceContext} returns this
*/
proto.com.daml.ledger.api.v1.TraceContext.prototype.setSampled = function(value) {
return jspb.Message.setProto3BooleanField(this, 5, value);
};
goog.object.extend(exports, proto.com.daml.ledger.api.v1);