All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.navercorp.pinpoint.grpc.trace.SpanGrpc Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
package com.navercorp.pinpoint.grpc.trace;

import static io.grpc.MethodDescriptor.generateFullMethodName;

/**
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.36.2)",
    comments = "Source: v1/Service.proto")
public final class SpanGrpc {

  private SpanGrpc() {}

  public static final String SERVICE_NAME = "v1.Span";

  // Static method descriptors that strictly reflect the proto.
  private static volatile io.grpc.MethodDescriptor getSendSpanMethod;

  @io.grpc.stub.annotations.RpcMethod(
      fullMethodName = SERVICE_NAME + '/' + "SendSpan",
      requestType = com.navercorp.pinpoint.grpc.trace.PSpanMessage.class,
      responseType = com.google.protobuf.Empty.class,
      methodType = io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
  public static io.grpc.MethodDescriptor getSendSpanMethod() {
    io.grpc.MethodDescriptor getSendSpanMethod;
    if ((getSendSpanMethod = SpanGrpc.getSendSpanMethod) == null) {
      synchronized (SpanGrpc.class) {
        if ((getSendSpanMethod = SpanGrpc.getSendSpanMethod) == null) {
          SpanGrpc.getSendSpanMethod = getSendSpanMethod =
              io.grpc.MethodDescriptor.newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "SendSpan"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.navercorp.pinpoint.grpc.trace.PSpanMessage.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.google.protobuf.Empty.getDefaultInstance()))
              .setSchemaDescriptor(new SpanMethodDescriptorSupplier("SendSpan"))
              .build();
        }
      }
    }
    return getSendSpanMethod;
  }

  /**
   * Creates a new async stub that supports all call types for the service
   */
  public static SpanStub newStub(io.grpc.Channel channel) {
    io.grpc.stub.AbstractStub.StubFactory factory =
      new io.grpc.stub.AbstractStub.StubFactory() {
        @java.lang.Override
        public SpanStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
          return new SpanStub(channel, callOptions);
        }
      };
    return SpanStub.newStub(factory, channel);
  }

  /**
   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
   */
  public static SpanBlockingStub newBlockingStub(
      io.grpc.Channel channel) {
    io.grpc.stub.AbstractStub.StubFactory factory =
      new io.grpc.stub.AbstractStub.StubFactory() {
        @java.lang.Override
        public SpanBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
          return new SpanBlockingStub(channel, callOptions);
        }
      };
    return SpanBlockingStub.newStub(factory, channel);
  }

  /**
   * Creates a new ListenableFuture-style stub that supports unary calls on the service
   */
  public static SpanFutureStub newFutureStub(
      io.grpc.Channel channel) {
    io.grpc.stub.AbstractStub.StubFactory factory =
      new io.grpc.stub.AbstractStub.StubFactory() {
        @java.lang.Override
        public SpanFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
          return new SpanFutureStub(channel, callOptions);
        }
      };
    return SpanFutureStub.newStub(factory, channel);
  }

  /**
   */
  public static abstract class SpanImplBase implements io.grpc.BindableService {

    /**
     */
    public io.grpc.stub.StreamObserver sendSpan(
        io.grpc.stub.StreamObserver responseObserver) {
      return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getSendSpanMethod(), responseObserver);
    }

    @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
          .addMethod(
            getSendSpanMethod(),
            io.grpc.stub.ServerCalls.asyncClientStreamingCall(
              new MethodHandlers<
                com.navercorp.pinpoint.grpc.trace.PSpanMessage,
                com.google.protobuf.Empty>(
                  this, METHODID_SEND_SPAN)))
          .build();
    }
  }

  /**
   */
  public static final class SpanStub extends io.grpc.stub.AbstractAsyncStub {
    private SpanStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected SpanStub build(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      return new SpanStub(channel, callOptions);
    }

    /**
     */
    public io.grpc.stub.StreamObserver sendSpan(
        io.grpc.stub.StreamObserver responseObserver) {
      return io.grpc.stub.ClientCalls.asyncClientStreamingCall(
          getChannel().newCall(getSendSpanMethod(), getCallOptions()), responseObserver);
    }
  }

  /**
   */
  public static final class SpanBlockingStub extends io.grpc.stub.AbstractBlockingStub {
    private SpanBlockingStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected SpanBlockingStub build(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      return new SpanBlockingStub(channel, callOptions);
    }
  }

  /**
   */
  public static final class SpanFutureStub extends io.grpc.stub.AbstractFutureStub {
    private SpanFutureStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected SpanFutureStub build(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      return new SpanFutureStub(channel, callOptions);
    }
  }

  private static final int METHODID_SEND_SPAN = 0;

  private static final class MethodHandlers implements
      io.grpc.stub.ServerCalls.UnaryMethod,
      io.grpc.stub.ServerCalls.ServerStreamingMethod,
      io.grpc.stub.ServerCalls.ClientStreamingMethod,
      io.grpc.stub.ServerCalls.BidiStreamingMethod {
    private final SpanImplBase serviceImpl;
    private final int methodId;

    MethodHandlers(SpanImplBase serviceImpl, int methodId) {
      this.serviceImpl = serviceImpl;
      this.methodId = methodId;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) {
      switch (methodId) {
        default:
          throw new AssertionError();
      }
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public io.grpc.stub.StreamObserver invoke(
        io.grpc.stub.StreamObserver responseObserver) {
      switch (methodId) {
        case METHODID_SEND_SPAN:
          return (io.grpc.stub.StreamObserver) serviceImpl.sendSpan(
              (io.grpc.stub.StreamObserver) responseObserver);
        default:
          throw new AssertionError();
      }
    }
  }

  private static abstract class SpanBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
    SpanBaseDescriptorSupplier() {}

    @java.lang.Override
    public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
      return com.navercorp.pinpoint.grpc.trace.ServiceProto.getDescriptor();
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
      return getFileDescriptor().findServiceByName("Span");
    }
  }

  private static final class SpanFileDescriptorSupplier
      extends SpanBaseDescriptorSupplier {
    SpanFileDescriptorSupplier() {}
  }

  private static final class SpanMethodDescriptorSupplier
      extends SpanBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final String methodName;

    SpanMethodDescriptorSupplier(String methodName) {
      this.methodName = methodName;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
      return getServiceDescriptor().findMethodByName(methodName);
    }
  }

  private static volatile io.grpc.ServiceDescriptor serviceDescriptor;

  public static io.grpc.ServiceDescriptor getServiceDescriptor() {
    io.grpc.ServiceDescriptor result = serviceDescriptor;
    if (result == null) {
      synchronized (SpanGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new SpanFileDescriptorSupplier())
              .addMethod(getSendSpanMethod())
              .build();
        }
      }
    }
    return result;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy