Codota Logo
MLDataFormats$ManagedCursorInfo$Builder.build
Code IndexAdd Codota to your IDE (free)

How to use
build
method
in
org.apache.bookkeeper.mledger.proto.MLDataFormats$ManagedCursorInfo$Builder

Best Java code snippets using org.apache.bookkeeper.mledger.proto.MLDataFormats$ManagedCursorInfo$Builder.build (Showing top 10 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ArrayList a =
  • Codota Iconnew ArrayList<String>()
  • Codota Iconnew ArrayList()
  • Codota Iconnew ArrayList<Object>()
  • Smart code suggestions by Codota
}
origin: apache/pulsar

private ManagedCursorInfo parseManagedCursorInfo(byte[] data)
    throws ParseException, InvalidProtocolBufferException {
  // First try binary format, then fallback to text
  try {
    return ManagedCursorInfo.parseFrom(data);
  } catch (InvalidProtocolBufferException e) {
    // Fallback to parsing protobuf text format
    ManagedCursorInfo.Builder builder = ManagedCursorInfo.newBuilder();
    TextFormat.merge(new String(data, Encoding), builder);
    return builder.build();
  }
}
origin: apache/pulsar

@Test(timeOut = 20000)
void updatingCursorNode() throws Exception {
  final MetaStore store = new MetaStoreImplZookeeper(zkc, executor);
  zkc.create("/managed-ledgers/my_test", "".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
  final CountDownLatch latch = new CountDownLatch(1);
  ManagedCursorInfo info = ManagedCursorInfo.newBuilder().setCursorsLedgerId(1).build();
  store.asyncUpdateCursorInfo("my_test", "c1", info, null, new MetaStoreCallback<Void>() {
    public void operationFailed(MetaStoreException e) {
      fail("should have succeeded");
    }
    public void operationComplete(Void result, Stat version) {
      // Update again using the version
      zkc.failNow(Code.CONNECTIONLOSS);
      ManagedCursorInfo info = ManagedCursorInfo.newBuilder().setCursorsLedgerId(2).build();
      store.asyncUpdateCursorInfo("my_test", "c1", info, version, new MetaStoreCallback<Void>() {
        public void operationFailed(MetaStoreException e) {
          // ok
          latch.countDown();
        }
        @Override
        public void operationComplete(Void result, Stat version) {
          fail("should have failed");
        }
      });
    }
  });
  latch.await();
}
origin: apache/pulsar

  public Object answer(InvocationOnMock invocation) {
    ManagedCursorInfo info = ManagedCursorInfo.newBuilder().setCursorsLedgerId(cursorsLedgerId)
        .setMarkDeleteLedgerId(markDeleteLedgerId).setMarkDeleteEntryId(markDeleteEntryId)
        .setLastActive(0L).build();
    Stat stat = mock(Stat.class);
    MetaStoreCallback<ManagedCursorInfo> callback = (MetaStoreCallback<ManagedCursorInfo>) invocation
        .getArguments()[2];
    callback.operationComplete(info, stat);
    return null;
  }
}).when(mockMetaStore).asyncGetCursorInfo(eq(mlName), eq(cursorName), any(MetaStoreCallback.class));
origin: apache/pulsar

  public void operationComplete(Void result, Stat version) {
    // Update again using the version
    zkc.failNow(Code.CONNECTIONLOSS);
    ManagedCursorInfo info = ManagedCursorInfo.newBuilder().setCursorsLedgerId(2).build();
    store.asyncUpdateCursorInfo("my_test", "c1", info, version, new MetaStoreCallback<Void>() {
      public void operationFailed(MetaStoreException e) {
        // ok
        latch.countDown();
      }
      @Override
      public void operationComplete(Void result, Stat version) {
        fail("should have failed");
      }
    });
  }
});
origin: apache/pulsar

