2

my java class is below,

public final class TraceOptions {
private final byte options;

private TraceOptions(byte options) {
    this.options = options;
}

What type in protobuffer 3 should I put here?

message TraceOptions {
  ? traceOptions = 1;
 }
Nick Chapman
  • 4,402
  • 1
  • 27
  • 41
zheyi yi
  • 129
  • 10

1 Answers1

1

Are you just looking for bytes? It's listed under the Scalar Value Types in the docs. It's typically used to store a variable length number of bytes, so not sure on the efficiency of using it to store a single byte.

The type uint32 uses a variable length encoding, so that's probably the most efficient thing you can do.

If you look at how integers are encoded in the docs here you'll see that using an int32 is likely your best bet.

Nick Chapman
  • 4,402
  • 1
  • 27
  • 41