use of rpc.turbo.util.uuid.ObjectId in project turbo-rpc by hank-whu.
the class TracerSerializer method read.
public final Tracer read(ByteBuf buffer) {
byte flag = buffer.readByte();
if (flag == 0) {
return null;
}
Tracer tracer = new Tracer();
if ((flag & TRACE_ID_FLAG) == TRACE_ID_FLAG) {
tracer.setTraceId(new ObjectId(buffer));
}
if ((flag & SPAN_ID_FLAG) == SPAN_ID_FLAG) {
tracer.setSpanId(ByteBufUtils.readVarLong(buffer));
}
if ((flag & PARENT_ID_FLAG) == PARENT_ID_FLAG) {
tracer.setParentId(ByteBufUtils.readVarLong(buffer));
}
if ((flag & CS_FLAG) == CS_FLAG) {
tracer.setCs(ByteBufUtils.readVarLong(buffer));
}
if ((flag & CR_FLAG) == CR_FLAG) {
tracer.setCr(ByteBufUtils.readVarLong(buffer));
}
if ((flag & SS_FLAG) == SS_FLAG) {
tracer.setSs(ByteBufUtils.readVarLong(buffer));
}
if ((flag & SR_FLAG) == SR_FLAG) {
tracer.setSr(ByteBufUtils.readVarLong(buffer));
}
return tracer;
}