private void persistPositionMetaStore(long cursorsLedgerId, PositionImpl position, Map<String, Long> properties,
    MetaStoreCallback<Void> callback, boolean persistIndividualDeletedMessageRanges) {
  // When closing we store the last mark-delete position in the z-node itself, so we won't need the cursor ledger,
  // hence we write it as -1. The cursor ledger is deleted once the z-node write is confirmed.
  ManagedCursorInfo.Builder info = ManagedCursorInfo.newBuilder() //
      .setCursorsLedgerId(cursorsLedgerId) //
      .setMarkDeleteLedgerId(position.getLedgerId()) //
      .setMarkDeleteEntryId(position.getEntryId()) //
      .setLastActive(lastActive); //
  info.addAllProperties(buildPropertiesMap(properties));
  if (persistIndividualDeletedMessageRanges) {
    info.addAllIndividualDeletedMessages(buildIndividualDeletedMessageRanges());
  }
  if (log.isDebugEnabled()) {
    log.debug("[{}][{}]  Closing cursor at md-position: {}", ledger.getName(), name, position);
  }
  ledger.getStore().asyncUpdateCursorInfo(ledger.getName(), name, info.build(), cursorLedgerStat,
      new MetaStoreCallback<Void>() {
        @Override
        public void operationComplete(Void result, Stat stat) {
          cursorLedgerStat = stat;
          callback.operationComplete(result, stat);
        }
        @Override
        public void operationFailed(MetaStoreException e) {
          callback.operationFailed(e);
        }
      });
}
origin: com.yahoo.pulsar/managed-ledger

private ManagedCursorInfo parseManagedCursorInfoFromText(byte[] data) throws ParseException {
  ManagedCursorInfo.Builder builder = ManagedCursorInfo.newBuilder();
  TextFormat.merge(new String(data, Encoding), builder);
  return builder.build();
}
origin: org.apache.pulsar/managed-ledger-original

private ManagedCursorInfo parseManagedCursorInfo(byte[] data)
    throws ParseException, InvalidProtocolBufferException {
  // First try binary format, then fallback to text
  try {
    return ManagedCursorInfo.parseFrom(data);
  } catch (InvalidProtocolBufferException e) {
    // Fallback to parsing protobuf text format
    ManagedCursorInfo.Builder builder = ManagedCursorInfo.newBuilder();
    TextFormat.merge(new String(data, Encoding), builder);
    return builder.build();
  }
}
origin: com.yahoo.pulsar/managed-ledger

private ManagedCursorInfo parseManagedCursorInfoFromBinary(byte[] data) throws InvalidProtocolBufferException {
  return ManagedCursorInfo.newBuilder().mergeFrom(data).build();
}
origin: com.yahoo.pulsar/managed-ledger

private void persistPositionMetaStore(long cursorsLedgerId, PositionImpl position,
    MetaStoreCallback<Void> callback) {
  // When closing we store the last mark-delete position in the z-node itself, so we won't need the cursor ledger,
  // hence we write it as -1. The cursor ledger is deleted once the z-node write is confirmed.
  ManagedCursorInfo.Builder info = ManagedCursorInfo.newBuilder() //
      .setCursorsLedgerId(cursorsLedgerId) //
      .setMarkDeleteLedgerId(position.getLedgerId()) //
      .setMarkDeleteEntryId(position.getEntryId()); //
  if (protobufFormat == ZNodeProtobufFormat.Binary) {
    info.addAllIndividualDeletedMessages(buildIndividualDeletedMessageRanges());
  }
  if (log.isDebugEnabled()) {
    log.debug("[{}][{}]  Closing cursor at md-position: {}", ledger.getName(), name, markDeletePosition);
  }
  ledger.getStore().asyncUpdateCursorInfo(ledger.getName(), name, info.build(), cursorLedgerStat,
      new MetaStoreCallback<Void>() {
        @Override
        public void operationComplete(Void result, Stat stat) {
          callback.operationComplete(result, stat);
        }
        @Override
        public void operationFailed(MetaStoreException e) {
          callback.operationFailed(e);
        }
      });
}
origin: org.apache.pulsar/managed-ledger-original

