Tabnine Logo
KeyValue.numberValue
Code IndexAdd Tabnine to your IDE (free)

How to use
numberValue
method
in
org.apache.bookkeeper.api.kv.result.KeyValue

Best Java code snippets using org.apache.bookkeeper.api.kv.result.KeyValue.numberValue (Showing top 4 results out of 315)

origin: org.apache.pulsar/pulsar-client-tools

if (kv.version() > lastVersion) {
  if (kv.isNumber()) {
    System.out.println("value = " + kv.numberValue());
  } else {
    System.out.println("value = " + new String(ByteBufUtil.getBytes(kv.value()), UTF_8));
origin: org.apache.bookkeeper/stream-storage-api

default CompletableFuture<Long> getNumber(K pKey, K lKey) {
  RangeOption<K> option = opFactory().optionFactory().newRangeOption().build();
  return get(pKey, lKey, option)
    .thenCompose(result -> {
      try {
        if (result.count() == 0) {
          return FutureUtils.value(null);
        } else {
          KeyValue<K, V> kv = result.kvs().get(0);
          if (kv.isNumber()) {
            return FutureUtils.value(kv.numberValue());
          } else {
            return FutureUtils.exception(new KvApiException(
              Code.ILLEGAL_OP, "Key (" + pKey + ", " + lKey + ") doesn't have any number value"));
          }
        }
      } finally {
        result.close();
      }
    })
    .whenComplete((value, cause) -> option.close());
}
origin: org.apache.bookkeeper/stream-storage-api

default CompletableFuture<Long> getNumber(K key) {
  RangeOption<K> option = opFactory().optionFactory().newRangeOption().build();
  return get(key, option)
    .thenCompose(result -> {
      try {
        if (result.count() == 0) {
          return FutureUtils.value(null);
        } else {
          KeyValue<K, V> kv = result.kvs().get(0);
          if (kv.isNumber()) {
            return FutureUtils.value(kv.numberValue());
          } else {
            return FutureUtils.exception(new KvApiException(
              Code.ILLEGAL_OP, "Key (" + key + ") doesn't have any number value"));
          }
        }
      } finally {
        result.close();
      }
    })
    .whenComplete((value, cause) -> option.close());
}
origin: org.apache.bookkeeper/statelib

Long getNumber(K key) {
  try (RangeOp<K, V> op = opFactory.newRange(
    key,
    opFactory.optionFactory().newRangeOption()
      .limit(1)
      .build())) {
    try (RangeResult<K, V> result = range(op)) {
      if (Code.OK != result.code()) {
        throw new MVCCStoreException(result.code(),
          "Failed to retrieve key from store " + name + " : code = " + result.code());
      }
      if (result.count() <= 0) {
        return null;
      } else {
        return result.kvs().get(0).numberValue();
      }
    }
  }
}
org.apache.bookkeeper.api.kv.resultKeyValuenumberValue

Popular methods of KeyValue

  • value
  • isNumber
  • close
  • version

Popular in Java

  • Making http requests using okhttp
  • getExternalFilesDir (Context)
  • getResourceAsStream (ClassLoader)
  • onRequestPermissionsResult (Fragment)
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Runner (org.openjdk.jmh.runner)
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Best IntelliJ plugins
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