services: utility methods for create binlog protos

This commit is contained in:
Spencer Fang 2017-12-17 16:21:01 -08:00 committed by zpencer
parent 610066896f
commit 0191d0d555
17 changed files with 5997 additions and 2 deletions

View File

@ -13,7 +13,8 @@ description = "gRPC: Services"
dependencies {
compile project(':grpc-protobuf'),
project(':grpc-stub')
testCompile project(':grpc-testing')
testCompile project(':grpc-testing'),
libraries.netty_epoll // for DomainSocketAddress
signature "org.codehaus.mojo.signature:java16:1.1@signature"
}

View File

@ -0,0 +1,133 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: io/grpc/binarylog.proto
package io.grpc.binarylog;
public final class BinaryLogProto {
private BinaryLogProto() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistryLite registry) {
}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
registerAllExtensions(
(com.google.protobuf.ExtensionRegistryLite) registry);
}
static final com.google.protobuf.Descriptors.Descriptor
internal_static_grpc_binarylog_v1alpha_GrpcLogEntry_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_grpc_binarylog_v1alpha_GrpcLogEntry_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor
internal_static_grpc_binarylog_v1alpha_Message_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_grpc_binarylog_v1alpha_Message_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor
internal_static_grpc_binarylog_v1alpha_Metadata_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_grpc_binarylog_v1alpha_Metadata_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor
internal_static_grpc_binarylog_v1alpha_MetadataEntry_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_grpc_binarylog_v1alpha_MetadataEntry_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor
internal_static_grpc_binarylog_v1alpha_Peer_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_grpc_binarylog_v1alpha_Peer_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor
internal_static_grpc_binarylog_v1alpha_Uint128_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_grpc_binarylog_v1alpha_Uint128_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\027io/grpc/binarylog.proto\022\026grpc.binarylo" +
"g.v1alpha\"\224\004\n\014GrpcLogEntry\0227\n\004type\030\001 \001(\016" +
"2).grpc.binarylog.v1alpha.GrpcLogEntry.T" +
"ype\022;\n\006logger\030\002 \001(\0162+.grpc.binarylog.v1a" +
"lpha.GrpcLogEntry.Logger\0220\n\007call_id\030\003 \001(" +
"\0132\037.grpc.binarylog.v1alpha.Uint128\0224\n\010me" +
"tadata\030\004 \001(\0132 .grpc.binarylog.v1alpha.Me" +
"tadataH\000\0222\n\007message\030\005 \001(\0132\037.grpc.binaryl" +
"og.v1alpha.MessageH\000\022*\n\004peer\030\006 \001(\0132\034.grp" +
"c.binarylog.v1alpha.Peer\"\230\001\n\004Type\022\031\n\025SEN" +
"D_INITIAL_METADATA\020\000\022\032\n\026SEND_TRAILING_ME" +
"TADATA\020\001\022\020\n\014SEND_MESSAGE\020\002\022\031\n\025RECV_INITI" +
"AL_METADATA\020\003\022\032\n\026RECV_TRAILING_METADATA\020" +
"\004\022\020\n\014RECV_MESSAGE\020\005\" \n\006Logger\022\n\n\006CLIENT\020" +
"\000\022\n\n\006SERVER\020\001B\t\n\007payload\"6\n\007Message\022\r\n\005f" +
"lags\030\001 \001(\r\022\016\n\006length\030\002 \001(\r\022\014\n\004data\030\003 \001(\014" +
"\"@\n\010Metadata\0224\n\005entry\030\001 \003(\0132%.grpc.binar" +
"ylog.v1alpha.MetadataEntry\"+\n\rMetadataEn" +
"try\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\014\"\207\001\n\004Peer" +
"\0228\n\tpeer_type\030\001 \001(\0162%.grpc.binarylog.v1a" +
"lpha.Peer.PeerType\022\014\n\004peer\030\002 \001(\014\"7\n\010Peer" +
"Type\022\r\n\tPEER_IPV4\020\000\022\r\n\tPEER_IPV6\020\001\022\r\n\tPE" +
"ER_UNIX\020\002\"$\n\007Uint128\022\014\n\004high\030\001 \001(\006\022\013\n\003lo" +
"w\030\002 \001(\006B%\n\021io.grpc.binarylogB\016BinaryLogP" +
"rotoP\001b\006proto3"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
public com.google.protobuf.ExtensionRegistry assignDescriptors(
com.google.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
return null;
}
};
com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
}, assigner);
internal_static_grpc_binarylog_v1alpha_GrpcLogEntry_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_grpc_binarylog_v1alpha_GrpcLogEntry_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_grpc_binarylog_v1alpha_GrpcLogEntry_descriptor,
new java.lang.String[] { "Type", "Logger", "CallId", "Metadata", "Message", "Peer", "Payload", });
internal_static_grpc_binarylog_v1alpha_Message_descriptor =
getDescriptor().getMessageTypes().get(1);
internal_static_grpc_binarylog_v1alpha_Message_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_grpc_binarylog_v1alpha_Message_descriptor,
new java.lang.String[] { "Flags", "Length", "Data", });
internal_static_grpc_binarylog_v1alpha_Metadata_descriptor =
getDescriptor().getMessageTypes().get(2);
internal_static_grpc_binarylog_v1alpha_Metadata_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_grpc_binarylog_v1alpha_Metadata_descriptor,
new java.lang.String[] { "Entry", });
internal_static_grpc_binarylog_v1alpha_MetadataEntry_descriptor =
getDescriptor().getMessageTypes().get(3);
internal_static_grpc_binarylog_v1alpha_MetadataEntry_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_grpc_binarylog_v1alpha_MetadataEntry_descriptor,
new java.lang.String[] { "Key", "Value", });
internal_static_grpc_binarylog_v1alpha_Peer_descriptor =
getDescriptor().getMessageTypes().get(4);
internal_static_grpc_binarylog_v1alpha_Peer_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_grpc_binarylog_v1alpha_Peer_descriptor,
new java.lang.String[] { "PeerType", "Peer", });
internal_static_grpc_binarylog_v1alpha_Uint128_descriptor =
getDescriptor().getMessageTypes().get(5);
internal_static_grpc_binarylog_v1alpha_Uint128_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_grpc_binarylog_v1alpha_Uint128_descriptor,
new java.lang.String[] { "High", "Low", });
}
// @@protoc_insertion_point(outer_class_scope)
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,151 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: io/grpc/binarylog.proto
package io.grpc.binarylog;
public interface GrpcLogEntryOrBuilder extends
// @@protoc_insertion_point(interface_extends:grpc.binarylog.v1alpha.GrpcLogEntry)
com.google.protobuf.MessageOrBuilder {
/**
* <pre>
* One of the above Type enum
* </pre>
*
* <code>.grpc.binarylog.v1alpha.GrpcLogEntry.Type type = 1;</code>
*/
int getTypeValue();
/**
* <pre>
* One of the above Type enum
* </pre>
*
* <code>.grpc.binarylog.v1alpha.GrpcLogEntry.Type type = 1;</code>
*/
io.grpc.binarylog.GrpcLogEntry.Type getType();
/**
* <pre>
* One of the above Logger enum
* </pre>
*
* <code>.grpc.binarylog.v1alpha.GrpcLogEntry.Logger logger = 2;</code>
*/
int getLoggerValue();
/**
* <pre>
* One of the above Logger enum
* </pre>
*
* <code>.grpc.binarylog.v1alpha.GrpcLogEntry.Logger logger = 2;</code>
*/
io.grpc.binarylog.GrpcLogEntry.Logger getLogger();
/**
* <pre>
* Uniquely identifies a call. Each call may have several log entries, they
* will share the same call_id. 128 bits split into 2 64-bit parts.
* </pre>
*
* <code>.grpc.binarylog.v1alpha.Uint128 call_id = 3;</code>
*/
boolean hasCallId();
/**
* <pre>
* Uniquely identifies a call. Each call may have several log entries, they
* will share the same call_id. 128 bits split into 2 64-bit parts.
* </pre>
*
* <code>.grpc.binarylog.v1alpha.Uint128 call_id = 3;</code>
*/
io.grpc.binarylog.Uint128 getCallId();
/**
* <pre>
* Uniquely identifies a call. Each call may have several log entries, they
* will share the same call_id. 128 bits split into 2 64-bit parts.
* </pre>
*
* <code>.grpc.binarylog.v1alpha.Uint128 call_id = 3;</code>
*/
io.grpc.binarylog.Uint128OrBuilder getCallIdOrBuilder();
/**
* <pre>
* Used by CLIENT_INIT_METADATA, SERVER_INIT_METADATA and TRAILING_METADATA
* </pre>
*
* <code>.grpc.binarylog.v1alpha.Metadata metadata = 4;</code>
*/
boolean hasMetadata();
/**
* <pre>
* Used by CLIENT_INIT_METADATA, SERVER_INIT_METADATA and TRAILING_METADATA
* </pre>
*
* <code>.grpc.binarylog.v1alpha.Metadata metadata = 4;</code>
*/
io.grpc.binarylog.Metadata getMetadata();
/**
* <pre>
* Used by CLIENT_INIT_METADATA, SERVER_INIT_METADATA and TRAILING_METADATA
* </pre>
*
* <code>.grpc.binarylog.v1alpha.Metadata metadata = 4;</code>
*/
io.grpc.binarylog.MetadataOrBuilder getMetadataOrBuilder();
/**
* <pre>
* Used by REQUEST and RESPONSE
* </pre>
*
* <code>.grpc.binarylog.v1alpha.Message message = 5;</code>
*/
boolean hasMessage();
/**
* <pre>
* Used by REQUEST and RESPONSE
* </pre>
*
* <code>.grpc.binarylog.v1alpha.Message message = 5;</code>
*/
io.grpc.binarylog.Message getMessage();
/**
* <pre>
* Used by REQUEST and RESPONSE
* </pre>
*
* <code>.grpc.binarylog.v1alpha.Message message = 5;</code>
*/
io.grpc.binarylog.MessageOrBuilder getMessageOrBuilder();
/**
* <pre>
* Peer address information, will only be recorded in SEND_INITIAL_METADATA
* and RECV_INITIAL_METADATA entries.
* </pre>
*
* <code>.grpc.binarylog.v1alpha.Peer peer = 6;</code>
*/
boolean hasPeer();
/**
* <pre>
* Peer address information, will only be recorded in SEND_INITIAL_METADATA
* and RECV_INITIAL_METADATA entries.
* </pre>
*
* <code>.grpc.binarylog.v1alpha.Peer peer = 6;</code>
*/
io.grpc.binarylog.Peer getPeer();
/**
* <pre>
* Peer address information, will only be recorded in SEND_INITIAL_METADATA
* and RECV_INITIAL_METADATA entries.
* </pre>
*
* <code>.grpc.binarylog.v1alpha.Peer peer = 6;</code>
*/
io.grpc.binarylog.PeerOrBuilder getPeerOrBuilder();
public io.grpc.binarylog.GrpcLogEntry.PayloadCase getPayloadCase();
}