private void persistPositionMetaStore(long cursorsLedgerId, PositionImpl position, Map<String, Long> properties,
    MetaStoreCallback<Void> callback, boolean persistIndividualDeletedMessageRanges) {
  // When closing we store the last mark-delete position in the z-node itself, so we won't need the cursor ledger,
  // hence we write it as -1. The cursor ledger is deleted once the z-node write is confirmed.
  ManagedCursorInfo.Builder info = ManagedCursorInfo.newBuilder() //
      .setCursorsLedgerId(cursorsLedgerId) //
      .setMarkDeleteLedgerId(position.getLedgerId()) //
      .setMarkDeleteEntryId(position.getEntryId()) //
      .setLastActive(lastActive); //
  info.addAllProperties(buildPropertiesMap(properties));
  if (persistIndividualDeletedMessageRanges) {
    info.addAllIndividualDeletedMessages(buildIndividualDeletedMessageRanges());
  }
  if (log.isDebugEnabled()) {
    log.debug("[{}][{}]  Closing cursor at md-position: {}", ledger.getName(), name, position);
  }
  ledger.getStore().asyncUpdateCursorInfo(ledger.getName(), name, info.build(), cursorLedgerStat,
      new MetaStoreCallback<Void>() {
        @Override
        public void operationComplete(Void result, Stat stat) {
          cursorLedgerStat = stat;
          callback.operationComplete(result, stat);
        }
        @Override
        public void operationFailed(MetaStoreException e) {
          callback.operationFailed(e);
        }
      });
}
org.apache.bookkeeper.mledger.protoMLDataFormats$ManagedCursorInfo$Builderbuild

Popular methods of MLDataFormats$ManagedCursorInfo$Builder

  • setCursorsLedgerId
    If the ledger id is -1, then the mark-delete position is the one from the (ledgerId, entryId) sna
  • setMarkDeleteEntryId
    optional int64 markDeleteEntryId = 3;
  • setMarkDeleteLedgerId
    Last snapshot of the mark-delete position optional int64 markDeleteLedgerId = 2;
  • <init>
  • addAllIndividualDeletedMessages
    repeated .MessageRange individualDeletedMessages = 4;
  • buildPartial
  • ensureIndividualDeletedMessagesIsMutable
  • getIndividualDeletedMessages
    repeated .MessageRange individualDeletedMessages = 4;
  • getIndividualDeletedMessagesCount
    repeated .MessageRange individualDeletedMessages = 4;
  • getIndividualDeletedMessagesFieldBuilder
  • getParentForChildren
  • hasCursorsLedgerId
    If the ledger id is -1, then the mark-delete position is the one from the (ledgerId, entryId) sna
  • getParentForChildren,
  • hasCursorsLedgerId,
  • isClean,
  • maybeForceBuilderInitialization,
  • mergeFrom,
  • mergeUnknownFields,
  • newUninitializedMessageException,
  • onBuilt,
  • onChanged

Popular in Java

  • Reactive rest calls using spring rest template
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • runOnUiThread (Activity)
  • onCreateOptionsMenu (Activity)
  • ObjectMapper (com.fasterxml.jackson.databind)
    This mapper (or, data binder, or codec) provides functionality for converting between Java objects (
  • MalformedURLException (java.net)
    Thrown to indicate that a malformed URL has occurred. Either no legal protocol could be found in a s
  • HashSet (java.util)
    This class implements the Set interface, backed by a hash table (actually a HashMap instance). It m
  • Iterator (java.util)
    An iterator over a collection. Iterator takes the place of Enumeration in the Java Collections Frame
  • Table (org.hibernate.mapping)
    A relational table
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.This exception may include information for locating the er
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now