Tabnine Logo
MLDataFormats$ManagedCursorInfo.newBuilder
Code IndexAdd Tabnine to your IDE (free)

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

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

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: 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

public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
origin: com.yahoo.pulsar/managed-ledger

public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(org.apache.bookkeeper.mledger.proto.MLDataFormats.ManagedCursorInfo prototype) {
origin: com.yahoo.pulsar/managed-ledger

public Builder toBuilder() { return newBuilder(this); }

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

public static Builder newBuilder(org.apache.bookkeeper.mledger.proto.MLDataFormats.ManagedCursorInfo prototype) {
 return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
origin: com.yahoo.pulsar/managed-ledger

public static org.apache.bookkeeper.mledger.proto.MLDataFormats.ManagedCursorInfo parseDelimitedFrom(
  java.io.InputStream input,
  com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  throws java.io.IOException {
 Builder builder = newBuilder();
 if (builder.mergeDelimitedFrom(input, extensionRegistry)) {
  return builder.buildParsed();
 } else {
  return null;
 }
}
public static org.apache.bookkeeper.mledger.proto.MLDataFormats.ManagedCursorInfo parseFrom(
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 parseManagedCursorInfoFromText(byte[] data) throws ParseException {
  ManagedCursorInfo.Builder builder = ManagedCursorInfo.newBuilder();
  TextFormat.merge(new String(data, Encoding), builder);
  return builder.build();
}
origin: com.yahoo.pulsar/managed-ledger

public static org.apache.bookkeeper.mledger.proto.MLDataFormats.ManagedCursorInfo parseFrom(
  com.google.protobuf.ByteString data,
  com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  throws com.google.protobuf.InvalidProtocolBufferException {
 return newBuilder().mergeFrom(data, extensionRegistry)
      .buildParsed();
}
public static org.apache.bookkeeper.mledger.proto.MLDataFormats.ManagedCursorInfo parseFrom(byte[] data)
origin: com.yahoo.pulsar/managed-ledger

public static org.apache.bookkeeper.mledger.proto.MLDataFormats.ManagedCursorInfo parseDelimitedFrom(java.io.InputStream input)
  throws java.io.IOException {
 Builder builder = newBuilder();
 if (builder.mergeDelimitedFrom(input)) {
  return builder.buildParsed();
 } else {
  return null;
 }
}
public static org.apache.bookkeeper.mledger.proto.MLDataFormats.ManagedCursorInfo parseDelimitedFrom(
origin: com.yahoo.pulsar/managed-ledger

public static org.apache.bookkeeper.mledger.proto.MLDataFormats.ManagedCursorInfo parseFrom(
  com.google.protobuf.CodedInputStream input,
  com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  throws java.io.IOException {
 return newBuilder().mergeFrom(input, extensionRegistry)
      .buildParsed();
}

origin: com.yahoo.pulsar/managed-ledger

public static org.apache.bookkeeper.mledger.proto.MLDataFormats.ManagedCursorInfo parseFrom(
  byte[] data,
  com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  throws com.google.protobuf.InvalidProtocolBufferException {
 return newBuilder().mergeFrom(data, extensionRegistry)
      .buildParsed();
}
public static org.apache.bookkeeper.mledger.proto.MLDataFormats.ManagedCursorInfo parseFrom(java.io.InputStream input)
origin: com.yahoo.pulsar/managed-ledger

public static org.apache.bookkeeper.mledger.proto.MLDataFormats.ManagedCursorInfo parseFrom(
  java.io.InputStream input,
  com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  throws java.io.IOException {
 return newBuilder().mergeFrom(input, extensionRegistry)
      .buildParsed();
}
public static org.apache.bookkeeper.mledger.proto.MLDataFormats.ManagedCursorInfo parseDelimitedFrom(java.io.InputStream input)
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: 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

public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
org.apache.bookkeeper.mledger.protoMLDataFormats$ManagedCursorInfonewBuilder

Popular methods of MLDataFormats$ManagedCursorInfo

  • getCursorsLedgerId
    If the ledger id is -1, then the mark-delete position is the one from the (ledgerId, entryId) sna
  • getIndividualDeletedMessagesCount
    repeated .MessageRange individualDeletedMessages = 4;
  • <init>
  • getDefaultInstance
  • getDescriptor
  • getIndividualDeletedMessages
    repeated .MessageRange individualDeletedMessages = 4;
  • getIndividualDeletedMessagesList
    repeated .MessageRange individualDeletedMessages = 4;
  • getMarkDeleteEntryId
    optional int64 markDeleteEntryId = 3;
  • getMarkDeleteLedgerId
    Last snapshot of the mark-delete position optional int64 markDeleteLedgerId = 2;
  • hasCursorsLedgerId
    If the ledger id is -1, then the mark-delete position is the one from the (ledgerId, entryId) sna
  • hasMarkDeleteEntryId
    optional int64 markDeleteEntryId = 3;
  • hasMarkDeleteLedgerId
    Last snapshot of the mark-delete position optional int64 markDeleteLedgerId = 2;
  • hasMarkDeleteEntryId,
  • hasMarkDeleteLedgerId,
  • isInitialized,
  • toByteArray,
  • getLastActive,
  • getProperties,
  • getPropertiesCount,
  • getPropertiesList,
  • getSerializedSize

Popular in Java

  • Parsing JSON documents to java classes using gson
  • notifyDataSetChanged (ArrayAdapter)
  • getApplicationContext (Context)
  • addToBackStack (FragmentTransaction)
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • 21 Best IntelliJ Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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