View File

@ -0,0 +1,646 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: io/grpc/binarylog.proto
package io.grpc.binarylog;
/**
* <pre>
* Message payload, used by REQUEST and RESPONSE
* </pre>
*
* Protobuf type {@code grpc.binarylog.v1alpha.Message}
*/
public final class Message extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:grpc.binarylog.v1alpha.Message)
MessageOrBuilder {
private static final long serialVersionUID = 0L;
// Use Message.newBuilder() to construct.
private Message(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private Message() {
flags_ = 0;
length_ = 0;
data_ = com.google.protobuf.ByteString.EMPTY;
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private Message(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownFieldProto3(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
case 8: {
flags_ = input.readUInt32();
break;
}
case 16: {
length_ = input.readUInt32();
break;
}
case 26: {
data_ = input.readBytes();
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return io.grpc.binarylog.BinaryLogProto.internal_static_grpc_binarylog_v1alpha_Message_descriptor;
}
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return io.grpc.binarylog.BinaryLogProto.internal_static_grpc_binarylog_v1alpha_Message_fieldAccessorTable
.ensureFieldAccessorsInitialized(
io.grpc.binarylog.Message.class, io.grpc.binarylog.Message.Builder.class);
}
public static final int FLAGS_FIELD_NUMBER = 1;
private int flags_;
/**
* <pre>
* This flag is currently used to indicate whether the payload is compressed,
* it may contain other semantics in the future. Value of 1 indicates that the
* binary octet sequence of Message is compressed using the mechanism declared
* by the Message-Encoding header. A value of 0 indicates that no encoding of
* Message bytes has occurred.
* </pre>
*
* <code>uint32 flags = 1;</code>
*/
public int getFlags() {
return flags_;
}
public static final int LENGTH_FIELD_NUMBER = 2;
private int length_;
/**
* <pre>
* Length of the message. It may not be the same as the length of the
* data field, as the logging payload can be truncated or omitted.
* </pre>
*
* <code>uint32 length = 2;</code>
*/
public int getLength() {
return length_;
}
public static final int DATA_FIELD_NUMBER = 3;
private com.google.protobuf.ByteString data_;
/**
* <pre>
* Binary payload, post compression (depends on the flags field), may be
* truncated or omitted.
* </pre>
*
* <code>bytes data = 3;</code>
*/
public com.google.protobuf.ByteString getData() {
return data_;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (flags_ != 0) {
output.writeUInt32(1, flags_);
}
if (length_ != 0) {
output.writeUInt32(2, length_);
}
if (!data_.isEmpty()) {
output.writeBytes(3, data_);
}
unknownFields.writeTo(output);
}
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (flags_ != 0) {
size += com.google.protobuf.CodedOutputStream
.computeUInt32Size(1, flags_);
}
if (length_ != 0) {
size += com.google.protobuf.CodedOutputStream
.computeUInt32Size(2, length_);
}
if (!data_.isEmpty()) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(3, data_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof io.grpc.binarylog.Message)) {
return super.equals(obj);
}
io.grpc.binarylog.Message other = (io.grpc.binarylog.Message) obj;
boolean result = true;
result = result && (getFlags()
== other.getFlags());
result = result && (getLength()
== other.getLength());
result = result && getData()
.equals(other.getData());
result = result && unknownFields.equals(other.unknownFields);
return result;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + FLAGS_FIELD_NUMBER;
hash = (53 * hash) + getFlags();
hash = (37 * hash) + LENGTH_FIELD_NUMBER;
hash = (53 * hash) + getLength();
hash = (37 * hash) + DATA_FIELD_NUMBER;
hash = (53 * hash) + getData().hashCode();
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static io.grpc.binarylog.Message parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.grpc.binarylog.Message parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.grpc.binarylog.Message parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.grpc.binarylog.Message parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.grpc.binarylog.Message parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.grpc.binarylog.Message parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.grpc.binarylog.Message parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static io.grpc.binarylog.Message parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static io.grpc.binarylog.Message parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static io.grpc.binarylog.Message parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static io.grpc.binarylog.Message parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static io.grpc.binarylog.Message parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(io.grpc.binarylog.Message prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* <pre>
* Message payload, used by REQUEST and RESPONSE
* </pre>
*
* Protobuf type {@code grpc.binarylog.v1alpha.Message}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:grpc.binarylog.v1alpha.Message)
io.grpc.binarylog.MessageOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return io.grpc.binarylog.BinaryLogProto.internal_static_grpc_binarylog_v1alpha_Message_descriptor;
}
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return io.grpc.binarylog.BinaryLogProto.internal_static_grpc_binarylog_v1alpha_Message_fieldAccessorTable
.ensureFieldAccessorsInitialized(
io.grpc.binarylog.Message.class, io.grpc.binarylog.Message.Builder.class);
}
// Construct using io.grpc.binarylog.Message.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
public Builder clear() {
super.clear();
flags_ = 0;
length_ = 0;
data_ = com.google.protobuf.ByteString.EMPTY;
return this;
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return io.grpc.binarylog.BinaryLogProto.internal_static_grpc_binarylog_v1alpha_Message_descriptor;
}
public io.grpc.binarylog.Message getDefaultInstanceForType() {
return io.grpc.binarylog.Message.getDefaultInstance();
}
public io.grpc.binarylog.Message build() {
io.grpc.binarylog.Message result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public io.grpc.binarylog.Message buildPartial() {
io.grpc.binarylog.Message result = new io.grpc.binarylog.Message(this);
result.flags_ = flags_;
result.length_ = length_;
result.data_ = data_;
onBuilt();
return result;
}
public Builder clone() {
return (Builder) super.clone();
}
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return (Builder) super.setField(field, value);
}
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return (Builder) super.clearField(field);
}
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return (Builder) super.clearOneof(oneof);
}
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return (Builder) super.setRepeatedField(field, index, value);
}
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return (Builder) super.addRepeatedField(field, value);
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof io.grpc.binarylog.Message) {
return mergeFrom((io.grpc.binarylog.Message)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(io.grpc.binarylog.Message other) {
if (other == io.grpc.binarylog.Message.getDefaultInstance()) return this;
if (other.getFlags() != 0) {
setFlags(other.getFlags());
}
if (other.getLength() != 0) {
setLength(other.getLength());
}
if (other.getData() != com.google.protobuf.ByteString.EMPTY) {
setData(other.getData());
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
public final boolean isInitialized() {
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
io.grpc.binarylog.Message parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (io.grpc.binarylog.Message) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int flags_ ;
/**
* <pre>
* This flag is currently used to indicate whether the payload is compressed,
* it may contain other semantics in the future. Value of 1 indicates that the
* binary octet sequence of Message is compressed using the mechanism declared
* by the Message-Encoding header. A value of 0 indicates that no encoding of
* Message bytes has occurred.
* </pre>
*
* <code>uint32 flags = 1;</code>
*/
public int getFlags() {
return flags_;
}
/**
* <pre>
* This flag is currently used to indicate whether the payload is compressed,
* it may contain other semantics in the future. Value of 1 indicates that the
* binary octet sequence of Message is compressed using the mechanism declared
* by the Message-Encoding header. A value of 0 indicates that no encoding of
* Message bytes has occurred.
* </pre>
*
* <code>uint32 flags = 1;</code>
*/
public Builder setFlags(int value) {
flags_ = value;
onChanged();
return this;
}
/**
* <pre>
* This flag is currently used to indicate whether the payload is compressed,
* it may contain other semantics in the future. Value of 1 indicates that the
* binary octet sequence of Message is compressed using the mechanism declared
* by the Message-Encoding header. A value of 0 indicates that no encoding of
* Message bytes has occurred.
* </pre>
*
* <code>uint32 flags = 1;</code>
*/
public Builder clearFlags() {
flags_ = 0;
onChanged();
return this;
}
private int length_ ;
/**
* <pre>
* Length of the message. It may not be the same as the length of the
* data field, as the logging payload can be truncated or omitted.
* </pre>
*
* <code>uint32 length = 2;</code>
*/
public int getLength() {
return length_;
}
/**
* <pre>
* Length of the message. It may not be the same as the length of the
* data field, as the logging payload can be truncated or omitted.
* </pre>
*
* <code>uint32 length = 2;</code>
*/
public Builder setLength(int value) {
length_ = value;
onChanged();
return this;
}
/**
* <pre>
* Length of the message. It may not be the same as the length of the
* data field, as the logging payload can be truncated or omitted.
* </pre>
*
* <code>uint32 length = 2;</code>
*/
public Builder clearLength() {
length_ = 0;
onChanged();
return this;
}
private com.google.protobuf.ByteString data_ = com.google.protobuf.ByteString.EMPTY;
/**
* <pre>
* Binary payload, post compression (depends on the flags field), may be
* truncated or omitted.
* </pre>
*
* <code>bytes data = 3;</code>
*/
public com.google.protobuf.ByteString getData() {
return data_;
}
/**
* <pre>
* Binary payload, post compression (depends on the flags field), may be
* truncated or omitted.
* </pre>
*
* <code>bytes data = 3;</code>
*/
public Builder setData(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
data_ = value;
onChanged();
return this;
}
/**
* <pre>
* Binary payload, post compression (depends on the flags field), may be
* truncated or omitted.
* </pre>
*
* <code>bytes data = 3;</code>
*/
public Builder clearData() {
data_ = getDefaultInstance().getData();
onChanged();
return this;
}
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFieldsProto3(unknownFields);
}
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:grpc.binarylog.v1alpha.Message)
}
// @@protoc_insertion_point(class_scope:grpc.binarylog.v1alpha.Message)
private static final io.grpc.binarylog.Message DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new io.grpc.binarylog.Message();
}
public static io.grpc.binarylog.Message getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<Message>
PARSER = new com.google.protobuf.AbstractParser<Message>() {
public Message parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new Message(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<Message> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<Message> getParserForType() {
return PARSER;
}
public io.grpc.binarylog.Message getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}

View File

@ -0,0 +1,42 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: io/grpc/binarylog.proto
package io.grpc.binarylog;
public interface MessageOrBuilder extends
// @@protoc_insertion_point(interface_extends:grpc.binarylog.v1alpha.Message)
com.google.protobuf.MessageOrBuilder {
/**
* <pre>
* This flag is currently used to indicate whether the payload is compressed,
* it may contain other semantics in the future. Value of 1 indicates that the
* binary octet sequence of Message is compressed using the mechanism declared
* by the Message-Encoding header. A value of 0 indicates that no encoding of
* Message bytes has occurred.
* </pre>
*
* <code>uint32 flags = 1;</code>
*/
int getFlags();
/**
* <pre>
* Length of the message. It may not be the same as the length of the
* data field, as the logging payload can be truncated or omitted.
* </pre>
*
* <code>uint32 length = 2;</code>
*/
int getLength();
/**
* <pre>
* Binary payload, post compression (depends on the flags field), may be
* truncated or omitted.
* </pre>
*
* <code>bytes data = 3;</code>
*/
com.google.protobuf.ByteString getData();
}

View File

@ -0,0 +1,748 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: io/grpc/binarylog.proto
package io.grpc.binarylog;
/**
* <pre>
* A list of metadata pairs, used in the payload of CLIENT_INIT_METADATA,
* SERVER_INIT_METADATA and TRAILING_METADATA
* Implementations may omit some entries to honor the header limits
* of GRPC_BINARY_LOG_CONFIG. Implementations can choose which entries are logged.
* </pre>
*
* Protobuf type {@code grpc.binarylog.v1alpha.Metadata}
*/
public final class Metadata extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:grpc.binarylog.v1alpha.Metadata)
MetadataOrBuilder {
private static final long serialVersionUID = 0L;
// Use Metadata.newBuilder() to construct.
private Metadata(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private Metadata() {
entry_ = java.util.Collections.emptyList();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private Metadata(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownFieldProto3(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
entry_ = new java.util.ArrayList<io.grpc.binarylog.MetadataEntry>();
mutable_bitField0_ |= 0x00000001;
}
entry_.add(
input.readMessage(io.grpc.binarylog.MetadataEntry.parser(), extensionRegistry));
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
entry_ = java.util.Collections.unmodifiableList(entry_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return io.grpc.binarylog.BinaryLogProto.internal_static_grpc_binarylog_v1alpha_Metadata_descriptor;
}
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return io.grpc.binarylog.BinaryLogProto.internal_static_grpc_binarylog_v1alpha_Metadata_fieldAccessorTable
.ensureFieldAccessorsInitialized(
io.grpc.binarylog.Metadata.class, io.grpc.binarylog.Metadata.Builder.class);
}
public static final int ENTRY_FIELD_NUMBER = 1;
private java.util.List<io.grpc.binarylog.MetadataEntry> entry_;
/**
* <code>repeated .grpc.binarylog.v1alpha.MetadataEntry entry = 1;</code>
*/
public java.util.List<io.grpc.binarylog.MetadataEntry> getEntryList() {
return entry_;
}
/**
* <code>repeated .grpc.binarylog.v1alpha.MetadataEntry entry = 1;</code>
*/
public java.util.List<? extends io.grpc.binarylog.MetadataEntryOrBuilder>
getEntryOrBuilderList() {
return entry_;
}
/**
* <code>repeated .grpc.binarylog.v1alpha.MetadataEntry entry = 1;</code>
*/
public int getEntryCount() {
return entry_.size();
}
/**
* <code>repeated .grpc.binarylog.v1alpha.MetadataEntry entry = 1;</code>
*/
public io.grpc.binarylog.MetadataEntry getEntry(int index) {
return entry_.get(index);
}
/**
* <code>repeated .grpc.binarylog.v1alpha.MetadataEntry entry = 1;</code>
*/
public io.grpc.binarylog.MetadataEntryOrBuilder getEntryOrBuilder(
int index) {
return entry_.get(index);
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
for (int i = 0; i < entry_.size(); i++) {
output.writeMessage(1, entry_.get(i));
}
unknownFields.writeTo(output);
}
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
for (int i = 0; i < entry_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(1, entry_.get(i));
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof io.grpc.binarylog.Metadata)) {
return super.equals(obj);
}
io.grpc.binarylog.Metadata other = (io.grpc.binarylog.Metadata) obj;
boolean result = true;
result = result && getEntryList()
.equals(other.getEntryList());
result = result && unknownFields.equals(other.unknownFields);
return result;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
if (getEntryCount() > 0) {
hash = (37 * hash) + ENTRY_FIELD_NUMBER;
hash = (53 * hash) + getEntryList().hashCode();
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static io.grpc.binarylog.Metadata parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.grpc.binarylog.Metadata parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.grpc.binarylog.Metadata parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.grpc.binarylog.Metadata parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.grpc.binarylog.Metadata parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.grpc.binarylog.Metadata parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.grpc.binarylog.Metadata parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static io.grpc.binarylog.Metadata parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static io.grpc.binarylog.Metadata parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static io.grpc.binarylog.Metadata parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static io.grpc.binarylog.Metadata parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static io.grpc.binarylog.Metadata parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(io.grpc.binarylog.Metadata prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* <pre>
* A list of metadata pairs, used in the payload of CLIENT_INIT_METADATA,
* SERVER_INIT_METADATA and TRAILING_METADATA
* Implementations may omit some entries to honor the header limits
* of GRPC_BINARY_LOG_CONFIG. Implementations can choose which entries are logged.
* </pre>
*
* Protobuf type {@code grpc.binarylog.v1alpha.Metadata}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:grpc.binarylog.v1alpha.Metadata)
io.grpc.binarylog.MetadataOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return io.grpc.binarylog.BinaryLogProto.internal_static_grpc_binarylog_v1alpha_Metadata_descriptor;
}
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return io.grpc.binarylog.BinaryLogProto.internal_static_grpc_binarylog_v1alpha_Metadata_fieldAccessorTable
.ensureFieldAccessorsInitialized(
io.grpc.binarylog.Metadata.class, io.grpc.binarylog.Metadata.Builder.class);
}
// Construct using io.grpc.binarylog.Metadata.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
getEntryFieldBuilder();
}
}
public Builder clear() {
super.clear();
if (entryBuilder_ == null) {
entry_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
} else {
entryBuilder_.clear();
}
return this;
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return io.grpc.binarylog.BinaryLogProto.internal_static_grpc_binarylog_v1alpha_Metadata_descriptor;
}
public io.grpc.binarylog.Metadata getDefaultInstanceForType() {
return io.grpc.binarylog.Metadata.getDefaultInstance();
}
public io.grpc.binarylog.Metadata build() {
io.grpc.binarylog.Metadata result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public io.grpc.binarylog.Metadata buildPartial() {
io.grpc.binarylog.Metadata result = new io.grpc.binarylog.Metadata(this);
int from_bitField0_ = bitField0_;
if (entryBuilder_ == null) {
if (((bitField0_ & 0x00000001) == 0x00000001)) {
entry_ = java.util.Collections.unmodifiableList(entry_);
bitField0_ = (bitField0_ & ~0x00000001);
}
result.entry_ = entry_;
} else {
result.entry_ = entryBuilder_.build();
}
onBuilt();
return result;
}
public Builder clone() {
return (Builder) super.clone();
}
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return (Builder) super.setField(field, value);
}
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return (Builder) super.clearField(field);
}
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return (Builder) super.clearOneof(oneof);
}
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return (Builder) super.setRepeatedField(field, index, value);
}
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return (Builder) super.addRepeatedField(field, value);
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof io.grpc.binarylog.Metadata) {
return mergeFrom((io.grpc.binarylog.Metadata)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(io.grpc.binarylog.Metadata other) {
if (other == io.grpc.binarylog.Metadata.getDefaultInstance()) return this;
if (entryBuilder_ == null) {
if (!other.entry_.isEmpty()) {
if (entry_.isEmpty()) {
entry_ = other.entry_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureEntryIsMutable();
entry_.addAll(other.entry_);
}
onChanged();
}
} else {
if (!other.entry_.isEmpty()) {
if (entryBuilder_.isEmpty()) {
entryBuilder_.dispose();
entryBuilder_ = null;
entry_ = other.entry_;
bitField0_ = (bitField0_ & ~0x00000001);
entryBuilder_ =
com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ?
getEntryFieldBuilder() : null;
} else {
entryBuilder_.addAllMessages(other.entry_);
}
}
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
public final boolean isInitialized() {
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
io.grpc.binarylog.Metadata parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (io.grpc.binarylog.Metadata) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private java.util.List<io.grpc.binarylog.MetadataEntry> entry_ =
java.util.Collections.emptyList();
private void ensureEntryIsMutable() {
if (!((bitField0_ & 0x00000001) == 0x00000001)) {
entry_ = new java.util.ArrayList<io.grpc.binarylog.MetadataEntry>(entry_);
bitField0_ |= 0x00000001;
}
}
private com.google.protobuf.RepeatedFieldBuilderV3<
io.grpc.binarylog.MetadataEntry, io.grpc.binarylog.MetadataEntry.Builder, io.grpc.binarylog.MetadataEntryOrBuilder> entryBuilder_;
/**
* <code>repeated .grpc.binarylog.v1alpha.MetadataEntry entry = 1;</code>
*/
public java.util.List<io.grpc.binarylog.MetadataEntry> getEntryList() {
if (entryBuilder_ == null) {
return java.util.Collections.unmodifiableList(entry_);
} else {
return entryBuilder_.getMessageList();
}
}
/**
* <code>repeated .grpc.binarylog.v1alpha.MetadataEntry entry = 1;</code>
*/
public int getEntryCount() {
if (entryBuilder_ == null) {
return entry_.size();
} else {
return entryBuilder_.getCount();
}
}
/**
* <code>repeated .grpc.binarylog.v1alpha.MetadataEntry entry = 1;</code>
*/
public io.grpc.binarylog.MetadataEntry getEntry(int index) {
if (entryBuilder_ == null) {
return entry_.get(index);
} else {
return entryBuilder_.getMessage(index);
}
}
/**
* <code>repeated .grpc.binarylog.v1alpha.MetadataEntry entry = 1;</code>
*/
public Builder setEntry(
int index, io.grpc.binarylog.MetadataEntry value) {
if (entryBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureEntryIsMutable();
entry_.set(index, value);
onChanged();
} else {
entryBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .grpc.binarylog.v1alpha.MetadataEntry entry = 1;</code>
*/
public Builder setEntry(
int index, io.grpc.binarylog.MetadataEntry.Builder builderForValue) {
if (entryBuilder_ == null) {
ensureEntryIsMutable();
entry_.set(index, builderForValue.build());
onChanged();
} else {
entryBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .grpc.binarylog.v1alpha.MetadataEntry entry = 1;</code>
*/
public Builder addEntry(io.grpc.binarylog.MetadataEntry value) {
if (entryBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureEntryIsMutable();
entry_.add(value);
onChanged();
} else {
entryBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .grpc.binarylog.v1alpha.MetadataEntry entry = 1;</code>
*/
public Builder addEntry(
int index, io.grpc.binarylog.MetadataEntry value) {
if (entryBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureEntryIsMutable();
entry_.add(index, value);
onChanged();
} else {
entryBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .grpc.binarylog.v1alpha.MetadataEntry entry = 1;</code>
*/
public Builder addEntry(
io.grpc.binarylog.MetadataEntry.Builder builderForValue) {
if (entryBuilder_ == null) {
ensureEntryIsMutable();
entry_.add(builderForValue.build());
onChanged();
} else {
entryBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .grpc.binarylog.v1alpha.MetadataEntry entry = 1;</code>
*/
public Builder addEntry(
int index, io.grpc.binarylog.MetadataEntry.Builder builderForValue) {
if (entryBuilder_ == null) {
ensureEntryIsMutable();
entry_.add(index, builderForValue.build());
onChanged();
} else {
entryBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .grpc.binarylog.v1alpha.MetadataEntry entry = 1;</code>
*/
public Builder addAllEntry(
java.lang.Iterable<? extends io.grpc.binarylog.MetadataEntry> values) {
if (entryBuilder_ == null) {
ensureEntryIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, entry_);
onChanged();
} else {
entryBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .grpc.binarylog.v1alpha.MetadataEntry entry = 1;</code>
*/
public Builder clearEntry() {
if (entryBuilder_ == null) {
entry_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
} else {
entryBuilder_.clear();
}
return this;
}
/**
* <code>repeated .grpc.binarylog.v1alpha.MetadataEntry entry = 1;</code>
*/
public Builder removeEntry(int index) {
if (entryBuilder_ == null) {
ensureEntryIsMutable();
entry_.remove(index);
onChanged();
} else {
entryBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .grpc.binarylog.v1alpha.MetadataEntry entry = 1;</code>
*/
public io.grpc.binarylog.MetadataEntry.Builder getEntryBuilder(
int index) {
return getEntryFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .grpc.binarylog.v1alpha.MetadataEntry entry = 1;</code>
*/
public io.grpc.binarylog.MetadataEntryOrBuilder getEntryOrBuilder(
int index) {
if (entryBuilder_ == null) {
return entry_.get(index); } else {
return entryBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .grpc.binarylog.v1alpha.MetadataEntry entry = 1;</code>
*/
public java.util.List<? extends io.grpc.binarylog.MetadataEntryOrBuilder>
getEntryOrBuilderList() {
if (entryBuilder_ != null) {
return entryBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(entry_);
}
}
/**
* <code>repeated .grpc.binarylog.v1alpha.MetadataEntry entry = 1;</code>
*/
public io.grpc.binarylog.MetadataEntry.Builder addEntryBuilder() {
return getEntryFieldBuilder().addBuilder(
io.grpc.binarylog.MetadataEntry.getDefaultInstance());
}
/**
* <code>repeated .grpc.binarylog.v1alpha.MetadataEntry entry = 1;</code>
*/
public io.grpc.binarylog.MetadataEntry.Builder addEntryBuilder(
int index) {
return getEntryFieldBuilder().addBuilder(
index, io.grpc.binarylog.MetadataEntry.getDefaultInstance());
}
/**
* <code>repeated .grpc.binarylog.v1alpha.MetadataEntry entry = 1;</code>
*/
public java.util.List<io.grpc.binarylog.MetadataEntry.Builder>
getEntryBuilderList() {
return getEntryFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilderV3<
io.grpc.binarylog.MetadataEntry, io.grpc.binarylog.MetadataEntry.Builder, io.grpc.binarylog.MetadataEntryOrBuilder>
getEntryFieldBuilder() {
if (entryBuilder_ == null) {
entryBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3<
io.grpc.binarylog.MetadataEntry, io.grpc.binarylog.MetadataEntry.Builder, io.grpc.binarylog.MetadataEntryOrBuilder>(
entry_,
((bitField0_ & 0x00000001) == 0x00000001),
getParentForChildren(),
isClean());
entry_ = null;
}
return entryBuilder_;
}
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFieldsProto3(unknownFields);
}
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:grpc.binarylog.v1alpha.Metadata)
}
// @@protoc_insertion_point(class_scope:grpc.binarylog.v1alpha.Metadata)
private static final io.grpc.binarylog.Metadata DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new io.grpc.binarylog.Metadata();
}
public static io.grpc.binarylog.Metadata getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<Metadata>
PARSER = new com.google.protobuf.AbstractParser<Metadata>() {
public Metadata parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new Metadata(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<Metadata> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<Metadata> getParserForType() {
return PARSER;
}
public io.grpc.binarylog.Metadata getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}

View File

@ -0,0 +1,585 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: io/grpc/binarylog.proto
package io.grpc.binarylog;
/**
* <pre>
* A metadata key value pair
* </pre>
*
* Protobuf type {@code grpc.binarylog.v1alpha.MetadataEntry}
*/
public final class MetadataEntry extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:grpc.binarylog.v1alpha.MetadataEntry)
MetadataEntryOrBuilder {
private static final long serialVersionUID = 0L;
// Use MetadataEntry.newBuilder() to construct.
private MetadataEntry(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private MetadataEntry() {
key_ = "";
value_ = com.google.protobuf.ByteString.EMPTY;
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private MetadataEntry(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownFieldProto3(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
java.lang.String s = input.readStringRequireUtf8();
key_ = s;
break;
}
case 18: {
value_ = input.readBytes();
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return io.grpc.binarylog.BinaryLogProto.internal_static_grpc_binarylog_v1alpha_MetadataEntry_descriptor;
}
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return io.grpc.binarylog.BinaryLogProto.internal_static_grpc_binarylog_v1alpha_MetadataEntry_fieldAccessorTable
.ensureFieldAccessorsInitialized(
io.grpc.binarylog.MetadataEntry.class, io.grpc.binarylog.MetadataEntry.Builder.class);
}
public static final int KEY_FIELD_NUMBER = 1;
private volatile java.lang.Object key_;
/**
* <code>string key = 1;</code>
*/
public java.lang.String getKey() {
java.lang.Object ref = key_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
key_ = s;
return s;
}
}
/**
* <code>string key = 1;</code>
*/
public com.google.protobuf.ByteString
getKeyBytes() {
java.lang.Object ref = key_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
key_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int VALUE_FIELD_NUMBER = 2;
private com.google.protobuf.ByteString value_;
/**
* <code>bytes value = 2;</code>
*/
public com.google.protobuf.ByteString getValue() {
return value_;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (!getKeyBytes().isEmpty()) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, key_);
}
if (!value_.isEmpty()) {
output.writeBytes(2, value_);
}
unknownFields.writeTo(output);
}
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (!getKeyBytes().isEmpty()) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, key_);
}
if (!value_.isEmpty()) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(2, value_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof io.grpc.binarylog.MetadataEntry)) {
return super.equals(obj);
}
io.grpc.binarylog.MetadataEntry other = (io.grpc.binarylog.MetadataEntry) obj;
boolean result = true;
result = result && getKey()
.equals(other.getKey());
result = result && getValue()
.equals(other.getValue());
result = result && unknownFields.equals(other.unknownFields);
return result;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + KEY_FIELD_NUMBER;
hash = (53 * hash) + getKey().hashCode();
hash = (37 * hash) + VALUE_FIELD_NUMBER;
hash = (53 * hash) + getValue().hashCode();
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static io.grpc.binarylog.MetadataEntry parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.grpc.binarylog.MetadataEntry parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.grpc.binarylog.MetadataEntry parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.grpc.binarylog.MetadataEntry parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.grpc.binarylog.MetadataEntry parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.grpc.binarylog.MetadataEntry parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.grpc.binarylog.MetadataEntry parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static io.grpc.binarylog.MetadataEntry parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static io.grpc.binarylog.MetadataEntry parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static io.grpc.binarylog.MetadataEntry parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static io.grpc.binarylog.MetadataEntry parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static io.grpc.binarylog.MetadataEntry parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(io.grpc.binarylog.MetadataEntry prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* <pre>
* A metadata key value pair
* </pre>
*
* Protobuf type {@code grpc.binarylog.v1alpha.MetadataEntry}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:grpc.binarylog.v1alpha.MetadataEntry)
io.grpc.binarylog.MetadataEntryOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return io.grpc.binarylog.BinaryLogProto.internal_static_grpc_binarylog_v1alpha_MetadataEntry_descriptor;
}
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return io.grpc.binarylog.BinaryLogProto.internal_static_grpc_binarylog_v1alpha_MetadataEntry_fieldAccessorTable
.ensureFieldAccessorsInitialized(
io.grpc.binarylog.MetadataEntry.class, io.grpc.binarylog.MetadataEntry.Builder.class);
}
// Construct using io.grpc.binarylog.MetadataEntry.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
public Builder clear() {
super.clear();
key_ = "";
value_ = com.google.protobuf.ByteString.EMPTY;
return this;
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return io.grpc.binarylog.BinaryLogProto.internal_static_grpc_binarylog_v1alpha_MetadataEntry_descriptor;
}
public io.grpc.binarylog.MetadataEntry getDefaultInstanceForType() {
return io.grpc.binarylog.MetadataEntry.getDefaultInstance();
}
public io.grpc.binarylog.MetadataEntry build() {
io.grpc.binarylog.MetadataEntry result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public io.grpc.binarylog.MetadataEntry buildPartial() {
io.grpc.binarylog.MetadataEntry result = new io.grpc.binarylog.MetadataEntry(this);
result.key_ = key_;
result.value_ = value_;
onBuilt();
return result;
}
public Builder clone() {
return (Builder) super.clone();
}
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return (Builder) super.setField(field, value);
}
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return (Builder) super.clearField(field);
}
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return (Builder) super.clearOneof(oneof);
}
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return (Builder) super.setRepeatedField(field, index, value);
}
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return (Builder) super.addRepeatedField(field, value);
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof io.grpc.binarylog.MetadataEntry) {
return mergeFrom((io.grpc.binarylog.MetadataEntry)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(io.grpc.binarylog.MetadataEntry other) {
if (other == io.grpc.binarylog.MetadataEntry.getDefaultInstance()) return this;
if (!other.getKey().isEmpty()) {
key_ = other.key_;
onChanged();
}
if (other.getValue() != com.google.protobuf.ByteString.EMPTY) {
setValue(other.getValue());
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
public final boolean isInitialized() {
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
io.grpc.binarylog.MetadataEntry parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (io.grpc.binarylog.MetadataEntry) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private java.lang.Object key_ = "";
/**
* <code>string key = 1;</code>
*/
public java.lang.String getKey() {
java.lang.Object ref = key_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
key_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>string key = 1;</code>
*/
public com.google.protobuf.ByteString
getKeyBytes() {
java.lang.Object ref = key_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
key_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>string key = 1;</code>
*/
public Builder setKey(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
key_ = value;
onChanged();
return this;
}
/**
* <code>string key = 1;</code>
*/
public Builder clearKey() {
key_ = getDefaultInstance().getKey();
onChanged();
return this;
}
/**
* <code>string key = 1;</code>
*/
public Builder setKeyBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
key_ = value;
onChanged();
return this;
}
private com.google.protobuf.ByteString value_ = com.google.protobuf.ByteString.EMPTY;
/**
* <code>bytes value = 2;</code>
*/
public com.google.protobuf.ByteString getValue() {
return value_;
}
/**
* <code>bytes value = 2;</code>
*/
public Builder setValue(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
value_ = value;
onChanged();
return this;
}
/**
* <code>bytes value = 2;</code>
*/
public Builder clearValue() {
value_ = getDefaultInstance().getValue();
onChanged();
return this;
}
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFieldsProto3(unknownFields);
}
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:grpc.binarylog.v1alpha.MetadataEntry)
}
// @@protoc_insertion_point(class_scope:grpc.binarylog.v1alpha.MetadataEntry)
private static final io.grpc.binarylog.MetadataEntry DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new io.grpc.binarylog.MetadataEntry();
}
public static io.grpc.binarylog.MetadataEntry getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<MetadataEntry>
PARSER = new com.google.protobuf.AbstractParser<MetadataEntry>() {
public MetadataEntry parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new MetadataEntry(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<MetadataEntry> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<MetadataEntry> getParserForType() {
return PARSER;
}
public io.grpc.binarylog.MetadataEntry getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}

View File

@ -0,0 +1,24 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: io/grpc/binarylog.proto
package io.grpc.binarylog;
public interface MetadataEntryOrBuilder extends
// @@protoc_insertion_point(interface_extends:grpc.binarylog.v1alpha.MetadataEntry)
com.google.protobuf.MessageOrBuilder {
/**
* <code>string key = 1;</code>
*/
java.lang.String getKey();
/**
* <code>string key = 1;</code>
*/
com.google.protobuf.ByteString
getKeyBytes();
/**
* <code>bytes value = 2;</code>
*/
com.google.protobuf.ByteString getValue();
}

View File

@ -0,0 +1,33 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: io/grpc/binarylog.proto
package io.grpc.binarylog;
public interface MetadataOrBuilder extends
// @@protoc_insertion_point(interface_extends:grpc.binarylog.v1alpha.Metadata)
com.google.protobuf.MessageOrBuilder {
/**
* <code>repeated .grpc.binarylog.v1alpha.MetadataEntry entry = 1;</code>
*/
java.util.List<io.grpc.binarylog.MetadataEntry>
getEntryList();
/**
* <code>repeated .grpc.binarylog.v1alpha.MetadataEntry entry = 1;</code>
*/
io.grpc.binarylog.MetadataEntry getEntry(int index);
/**
* <code>repeated .grpc.binarylog.v1alpha.MetadataEntry entry = 1;</code>
*/
int getEntryCount();
/**
* <code>repeated .grpc.binarylog.v1alpha.MetadataEntry entry = 1;</code>
*/
java.util.List<? extends io.grpc.binarylog.MetadataEntryOrBuilder>
getEntryOrBuilderList();
/**
* <code>repeated .grpc.binarylog.v1alpha.MetadataEntry entry = 1;</code>
*/
io.grpc.binarylog.MetadataEntryOrBuilder getEntryOrBuilder(
int index);
}

View File

@ -0,0 +1,688 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: io/grpc/binarylog.proto
package io.grpc.binarylog;
/**
* <pre>
* Peer information
* </pre>
*
* Protobuf type {@code grpc.binarylog.v1alpha.Peer}
*/
public final class Peer extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:grpc.binarylog.v1alpha.Peer)
PeerOrBuilder {
private static final long serialVersionUID = 0L;
// Use Peer.newBuilder() to construct.
private Peer(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private Peer() {
peerType_ = 0;
peer_ = com.google.protobuf.ByteString.EMPTY;
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private Peer(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownFieldProto3(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
case 8: {
int rawValue = input.readEnum();
peerType_ = rawValue;
break;
}
case 18: {
peer_ = input.readBytes();
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return io.grpc.binarylog.BinaryLogProto.internal_static_grpc_binarylog_v1alpha_Peer_descriptor;
}
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return io.grpc.binarylog.BinaryLogProto.internal_static_grpc_binarylog_v1alpha_Peer_fieldAccessorTable
.ensureFieldAccessorsInitialized(
io.grpc.binarylog.Peer.class, io.grpc.binarylog.Peer.Builder.class);
}
/**
* Protobuf enum {@code grpc.binarylog.v1alpha.Peer.PeerType}
*/
public enum PeerType
implements com.google.protobuf.ProtocolMessageEnum {
/**
* <pre>
* peer is struct sockaddr_in
* </pre>
*
* <code>PEER_IPV4 = 0;</code>
*/
PEER_IPV4(0),
/**
* <pre>
* peer is struct sockaddr_in6
* </pre>
*
* <code>PEER_IPV6 = 1;</code>
*/
PEER_IPV6(1),
/**
* <pre>
* peer is struct sockaddr_un
* </pre>
*
* <code>PEER_UNIX = 2;</code>
*/
PEER_UNIX(2),
UNRECOGNIZED(-1),
;
/**
* <pre>
* peer is struct sockaddr_in
* </pre>
*
* <code>PEER_IPV4 = 0;</code>
*/
public static final int PEER_IPV4_VALUE = 0;
/**
* <pre>
* peer is struct sockaddr_in6
* </pre>
*
* <code>PEER_IPV6 = 1;</code>
*/
public static final int PEER_IPV6_VALUE = 1;
/**
* <pre>
* peer is struct sockaddr_un
* </pre>
*
* <code>PEER_UNIX = 2;</code>
*/
public static final int PEER_UNIX_VALUE = 2;
public final int getNumber() {
if (this == UNRECOGNIZED) {
throw new java.lang.IllegalArgumentException(
"Can't get the number of an unknown enum value.");
}
return value;
}
/**
* @deprecated Use {@link #forNumber(int)} instead.
*/
@java.lang.Deprecated
public static PeerType valueOf(int value) {
return forNumber(value);
}
public static PeerType forNumber(int value) {
switch (value) {
case 0: return PEER_IPV4;
case 1: return PEER_IPV6;
case 2: return PEER_UNIX;
default: return null;
}
}
public static com.google.protobuf.Internal.EnumLiteMap<PeerType>
internalGetValueMap() {
return internalValueMap;
}
private static final com.google.protobuf.Internal.EnumLiteMap<
PeerType> internalValueMap =
new com.google.protobuf.Internal.EnumLiteMap<PeerType>() {
public PeerType findValueByNumber(int number) {
return PeerType.forNumber(number);
}
};
public final com.google.protobuf.Descriptors.EnumValueDescriptor
getValueDescriptor() {
return getDescriptor().getValues().get(ordinal());
}
public final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptorForType() {
return getDescriptor();
}
public static final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptor() {
return io.grpc.binarylog.Peer.getDescriptor().getEnumTypes().get(0);
}
private static final PeerType[] VALUES = values();
public static PeerType valueOf(
com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
if (desc.getType() != getDescriptor()) {
throw new java.lang.IllegalArgumentException(
"EnumValueDescriptor is not for this type.");
}
if (desc.getIndex() == -1) {
return UNRECOGNIZED;
}
return VALUES[desc.getIndex()];
}
private final int value;
private PeerType(int value) {
this.value = value;
}
// @@protoc_insertion_point(enum_scope:grpc.binarylog.v1alpha.Peer.PeerType)
}
public static final int PEER_TYPE_FIELD_NUMBER = 1;
private int peerType_;
/**
* <code>.grpc.binarylog.v1alpha.Peer.PeerType peer_type = 1;</code>
*/
public int getPeerTypeValue() {
return peerType_;
}
/**
* <code>.grpc.binarylog.v1alpha.Peer.PeerType peer_type = 1;</code>
*/
public io.grpc.binarylog.Peer.PeerType getPeerType() {
io.grpc.binarylog.Peer.PeerType result = io.grpc.binarylog.Peer.PeerType.valueOf(peerType_);
return result == null ? io.grpc.binarylog.Peer.PeerType.UNRECOGNIZED : result;
}
public static final int PEER_FIELD_NUMBER = 2;
private com.google.protobuf.ByteString peer_;
/**
* <pre>
* value depends on peer_type
* </pre>
*
* <code>bytes peer = 2;</code>
*/
public com.google.protobuf.ByteString getPeer() {
return peer_;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (peerType_ != io.grpc.binarylog.Peer.PeerType.PEER_IPV4.getNumber()) {
output.writeEnum(1, peerType_);
}
if (!peer_.isEmpty()) {
output.writeBytes(2, peer_);
}
unknownFields.writeTo(output);
}
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (peerType_ != io.grpc.binarylog.Peer.PeerType.PEER_IPV4.getNumber()) {
size += com.google.protobuf.CodedOutputStream
.computeEnumSize(1, peerType_);
}
if (!peer_.isEmpty()) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(2, peer_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof io.grpc.binarylog.Peer)) {
return super.equals(obj);
}
io.grpc.binarylog.Peer other = (io.grpc.binarylog.Peer) obj;
boolean result = true;
result = result && peerType_ == other.peerType_;
result = result && getPeer()
.equals(other.getPeer());
result = result && unknownFields.equals(other.unknownFields);
return result;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + PEER_TYPE_FIELD_NUMBER;
hash = (53 * hash) + peerType_;
hash = (37 * hash) + PEER_FIELD_NUMBER;
hash = (53 * hash) + getPeer().hashCode();
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static io.grpc.binarylog.Peer parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.grpc.binarylog.Peer parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.grpc.binarylog.Peer parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.grpc.binarylog.Peer parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.grpc.binarylog.Peer parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.grpc.binarylog.Peer parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.grpc.binarylog.Peer parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static io.grpc.binarylog.Peer parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static io.grpc.binarylog.Peer parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static io.grpc.binarylog.Peer parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static io.grpc.binarylog.Peer parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static io.grpc.binarylog.Peer parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(io.grpc.binarylog.Peer prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* <pre>
* Peer information
* </pre>
*
* Protobuf type {@code grpc.binarylog.v1alpha.Peer}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:grpc.binarylog.v1alpha.Peer)
io.grpc.binarylog.PeerOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return io.grpc.binarylog.BinaryLogProto.internal_static_grpc_binarylog_v1alpha_Peer_descriptor;
}
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return io.grpc.binarylog.BinaryLogProto.internal_static_grpc_binarylog_v1alpha_Peer_fieldAccessorTable
.ensureFieldAccessorsInitialized(
io.grpc.binarylog.Peer.class, io.grpc.binarylog.Peer.Builder.class);
}
// Construct using io.grpc.binarylog.Peer.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
public Builder clear() {
super.clear();
peerType_ = 0;
peer_ = com.google.protobuf.ByteString.EMPTY;
return this;
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return io.grpc.binarylog.BinaryLogProto.internal_static_grpc_binarylog_v1alpha_Peer_descriptor;
}
public io.grpc.binarylog.Peer getDefaultInstanceForType() {
return io.grpc.binarylog.Peer.getDefaultInstance();
}
public io.grpc.binarylog.Peer build() {
io.grpc.binarylog.Peer result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public io.grpc.binarylog.Peer buildPartial() {
io.grpc.binarylog.Peer result = new io.grpc.binarylog.Peer(this);
result.peerType_ = peerType_;
result.peer_ = peer_;
onBuilt();
return result;
}
public Builder clone() {
return (Builder) super.clone();
}
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return (Builder) super.setField(field, value);
}
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return (Builder) super.clearField(field);
}
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return (Builder) super.clearOneof(oneof);
}
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return (Builder) super.setRepeatedField(field, index, value);
}
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return (Builder) super.addRepeatedField(field, value);
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof io.grpc.binarylog.Peer) {
return mergeFrom((io.grpc.binarylog.Peer)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(io.grpc.binarylog.Peer other) {
if (other == io.grpc.binarylog.Peer.getDefaultInstance()) return this;
if (other.peerType_ != 0) {
setPeerTypeValue(other.getPeerTypeValue());
}
if (other.getPeer() != com.google.protobuf.ByteString.EMPTY) {
setPeer(other.getPeer());
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
public final boolean isInitialized() {
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
io.grpc.binarylog.Peer parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (io.grpc.binarylog.Peer) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int peerType_ = 0;
/**
* <code>.grpc.binarylog.v1alpha.Peer.PeerType peer_type = 1;</code>
*/
public int getPeerTypeValue() {
return peerType_;
}
/**
* <code>.grpc.binarylog.v1alpha.Peer.PeerType peer_type = 1;</code>
*/
public Builder setPeerTypeValue(int value) {
peerType_ = value;
onChanged();
return this;
}
/**
* <code>.grpc.binarylog.v1alpha.Peer.PeerType peer_type = 1;</code>
*/
public io.grpc.binarylog.Peer.PeerType getPeerType() {
io.grpc.binarylog.Peer.PeerType result = io.grpc.binarylog.Peer.PeerType.valueOf(peerType_);
return result == null ? io.grpc.binarylog.Peer.PeerType.UNRECOGNIZED : result;
}
/**
* <code>.grpc.binarylog.v1alpha.Peer.PeerType peer_type = 1;</code>
*/
public Builder setPeerType(io.grpc.binarylog.Peer.PeerType value) {
if (value == null) {
throw new NullPointerException();
}
peerType_ = value.getNumber();
onChanged();
return this;
}
/**
* <code>.grpc.binarylog.v1alpha.Peer.PeerType peer_type = 1;</code>
*/
public Builder clearPeerType() {
peerType_ = 0;
onChanged();
return this;
}
private com.google.protobuf.ByteString peer_ = com.google.protobuf.ByteString.EMPTY;
/**
* <pre>
* value depends on peer_type
* </pre>
*
* <code>bytes peer = 2;</code>
*/
public com.google.protobuf.ByteString getPeer() {
return peer_;
}
/**
* <pre>
* value depends on peer_type
* </pre>
*
* <code>bytes peer = 2;</code>
*/
public Builder setPeer(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
peer_ = value;
onChanged();
return this;
}
/**
* <pre>
* value depends on peer_type
* </pre>
*
* <code>bytes peer = 2;</code>
*/
public Builder clearPeer() {
peer_ = getDefaultInstance().getPeer();
onChanged();
return this;
}
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFieldsProto3(unknownFields);
}
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:grpc.binarylog.v1alpha.Peer)
}
// @@protoc_insertion_point(class_scope:grpc.binarylog.v1alpha.Peer)
private static final io.grpc.binarylog.Peer DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new io.grpc.binarylog.Peer();
}
public static io.grpc.binarylog.Peer getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<Peer>
PARSER = new com.google.protobuf.AbstractParser<Peer>() {
public Peer parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new Peer(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<Peer> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<Peer> getParserForType() {
return PARSER;
}
public io.grpc.binarylog.Peer getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}

View File

@ -0,0 +1,27 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: io/grpc/binarylog.proto
package io.grpc.binarylog;
public interface PeerOrBuilder extends
// @@protoc_insertion_point(interface_extends:grpc.binarylog.v1alpha.Peer)
com.google.protobuf.MessageOrBuilder {
/**
* <code>.grpc.binarylog.v1alpha.Peer.PeerType peer_type = 1;</code>
*/
int getPeerTypeValue();
/**
* <code>.grpc.binarylog.v1alpha.Peer.PeerType peer_type = 1;</code>
*/
io.grpc.binarylog.Peer.PeerType getPeerType();
/**
* <pre>
* value depends on peer_type
* </pre>
*
* <code>bytes peer = 2;</code>
*/
com.google.protobuf.ByteString getPeer();
}

View File

@ -0,0 +1,515 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: io/grpc/binarylog.proto
package io.grpc.binarylog;
/**
* <pre>
* Used to record call_id.
* </pre>
*
* Protobuf type {@code grpc.binarylog.v1alpha.Uint128}
*/
public final class Uint128 extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:grpc.binarylog.v1alpha.Uint128)
Uint128OrBuilder {
private static final long serialVersionUID = 0L;
// Use Uint128.newBuilder() to construct.
private Uint128(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private Uint128() {
high_ = 0L;
low_ = 0L;
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private Uint128(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownFieldProto3(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
case 9: {
high_ = input.readFixed64();
break;
}
case 17: {
low_ = input.readFixed64();
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return io.grpc.binarylog.BinaryLogProto.internal_static_grpc_binarylog_v1alpha_Uint128_descriptor;
}
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return io.grpc.binarylog.BinaryLogProto.internal_static_grpc_binarylog_v1alpha_Uint128_fieldAccessorTable
.ensureFieldAccessorsInitialized(
io.grpc.binarylog.Uint128.class, io.grpc.binarylog.Uint128.Builder.class);
}
public static final int HIGH_FIELD_NUMBER = 1;
private long high_;
/**
* <code>fixed64 high = 1;</code>
*/
public long getHigh() {
return high_;
}
public static final int LOW_FIELD_NUMBER = 2;
private long low_;
/**
* <code>fixed64 low = 2;</code>
*/
public long getLow() {
return low_;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (high_ != 0L) {
output.writeFixed64(1, high_);
}
if (low_ != 0L) {
output.writeFixed64(2, low_);
}
unknownFields.writeTo(output);
}
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (high_ != 0L) {
size += com.google.protobuf.CodedOutputStream
.computeFixed64Size(1, high_);
}
if (low_ != 0L) {
size += com.google.protobuf.CodedOutputStream
.computeFixed64Size(2, low_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof io.grpc.binarylog.Uint128)) {
return super.equals(obj);
}
io.grpc.binarylog.Uint128 other = (io.grpc.binarylog.Uint128) obj;
boolean result = true;
result = result && (getHigh()
== other.getHigh());
result = result && (getLow()
== other.getLow());
result = result && unknownFields.equals(other.unknownFields);
return result;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + HIGH_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
getHigh());
hash = (37 * hash) + LOW_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
getLow());
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static io.grpc.binarylog.Uint128 parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.grpc.binarylog.Uint128 parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.grpc.binarylog.Uint128 parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.grpc.binarylog.Uint128 parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.grpc.binarylog.Uint128 parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.grpc.binarylog.Uint128 parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.grpc.binarylog.Uint128 parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static io.grpc.binarylog.Uint128 parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static io.grpc.binarylog.Uint128 parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static io.grpc.binarylog.Uint128 parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static io.grpc.binarylog.Uint128 parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static io.grpc.binarylog.Uint128 parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(io.grpc.binarylog.Uint128 prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* <pre>
* Used to record call_id.
* </pre>
*
* Protobuf type {@code grpc.binarylog.v1alpha.Uint128}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:grpc.binarylog.v1alpha.Uint128)
io.grpc.binarylog.Uint128OrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return io.grpc.binarylog.BinaryLogProto.internal_static_grpc_binarylog_v1alpha_Uint128_descriptor;
}
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return io.grpc.binarylog.BinaryLogProto.internal_static_grpc_binarylog_v1alpha_Uint128_fieldAccessorTable
.ensureFieldAccessorsInitialized(
io.grpc.binarylog.Uint128.class, io.grpc.binarylog.Uint128.Builder.class);
}
// Construct using io.grpc.binarylog.Uint128.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
public Builder clear() {
super.clear();
high_ = 0L;
low_ = 0L;
return this;
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return io.grpc.binarylog.BinaryLogProto.internal_static_grpc_binarylog_v1alpha_Uint128_descriptor;
}
public io.grpc.binarylog.Uint128 getDefaultInstanceForType() {
return io.grpc.binarylog.Uint128.getDefaultInstance();
}
public io.grpc.binarylog.Uint128 build() {
io.grpc.binarylog.Uint128 result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public io.grpc.binarylog.Uint128 buildPartial() {
io.grpc.binarylog.Uint128 result = new io.grpc.binarylog.Uint128(this);
result.high_ = high_;
result.low_ = low_;
onBuilt();
return result;
}
public Builder clone() {
return (Builder) super.clone();
}
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return (Builder) super.setField(field, value);
}
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return (Builder) super.clearField(field);
}
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return (Builder) super.clearOneof(oneof);
}
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return (Builder) super.setRepeatedField(field, index, value);
}
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return (Builder) super.addRepeatedField(field, value);
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof io.grpc.binarylog.Uint128) {
return mergeFrom((io.grpc.binarylog.Uint128)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(io.grpc.binarylog.Uint128 other) {
if (other == io.grpc.binarylog.Uint128.getDefaultInstance()) return this;
if (other.getHigh() != 0L) {
setHigh(other.getHigh());
}
if (other.getLow() != 0L) {
setLow(other.getLow());
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
public final boolean isInitialized() {
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
io.grpc.binarylog.Uint128 parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (io.grpc.binarylog.Uint128) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private long high_ ;
/**
* <code>fixed64 high = 1;</code>
*/
public long getHigh() {
return high_;
}
/**
* <code>fixed64 high = 1;</code>
*/
public Builder setHigh(long value) {
high_ = value;
onChanged();
return this;
}
/**
* <code>fixed64 high = 1;</code>
*/
public Builder clearHigh() {
high_ = 0L;
onChanged();
return this;
}
private long low_ ;
/**
* <code>fixed64 low = 2;</code>
*/
public long getLow() {
return low_;
}
/**
* <code>fixed64 low = 2;</code>
*/
public Builder setLow(long value) {
low_ = value;
onChanged();
return this;
}
/**
* <code>fixed64 low = 2;</code>
*/
public Builder clearLow() {
low_ = 0L;
onChanged();
return this;
}
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFieldsProto3(unknownFields);
}
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:grpc.binarylog.v1alpha.Uint128)
}
// @@protoc_insertion_point(class_scope:grpc.binarylog.v1alpha.Uint128)
private static final io.grpc.binarylog.Uint128 DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new io.grpc.binarylog.Uint128();
}
public static io.grpc.binarylog.Uint128 getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<Uint128>
PARSER = new com.google.protobuf.AbstractParser<Uint128>() {
public Uint128 parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new Uint128(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<Uint128> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<Uint128> getParserForType() {
return PARSER;
}
public io.grpc.binarylog.Uint128 getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}

View File

@ -0,0 +1,19 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: io/grpc/binarylog.proto
package io.grpc.binarylog;
public interface Uint128OrBuilder extends
// @@protoc_insertion_point(interface_extends:grpc.binarylog.v1alpha.Uint128)
com.google.protobuf.MessageOrBuilder {
/**
* <code>fixed64 high = 1;</code>
*/
long getHigh();
/**
* <code>fixed64 low = 2;</code>
*/
long getLow();
}

View File

@ -19,7 +19,24 @@ package io.grpc.services;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import com.google.common.primitives.Bytes;
import com.google.protobuf.ByteString;
import io.grpc.InternalMetadata;
import io.grpc.Metadata;
import io.grpc.MethodDescriptor;
import io.grpc.binarylog.Message;
import io.grpc.binarylog.Metadata.Builder;
import io.grpc.binarylog.MetadataEntry;
import io.grpc.binarylog.Peer;
import io.grpc.binarylog.Peer.PeerType;
import io.grpc.binarylog.Uint128;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@ -34,6 +51,10 @@ import javax.annotation.Nullable;
*/
final class BinaryLog {
private static final Logger logger = Logger.getLogger(BinaryLog.class.getName());
private static final int IP_PORT_BYTES = 2;
private static final int IP_PORT_UPPER_MASK = 0xff00;
private static final int IP_PORT_LOWER_MASK = 0xff;
private final int maxHeaderBytes;
private final int maxMessageBytes;
@ -244,4 +265,101 @@ final class BinaryLog {
return null;
}
}
/**
* Returns a {@link Uint128} by interpreting the first 8 bytes as the high int64 and the second
* 8 bytes as the low int64.
*/
// TODO(zpencer): verify int64 representation with other gRPC languages
static Uint128 callIdToProto(byte[] bytes) {
Preconditions.checkArgument(bytes.length == 16);
ByteBuffer bb = ByteBuffer.wrap(bytes);
long high = bb.getLong();
long low = bb.getLong();
return Uint128.newBuilder().setHigh(high).setLow(low).build();
}
@VisibleForTesting
// TODO(zpencer): the binlog design does not specify how to actually express the peer bytes
static Peer socketToProto(SocketAddress address) {
PeerType peerType = null;
byte[] peerAddress = null;
if (address instanceof InetSocketAddress) {
InetAddress inetAddress = ((InetSocketAddress) address).getAddress();
if (inetAddress instanceof Inet4Address) {
peerType = PeerType.PEER_IPV4;
} else if (inetAddress instanceof Inet6Address) {
peerType = PeerType.PEER_IPV6;
} else {
logger.log(Level.SEVERE, "unknown type of InetSocketAddress: {}", address);
}
int port = ((InetSocketAddress) address).getPort();
byte[] portBytes = new byte[IP_PORT_BYTES];
portBytes[0] = (byte) (port & IP_PORT_UPPER_MASK);
portBytes[1] = (byte) (port & IP_PORT_LOWER_MASK);
peerAddress = Bytes.concat(inetAddress.getAddress(), portBytes);
} else if (address.getClass().getName().equals("io.netty.channel.unix.DomainSocketAddress")) {
// To avoid a compile time dependency on grpc-netty, we check against the runtime class name.
peerType = PeerType.PEER_UNIX;
// DomainSocketAddress.toString() is equivalent to DomainSocketAdddress.path()
peerAddress = address.toString().getBytes(Charset.defaultCharset());
}
Peer.Builder builder = Peer.newBuilder();
if (peerType != null) {
builder.setPeerType(peerType);
}
if (peerAddress != null) {
builder.setPeer(ByteString.copyFrom(peerAddress));
}
return builder.build();
}
@VisibleForTesting
static io.grpc.binarylog.Metadata metadataToProto(Metadata metadata, int maxHeaderBytes) {
Preconditions.checkState(maxHeaderBytes >= 0);
Builder builder = io.grpc.binarylog.Metadata.newBuilder();
if (maxHeaderBytes > 0) {
byte[][] serialized = InternalMetadata.serialize(metadata);
int written = 0;
// This code is tightly coupled with Metadata's implementation
for (int i = 0; i < serialized.length && written < maxHeaderBytes; i += 2) {
byte[] key = serialized[i];
byte[] value = serialized[i + 1];
if (written + key.length + value.length <= maxHeaderBytes) {
builder.addEntry(
MetadataEntry
.newBuilder()
.setKeyBytes(ByteString.copyFrom(key))
.setValue(ByteString.copyFrom(value))
.build());
written += key.length;
written += value.length;
}
}
}
return builder.build();
}
@VisibleForTesting
static Message messageToProto(byte[] message, boolean compressed, int maxMessageBytes) {
Preconditions.checkState(maxMessageBytes >= 0);
Message.Builder builder = Message
.newBuilder()
.setFlags(flagsForMessage(compressed))
.setLength(message.length);
if (maxMessageBytes > 0) {
int limit = Math.min(maxMessageBytes, message.length);
builder.setData(ByteString.copyFrom(message, 0, limit));
}
return builder.build();
}
/**
* Returns a flag based on the arguments.
*/
@VisibleForTesting
static int flagsForMessage(boolean compressed) {
return compressed ? 1 : 0;
}
}

View File

@ -0,0 +1,109 @@
// Copyright 2016, gRPC Authors
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Service exported by server reflection
syntax = "proto3";
package grpc.binarylog.v1alpha;
option java_multiple_files = true;
option java_package = "io.grpc.binarylog";
option java_outer_classname = "BinaryLogProto";
// Log entry we store in binary logs
message GrpcLogEntry {
// Enumerates the type of logs
enum Type {
SEND_INITIAL_METADATA = 0;
SEND_TRAILING_METADATA = 1;
SEND_MESSAGE = 2;
RECV_INITIAL_METADATA = 3;
RECV_TRAILING_METADATA = 4;
RECV_MESSAGE = 5;
};
// Enumerates the entity that generates the log entry
enum Logger {
CLIENT = 0;
SERVER = 1;
}
Type type = 1; // One of the above Type enum
Logger logger = 2; // One of the above Logger enum
// Uniquely identifies a call. Each call may have several log entries, they
// will share the same call_id. 128 bits split into 2 64-bit parts.
Uint128 call_id = 3;
// The logger uses one of the following fields to record the payload,
// according to the type of the log entry.
oneof payload {
// Used by CLIENT_INIT_METADATA, SERVER_INIT_METADATA and TRAILING_METADATA
Metadata metadata = 4;
// Used by REQUEST and RESPONSE
Message message = 5;
}
// Peer address information, will only be recorded in SEND_INITIAL_METADATA
// and RECV_INITIAL_METADATA entries.
Peer peer = 6;
};
// Message payload, used by REQUEST and RESPONSE
message Message {
// This flag is currently used to indicate whether the payload is compressed,
// it may contain other semantics in the future. Value of 1 indicates that the
// binary octet sequence of Message is compressed using the mechanism declared
// by the Message-Encoding header. A value of 0 indicates that no encoding of
// Message bytes has occurred.
uint32 flags = 1; // TODO(zpencer): this is changed because there is no uint8
// Length of the message. It may not be the same as the length of the
// data field, as the logging payload can be truncated or omitted.
uint32 length = 2;
// Binary payload, post compression (depends on the flags field), may be
// truncated or omitted.
bytes data = 3;
}
// A list of metadata pairs, used in the payload of CLIENT_INIT_METADATA,
// SERVER_INIT_METADATA and TRAILING_METADATA
// Implementations may omit some entries to honor the header limits
// of GRPC_BINARY_LOG_CONFIG. Implementations can choose which entries are logged.
message Metadata {
repeated MetadataEntry entry = 1;
}
// A metadata key value pair
message MetadataEntry {
string key = 1;
bytes value = 2;
}
// Peer information
message Peer {
enum PeerType {
PEER_IPV4 = 0; // peer is struct sockaddr_in
PEER_IPV6 = 1; // peer is struct sockaddr_in6
PEER_UNIX = 2; // peer is struct sockaddr_un
};
PeerType peer_type = 1;
bytes peer = 2; // value depends on peer_type
}
// Used to record call_id.
message Uint128 {
fixed64 high = 1;
fixed64 low = 2;
};

View File

@ -19,7 +19,19 @@ package io.grpc.services;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import com.google.common.primitives.Bytes;
import com.google.protobuf.ByteString;
import io.grpc.Metadata;
import io.grpc.binarylog.Message;
import io.grpc.binarylog.MetadataEntry;
import io.grpc.binarylog.Peer;
import io.grpc.binarylog.Uint128;
import io.grpc.services.BinaryLog.FactoryImpl;
import io.netty.channel.unix.DomainSocketAddress;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.charset.Charset;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@ -27,6 +39,7 @@ import org.junit.runners.JUnit4;
/** Tests for {@link BinaryLog}. */
@RunWith(JUnit4.class)
public final class BinaryLogTest {
private static final Charset US_ASCII = Charset.forName("US-ASCII");
private static final BinaryLog HEADER_FULL = new Builder().header(Integer.MAX_VALUE).build();
private static final BinaryLog HEADER_256 = new Builder().header(256).build();
private static final BinaryLog MSG_FULL = new Builder().msg(Integer.MAX_VALUE).build();
@ -34,7 +47,51 @@ public final class BinaryLogTest {
private static final BinaryLog BOTH_256 = new Builder().header(256).msg(256).build();
private static final BinaryLog BOTH_FULL =
new Builder().header(Integer.MAX_VALUE).msg(Integer.MAX_VALUE).build();
private static final byte[] CALL_ID = new byte[] {
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x19, 0x10, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f };
private static final Metadata.Key<String> KEY_A =
Metadata.Key.of("a", Metadata.ASCII_STRING_MARSHALLER);
private static final Metadata.Key<String> KEY_B =
Metadata.Key.of("b", Metadata.ASCII_STRING_MARSHALLER);
private static final Metadata.Key<String> KEY_C =
Metadata.Key.of("c", Metadata.ASCII_STRING_MARSHALLER);
private static final MetadataEntry ENTRY_A;
private static final MetadataEntry ENTRY_B;
private static final MetadataEntry ENTRY_C;
private static final Metadata metadata;
private static final boolean IS_COMPRESSED = true;
private static final boolean IS_UNCOMPRESSED = false;
static {
String dataA = "aaaaaaaaa";
String dataB = "bbbbbbbbb";
String dataC = "ccccccccc";
metadata = new Metadata();
metadata.put(KEY_A, dataA);
metadata.put(KEY_B, dataB);
metadata.put(KEY_C, dataC);
ENTRY_A =
MetadataEntry
.newBuilder()
.setKey(KEY_A.name())
.setValue(ByteString.copyFrom(dataA.getBytes(US_ASCII)))
.build();
ENTRY_B =
MetadataEntry
.newBuilder()
.setKey(KEY_B.name())
.setValue(ByteString.copyFrom(dataB.getBytes(US_ASCII)))
.build();
ENTRY_C =
MetadataEntry
.newBuilder()
.setKey(KEY_C.name())
.setValue(ByteString.copyFrom(dataC.getBytes(US_ASCII)))
.build();
}
@Test
public void configBinLog_global() throws Exception {
@ -203,6 +260,192 @@ public final class BinaryLogTest {
assertEquals(HEADER_256, factory.getLog("p.other2/m"));
}
@Test
public void callIdToProto() {
assertEquals(
Uint128
.newBuilder()
.setHigh(0x1112131415161718L)
.setLow(0x19101a1b1c1d1e1fL)
.build(),
BinaryLog.callIdToProto(CALL_ID));
}
@Test(expected = IllegalArgumentException.class)
public void callIdToProto_invalid_shorter_len() {
BinaryLog.callIdToProto(new byte[14]);
}
@Test(expected = IllegalArgumentException.class)
public void callIdToProto_invalid_longer_len() {
BinaryLog.callIdToProto(new byte[18]);
}
@Test
public void socketToProto_ipv4() throws Exception {
InetAddress address = InetAddress.getByName("127.0.0.1");
int port = 12345;
InetSocketAddress socketAddress = new InetSocketAddress(address, port);
byte[] addressBytes = address.getAddress();
byte[] portBytes = new byte[] {(byte) (port & 0xff00), (byte) (port & 0xff)};
assertEquals(
Peer
.newBuilder()
.setPeerType(Peer.PeerType.PEER_IPV4)
.setPeer(ByteString.copyFrom(Bytes.concat(addressBytes, portBytes)))
.build(),
BinaryLog.socketToProto(socketAddress));
}
@Test
public void socketToProto_ipv6() throws Exception {
// this is a ipv6 link local address
InetAddress address = InetAddress.getByName("fe:80:12:34:56:78:90:ab");
int port = 12345;
InetSocketAddress socketAddress = new InetSocketAddress(address, port);
byte[] addressBytes = address.getAddress();
byte[] portBytes = new byte[] {(byte) (port & 0xff00), (byte) (port & 0xff)};
assertEquals(
Peer
.newBuilder()
.setPeerType(Peer.PeerType.PEER_IPV6)
.setPeer(ByteString.copyFrom(Bytes.concat(addressBytes, portBytes)))
.build(),
BinaryLog.socketToProto(socketAddress));
}
@Test
public void socketToProto_unix() throws Exception {
String path = "/some/path";
DomainSocketAddress socketAddress = new DomainSocketAddress(path);
assertEquals(
Peer
.newBuilder()
.setPeerType(Peer.PeerType.PEER_UNIX)
.setPeer(ByteString.copyFrom(path.getBytes(US_ASCII)))
.build(),
BinaryLog.socketToProto(socketAddress)
);
}
@Test
public void socketToProto_unknown() throws Exception {
SocketAddress unknownSocket = new SocketAddress() { };
assertEquals(
Peer.newBuilder().build(),
BinaryLog.socketToProto(unknownSocket)
);
}
@Test
public void metadataToProto() throws Exception {
assertEquals(
io.grpc.binarylog.Metadata
.newBuilder()
.addEntry(ENTRY_A)
.addEntry(ENTRY_B)
.addEntry(ENTRY_C)
.build(),
BinaryLog.metadataToProto(metadata, Integer.MAX_VALUE));
}
@Test
public void metadataToProto_truncated() throws Exception {
// 0 byte limit not enough for any metadata
assertEquals(
io.grpc.binarylog.Metadata
.newBuilder()
.build(),
BinaryLog.metadataToProto(metadata, 0));
// not enough bytes for first key value
assertEquals(
io.grpc.binarylog.Metadata
.newBuilder()
.build(),
BinaryLog.metadataToProto(metadata, 9));
// enough for first key value
assertEquals(
io.grpc.binarylog.Metadata
.newBuilder()
.addEntry(ENTRY_A)
.build(),
BinaryLog.metadataToProto(metadata, 10));
// Test edge cases for >= 2 key values
assertEquals(
io.grpc.binarylog.Metadata
.newBuilder()
.addEntry(ENTRY_A)
.build(),
BinaryLog.metadataToProto(metadata, 19));
assertEquals(
io.grpc.binarylog.Metadata
.newBuilder()
.addEntry(ENTRY_A)
.addEntry(ENTRY_B)
.build(),
BinaryLog.metadataToProto(metadata, 20));
assertEquals(
io.grpc.binarylog.Metadata
.newBuilder()
.addEntry(ENTRY_A)
.addEntry(ENTRY_B)
.build(),
BinaryLog.metadataToProto(metadata, 29));
assertEquals(
io.grpc.binarylog.Metadata
.newBuilder()
.addEntry(ENTRY_A)
.addEntry(ENTRY_B)
.addEntry(ENTRY_C)
.build(),
BinaryLog.metadataToProto(metadata, 30));
}
@Test
public void messageToProto() throws Exception {
byte[] bytes = "this is a long message: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
.getBytes(US_ASCII);
Message message = BinaryLog.messageToProto(bytes, false, Integer.MAX_VALUE);
assertEquals(
Message
.newBuilder()
.setData(ByteString.copyFrom(bytes))
.setFlags(0)
.setLength(bytes.length)
.build(),
message);
}
@Test
public void messageToProto_truncated() throws Exception {
byte[] bytes = "this is a long message: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
.getBytes(US_ASCII);
assertEquals(
Message
.newBuilder()
.setFlags(0)
.setLength(bytes.length)
.build(),
BinaryLog.messageToProto(bytes, false, 0));
int limit = 10;
assertEquals(
Message
.newBuilder()
.setData(ByteString.copyFrom(bytes, 0, limit))
.setFlags(0)
.setLength(bytes.length)
.build(),
BinaryLog.messageToProto(bytes, false, limit));
}
@Test
public void toFlag() throws Exception {
assertEquals(0, BinaryLog.flagsForMessage(IS_UNCOMPRESSED));
assertEquals(1, BinaryLog.flagsForMessage(IS_COMPRESSED));
}
/** A builder class to make unit test code more readable. */
private static final class Builder {
int maxHeaderBytes = 0;