Codota Logo
RocksDbKeyValueReader.get
Code IndexAdd Codota to your IDE (free)

How to use
get
method
in
org.apache.samza.storage.kv.RocksDbKeyValueReader

Best Java code snippets using org.apache.samza.storage.kv.RocksDbKeyValueReader.get (Showing top 4 results out of 315)

  • Common ways to obtain RocksDbKeyValueReader
private void myMethod () {
RocksDbKeyValueReader r =
  • Codota IconString storeName;String dbPath;Config config;new RocksDbKeyValueReader(storeName, dbPath, config)
  • Smart code suggestions by Codota
}
origin: apache/samza

@Test
public void testReadCorrectDbValue() throws RocksDBException {
 HashMap<String, String> map = new HashMap<String, String>();
 map.put("stores." + DB_NAME + ".factory", "mockFactory");
 map.put("stores." + DB_NAME + ".key.serde", "string");
 map.put("stores." + DB_NAME + ".msg.serde", "string");
 Config config = new MapConfig(map);
 RocksDbKeyValueReader reader = new RocksDbKeyValueReader(DB_NAME, dirPath.toString(), config);
 assertEquals("this is string", reader.get("testString"));
 // should throw exception if the input is in other type
 boolean throwClassCastException = false;
 try {
  reader.get(123);
 } catch (Exception e) {
  if (e instanceof ClassCastException) {
   throwClassCastException = true;
  }
 }
 assertTrue(throwClassCastException);
 reader.stop();
 // test with customized serde
 map.put("serializers.registry.mock.class", IntegerSerdeFactory.class.getCanonicalName());
 map.put("stores." + DB_NAME + ".key.serde", "mock");
 map.put("stores." + DB_NAME + ".msg.serde", "mock");
 config = new MapConfig(map);
 reader = new RocksDbKeyValueReader(DB_NAME, dirPath.toString(), config);
 assertEquals(456, reader.get(123));
 assertNull(reader.get(789));
 reader.stop();
}
origin: org.apache.samza/samza-kv-rocksdb_2.11

 public static void main(String[] args) throws RocksDBException {
  RocksDbReadingTool tool = new RocksDbReadingTool();
  OptionSet options = tool.parser().parse(args);
  MapConfig config = tool.loadConfig(options);
  String path = tool.getDbPath();
  String dbName = tool.getDbName();
  RocksDbKeyValueReader kvReader = new RocksDbKeyValueReader(dbName, path, config);

  for (Object obj : tool.getKeys()) {
   Object result = kvReader.get(obj);
   tool.outputResult(obj, result);
  }

  kvReader.stop();
 }
}
origin: apache/samza

 public static void main(String[] args) throws RocksDBException {
  RocksDbReadingTool tool = new RocksDbReadingTool();
  OptionSet options = tool.parser().parse(args);
  MapConfig config = tool.loadConfig(options);
  String path = tool.getDbPath();
  String dbName = tool.getDbName();
  RocksDbKeyValueReader kvReader = new RocksDbKeyValueReader(dbName, path, config);

  for (Object obj : tool.getKeys()) {
   Object result = kvReader.get(obj);
   tool.outputResult(obj, result);
  }

  kvReader.stop();
 }
}
origin: org.apache.samza/samza-kv-rocksdb

 public static void main(String[] args) throws RocksDBException {
  RocksDbReadingTool tool = new RocksDbReadingTool();
  OptionSet options = tool.parser().parse(args);
  MapConfig config = tool.loadConfig(options);
  String path = tool.getDbPath();
  String dbName = tool.getDbName();
  RocksDbKeyValueReader kvReader = new RocksDbKeyValueReader(dbName, path, config);

  for (Object obj : tool.getKeys()) {
   Object result = kvReader.get(obj);
   tool.outputResult(obj, result);
  }

  kvReader.stop();
 }
}
org.apache.samza.storage.kvRocksDbKeyValueReaderget

Javadoc

get the value from the key. This key will be serialized to bytes using the serde defined in systems.system-name.samza.key.serde. The result will be deserialized back to the object using the serde in systems.system-name.samza.msg.serde. If the value does not exist in the db, it return null.

Popular methods of RocksDbKeyValueReader

  • <init>
    Construct the RocksDbKeyValueReader with store's name, database's path and Samza's config
  • stop
  • getSerdeFromName
    A helper method to get the Serde from the serdeName

Popular in Java

  • Updating database using SQL prepared statement
  • getResourceAsStream (ClassLoader)
  • getApplicationContext (Context)
  • putExtra (Intent)
  • FileInputStream (java.io)
    A FileInputStream obtains input bytes from a file in a file system. What files are available depends
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registery of org.quartz
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