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

cloud.prefab.domain.RateLimitServiceGrpc Maven / Gradle / Ivy

Go to download

API Client for https://prefab.cloud: rate limits, feature flags and semaphores as a service

The newest version!
package cloud.prefab.domain;

import static io.grpc.MethodDescriptor.generateFullMethodName;

/**
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.48.0)",
    comments = "Source: prefab.proto")
@io.grpc.stub.annotations.GrpcGenerated
public final class RateLimitServiceGrpc {

  private RateLimitServiceGrpc() {}

  public static final String SERVICE_NAME = "prefab.RateLimitService";

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

  @io.grpc.stub.annotations.RpcMethod(
      fullMethodName = SERVICE_NAME + '/' + "LimitCheck",
      requestType = cloud.prefab.domain.Prefab.LimitRequest.class,
      responseType = cloud.prefab.domain.Prefab.LimitResponse.class,
      methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
  public static io.grpc.MethodDescriptor getLimitCheckMethod() {
    io.grpc.MethodDescriptor getLimitCheckMethod;
    if ((getLimitCheckMethod = RateLimitServiceGrpc.getLimitCheckMethod) == null) {
      synchronized (RateLimitServiceGrpc.class) {
        if ((getLimitCheckMethod = RateLimitServiceGrpc.getLimitCheckMethod) == null) {
          RateLimitServiceGrpc.getLimitCheckMethod = getLimitCheckMethod =
              io.grpc.MethodDescriptor.newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "LimitCheck"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  cloud.prefab.domain.Prefab.LimitRequest.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  cloud.prefab.domain.Prefab.LimitResponse.getDefaultInstance()))
              .setSchemaDescriptor(new RateLimitServiceMethodDescriptorSupplier("LimitCheck"))
              .build();
        }
      }
    }
    return getLimitCheckMethod;
  }

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

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

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

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

    /**
     */
    public void limitCheck(cloud.prefab.domain.Prefab.LimitRequest request,
        io.grpc.stub.StreamObserver responseObserver) {
      io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getLimitCheckMethod(), responseObserver);
    }

    @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
          .addMethod(
            getLimitCheckMethod(),
            io.grpc.stub.ServerCalls.asyncUnaryCall(
              new MethodHandlers<
                cloud.prefab.domain.Prefab.LimitRequest,
                cloud.prefab.domain.Prefab.LimitResponse>(
                  this, METHODID_LIMIT_CHECK)))
          .build();
    }
  }

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

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

    /**
     */
    public void limitCheck(cloud.prefab.domain.Prefab.LimitRequest request,
        io.grpc.stub.StreamObserver responseObserver) {
      io.grpc.stub.ClientCalls.asyncUnaryCall(
          getChannel().newCall(getLimitCheckMethod(), getCallOptions()), request, responseObserver);
    }
  }

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

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

    /**
     */
    public cloud.prefab.domain.Prefab.LimitResponse limitCheck(cloud.prefab.domain.Prefab.LimitRequest request) {
      return io.grpc.stub.ClientCalls.blockingUnaryCall(
          getChannel(), getLimitCheckMethod(), getCallOptions(), request);
    }
  }

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

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

    /**
     */
    public com.google.common.util.concurrent.ListenableFuture limitCheck(
        cloud.prefab.domain.Prefab.LimitRequest request) {
      return io.grpc.stub.ClientCalls.futureUnaryCall(
          getChannel().newCall(getLimitCheckMethod(), getCallOptions()), request);
    }
  }

  private static final int METHODID_LIMIT_CHECK = 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 RateLimitServiceImplBase serviceImpl;
    private final int methodId;

    MethodHandlers(RateLimitServiceImplBase 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) {
        case METHODID_LIMIT_CHECK:
          serviceImpl.limitCheck((cloud.prefab.domain.Prefab.LimitRequest) request,
              (io.grpc.stub.StreamObserver) responseObserver);
          break;
        default:
          throw new AssertionError();
      }
    }

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

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

    @java.lang.Override
    public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
      return cloud.prefab.domain.Prefab.getDescriptor();
    }

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

  private static final class RateLimitServiceFileDescriptorSupplier
      extends RateLimitServiceBaseDescriptorSupplier {
    RateLimitServiceFileDescriptorSupplier() {}
  }

  private static final class RateLimitServiceMethodDescriptorSupplier
      extends RateLimitServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final String methodName;

    RateLimitServiceMethodDescriptorSupplier(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 (RateLimitServiceGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new RateLimitServiceFileDescriptorSupplier())
              .addMethod(getLimitCheckMethod())
              .build();
        }
      }
    }
    return result;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy