Tabnine Logo
Controller$NodeUri$Builder.build
Code IndexAdd Tabnine to your IDE (free)

How to use
build
method
in
io.pravega.controller.stream.api.grpc.v1.Controller$NodeUri$Builder

Best Java code snippets using io.pravega.controller.stream.api.grpc.v1.Controller$NodeUri$Builder.build (Showing top 15 results out of 315)

origin: pravega/pravega

public CompletableFuture<List<NodeUri>> getControllerServerList() {
  if (cluster == null) {
    return Futures.failedFuture(new IllegalStateException("Controller cluster not initialized"));
  }
  return CompletableFuture.supplyAsync(() -> {
    try {
      return cluster.getClusterMembers().stream()
          .map(host -> NodeUri.newBuilder().setEndpoint(host.getIpAddr()).setPort(host.getPort()).build())
          .collect(Collectors.toList());
    } catch (ClusterException e) {
      // cluster implementation throws checked exceptions which cannot be thrown inside completable futures.
      throw Exceptions.sneakyThrow(e);
    }
  }, executor);
}
origin: pravega/pravega

/**
 * <code>repeated .io.pravega.controller.stream.api.grpc.v1.NodeUri nodeURI = 1;</code>
 */
public Builder addNodeURI(
  int index, io.pravega.controller.stream.api.grpc.v1.Controller.NodeUri.Builder builderForValue) {
 if (nodeURIBuilder_ == null) {
  ensureNodeURIIsMutable();
  nodeURI_.add(index, builderForValue.build());
  onChanged();
 } else {
  nodeURIBuilder_.addMessage(index, builderForValue.build());
 }
 return this;
}
/**
origin: pravega/pravega

/**
 * <code>repeated .io.pravega.controller.stream.api.grpc.v1.NodeUri nodeURI = 1;</code>
 */
public Builder addNodeURI(
  io.pravega.controller.stream.api.grpc.v1.Controller.NodeUri.Builder builderForValue) {
 if (nodeURIBuilder_ == null) {
  ensureNodeURIIsMutable();
  nodeURI_.add(builderForValue.build());
  onChanged();
 } else {
  nodeURIBuilder_.addMessage(builderForValue.build());
 }
 return this;
}
/**
origin: pravega/pravega

public static SegmentHelper getSegmentHelperMock() {
  SegmentHelper helper = spy(new SegmentHelper());
  doReturn(NodeUri.newBuilder().setEndpoint("localhost").setPort(SERVICE_PORT).build()).when(helper).getSegmentUri(
      anyString(), anyString(), anyLong(), any());
  doReturn(CompletableFuture.completedFuture(true)).when(helper).sealSegment(
      anyString(), anyString(), anyLong(), any(), any(), any(), anyLong());
  doReturn(CompletableFuture.completedFuture(true)).when(helper).createSegment(
      anyString(), anyString(), anyLong(), any(), any(), any(), any(), anyLong());
  doReturn(CompletableFuture.completedFuture(true)).when(helper).deleteSegment(
      anyString(), anyString(), anyLong(), any(), any(), any(), anyLong());
  doReturn(CompletableFuture.completedFuture(true)).when(helper).createTransaction(
      anyString(), anyString(), anyLong(), any(), any(), any(), any());
  doReturn(CompletableFuture.completedFuture(true)).when(helper).abortTransaction(
      anyString(), anyString(), anyLong(), any(), any(), any(), any());
  doReturn(CompletableFuture.completedFuture(true)).when(helper).commitTransaction(
      anyString(), anyString(), anyLong(), anyLong(), any(), any(), any(), any());
  doReturn(CompletableFuture.completedFuture(true)).when(helper).updatePolicy(
      anyString(), anyString(), any(), anyLong(), any(), any(), any(), anyLong());
  doReturn(CompletableFuture.completedFuture(true)).when(helper).truncateSegment(
      anyString(), anyString(), anyLong(), anyLong(), any(), any(), any(), anyLong());
  doReturn(CompletableFuture.completedFuture(new WireCommands.StreamSegmentInfo(0L, "", true, true, false, 0L, 0L, 0L))).when(helper).getSegmentInfo(
      anyString(), anyString(), anyLong(), any(), any(), anyString());
  return helper;
}
origin: pravega/pravega

@Before
public void setup() throws Exception {
  zkServer = new TestingServerStarter().start();
  zkServer.start();
  zkClient = CuratorFrameworkFactory.newClient(zkServer.getConnectString(),
      new ExponentialBackoffRetry(200, 10, 5000));
  zkClient.start();
  streamStore = StreamStoreFactory.createZKStore(zkClient, executor);
  TaskMetadataStore taskMetadataStore = TaskStoreFactory.createZKStore(zkClient, executor);
  HostControllerStore hostStore = HostStoreFactory.createInMemoryStore(HostMonitorConfigImpl.dummyConfig());
  segmentHelperMock = spy(new SegmentHelper());
  doReturn(Controller.NodeUri.newBuilder().setEndpoint("localhost").setPort(Config.SERVICE_PORT).build()).when(segmentHelperMock).getSegmentUri(
      anyString(), anyString(), anyInt(), any());
  ConnectionFactoryImpl connectionFactory = new ConnectionFactoryImpl(ClientConfig.builder().build());
  streamMetadataTasks = new StreamMetadataTasks(streamStore, hostStore, taskMetadataStore, segmentHelperMock,
      executor, "host", connectionFactory, AuthHelper.getDisabledAuthHelper(), requestTracker);
  streamTransactionMetadataTasks = new StreamTransactionMetadataTasks(
      streamStore, hostStore, segmentHelperMock, executor, "host", connectionFactory, AuthHelper.getDisabledAuthHelper());
  controllerService = new ControllerService(streamStore, hostStore, streamMetadataTasks,
      streamTransactionMetadataTasks, segmentHelperMock, executor, null);
  controllerService.createScope(SCOPE).get();
}
origin: pravega/pravega

  public static SegmentHelper getFailingSegmentHelperMock() {
    SegmentHelper helper = spy(new SegmentHelper());

    doReturn(NodeUri.newBuilder().setEndpoint("localhost").setPort(SERVICE_PORT).build()).when(helper).getSegmentUri(
        anyString(), anyString(), anyLong(), any());

    doReturn(Futures.failedFuture(new RuntimeException())).when(helper).sealSegment(
        anyString(), anyString(), anyLong(), any(), any(), any(), anyLong());

    doReturn(Futures.failedFuture(new RuntimeException())).when(helper).createSegment(
        anyString(), anyString(), anyLong(), any(), any(), any(), any(), anyLong());

    doReturn(Futures.failedFuture(new RuntimeException())).when(helper).deleteSegment(
        anyString(), anyString(), anyLong(), any(), any(), any(), anyLong());

    doReturn(Futures.failedFuture(new RuntimeException())).when(helper).createTransaction(
        anyString(), anyString(), anyLong(), any(), any(), any(), any());

    doReturn(Futures.failedFuture(new RuntimeException())).when(helper).abortTransaction(
        anyString(), anyString(), anyLong(), any(), any(), any(), any());

    doReturn(Futures.failedFuture(new RuntimeException())).when(helper).commitTransaction(
        anyString(), anyString(), anyLong(), anyLong(), any(), any(), any(), any());

    doReturn(Futures.failedFuture(new RuntimeException())).when(helper).updatePolicy(
        anyString(), anyString(), any(), anyLong(), any(), any(), any(), anyLong());

    return helper;
  }
}
origin: pravega/pravega

/**
 * <code>repeated .io.pravega.controller.stream.api.grpc.v1.NodeUri nodeURI = 1;</code>
 */
public Builder setNodeURI(
  int index, io.pravega.controller.stream.api.grpc.v1.Controller.NodeUri.Builder builderForValue) {
 if (nodeURIBuilder_ == null) {
  ensureNodeURIIsMutable();
  nodeURI_.set(index, builderForValue.build());
  onChanged();
 } else {
  nodeURIBuilder_.setMessage(index, builderForValue.build());
 }
 return this;
}
/**
origin: pravega/pravega

  @Override
  public void getURI(SegmentId request, StreamObserver<NodeUri> responseObserver) {
    responseObserver.onNext(NodeUri.newBuilder().setEndpoint("localhost1").setPort(1).build());
    responseObserver.onCompleted();
  }
};
origin: pravega/pravega

@Override
public void getURI(SegmentId request, StreamObserver<NodeUri> responseObserver) {
  if (request.getStreamInfo().getStream().equals("stream1")) {
    responseObserver.onNext(NodeUri.newBuilder().setEndpoint("localhost").
        setPort(SERVICE_PORT).build());
    responseObserver.onCompleted();
  } else {
    responseObserver.onError(Status.INTERNAL.withDescription("Server error").asRuntimeException());
  }
}
origin: pravega/pravega

/**
 * Converts PravegaNodeURI into NodeURI.
 *
 * @param uri The PravegaNodeURI string.
 * @return Node URI string.
 */
public static final NodeUri decode(final PravegaNodeUri uri) {
  Preconditions.checkNotNull(uri, "uri");
  return NodeUri.newBuilder().setEndpoint(uri.getEndpoint()).setPort(uri.getPort()).build();
}
origin: pravega/pravega

  @Override
  public void getURI(SegmentId request, StreamObserver<NodeUri> responseObserver) {
    responseObserver.onNext(NodeUri.newBuilder().setEndpoint("localhost2").setPort(2).build());
    responseObserver.onCompleted();
  }
};
origin: pravega/pravega

@Override
public void getControllerServerList(ServerRequest request, StreamObserver<ServerResponse> responseObserver) {
  responseObserver.onNext(ServerResponse.newBuilder()
      .addNodeURI(NodeUri.newBuilder().setEndpoint("localhost").setPort(serverPort1).build())
      .addNodeURI(NodeUri.newBuilder().setEndpoint("localhost").setPort(serverPort2).build())
      .addNodeURI(NodeUri.newBuilder().setEndpoint("localhost").setPort(serverPort3).build())
      .build());
  responseObserver.onCompleted();
}
origin: pravega/pravega

  @Override
  public void getURI(SegmentId request, StreamObserver<NodeUri> responseObserver) {
    responseObserver.onNext(NodeUri.newBuilder().setEndpoint("localhost3").setPort(3).build());
    responseObserver.onCompleted();
  }
};
origin: pravega/pravega

@Override
public void getControllerServerList(ServerRequest request, StreamObserver<ServerResponse> responseObserver) {
  responseObserver.onNext(ServerResponse.newBuilder()
      .addNodeURI(NodeUri.newBuilder().setEndpoint("localhost").setPort(serverPort1).build())
      .addNodeURI(NodeUri.newBuilder().setEndpoint("localhost").setPort(serverPort2).build())
      .addNodeURI(NodeUri.newBuilder().setEndpoint("localhost").setPort(serverPort3).build())
      .build());
  responseObserver.onCompleted();
}
origin: pravega/pravega

public Controller.NodeUri getSegmentUri(final String scope,
                    final String stream,
                    final long segmentId,
                    final HostControllerStore hostStore) {
  final Host host = hostStore.getHostForSegment(scope, stream, segmentId);
  return Controller.NodeUri.newBuilder().setEndpoint(host.getIpAddr()).setPort(host.getPort()).build();
}
io.pravega.controller.stream.api.grpc.v1Controller$NodeUri$Builderbuild

Popular methods of Controller$NodeUri$Builder

  • setPort
    int32 port = 2;
  • setEndpoint
    string endpoint = 1;
  • <init>
  • buildPartial
  • maybeForceBuilderInitialization
  • mergeFrom
  • mergeUnknownFields
  • newUninitializedMessageException
  • onBuilt
  • onChanged

Popular in Java

  • Running tasks concurrently on multiple threads
  • runOnUiThread (Activity)
  • onCreateOptionsMenu (Activity)
  • requestLocationUpdates (LocationManager)
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now