Tabnine Logo
ThriftUtilities
Code IndexAdd Tabnine to your IDE (free)

How to use
ThriftUtilities
in
org.apache.hadoop.hbase.thrift2

Best Java code snippets using org.apache.hadoop.hbase.thrift2.ThriftUtilities (Showing top 20 results out of 315)

origin: apache/hbase

Get get = getFromThrift(tGet);
assertArrayEquals(get.getAttribute("attribute1"), attributeValue);
TPut tPut = new TPut(wrap(rowName) , columnValues);
tPut.setAttributes(attributes);
Put put = putFromThrift(tPut);
assertArrayEquals(put.getAttribute("attribute1"), attributeValue);
Scan scan = scanFromThrift(tScan);
assertArrayEquals(scan.getAttribute("attribute1"), attributeValue);
TIncrement tIncrement = new TIncrement(wrap(rowName), incrementColumns);
tIncrement.setAttributes(attributes);
Increment increment = incrementFromThrift(tIncrement);
assertArrayEquals(increment.getAttribute("attribute1"), attributeValue);
Delete delete = deleteFromThrift(tDelete);
assertArrayEquals(delete.getAttribute("attribute1"), attributeValue);
origin: apache/hbase

@Override
public List<TDelete> deleteMultiple(ByteBuffer table, List<TDelete> deletes) throws TIOError,
  TException {
 checkReadOnlyMode();
 Table htable = getTable(table);
 try {
  htable.delete(deletesFromThrift(deletes));
 } catch (IOException e) {
  throw getTIOError(e);
 } finally {
  closeTable(htable);
 }
 return Collections.emptyList();
}

origin: apache/hbase

@Override
public List<TResult> getMultiple(ByteBuffer table, List<TGet> gets) throws TIOError, TException {
 Table htable = getTable(table);
 try {
  return resultsFromHBase(htable.get(getsFromThrift(gets)));
 } catch (IOException e) {
  throw getTIOError(e);
 } finally {
  closeTable(htable);
 }
}
origin: apache/hbase

@Override
public TResult get(ByteBuffer table, TGet get) throws TIOError, TException {
 Table htable = getTable(table);
 try {
  return resultFromHBase(htable.get(getFromThrift(get)));
 } catch (IOException e) {
  throw getTIOError(e);
 } finally {
  closeTable(htable);
 }
}
origin: apache/hbase

@Override
public TResult increment(ByteBuffer table, TIncrement increment) throws TIOError, TException {
 checkReadOnlyMode();
 Table htable = getTable(table);
 try {
  return resultFromHBase(htable.increment(incrementFromThrift(increment)));
 } catch (IOException e) {
  throw getTIOError(e);
 } finally {
  closeTable(htable);
 }
}
origin: apache/hbase

Delete delete = deleteFromThrift(tDelete);
assertEquals(Durability.SKIP_WAL, delete.getDurability());
delete = deleteFromThrift(tDelete);
assertEquals(Durability.ASYNC_WAL, delete.getDurability());
delete = deleteFromThrift(tDelete);
assertEquals(Durability.SYNC_WAL, delete.getDurability());
delete = deleteFromThrift(tDelete);
assertEquals(Durability.FSYNC_WAL, delete.getDurability());
Put put = putFromThrift(tPut);
assertEquals(Durability.SKIP_WAL, put.getDurability());
put = putFromThrift(tPut);
assertEquals(Durability.ASYNC_WAL, put.getDurability());
put = putFromThrift(tPut);
assertEquals(Durability.SYNC_WAL, put.getDurability());
put = putFromThrift(tPut);
assertEquals(Durability.FSYNC_WAL, put.getDurability());
Increment increment = incrementFromThrift(tIncrement);
assertEquals(Durability.SKIP_WAL, increment.getDurability());
increment = incrementFromThrift(tIncrement);
assertEquals(Durability.ASYNC_WAL, increment.getDurability());
origin: apache/hbase

/**
 * Converts multiple {@link TPut}s (Thrift) into a list of {@link Put}s (HBase).
 *
 * @param in list of <code>TPut</code>s to convert
 *
 * @return list of converted <code>Put</code>s
 *
 * @see #putFromThrift(TPut)
 */
public static List<Put> putsFromThrift(List<TPut> in) {
 List<Put> out = new ArrayList<>(in.size());
 for (TPut put : in) {
  out.add(putFromThrift(put));
 }
 return out;
}
origin: apache/hbase

/**
 * Converts multiple {@link TDelete}s (Thrift) into a list of {@link Delete}s (HBase).
 *
 * @param in list of <code>TDelete</code>s to convert
 *
 * @return list of converted <code>Delete</code>s
 *
 * @see #deleteFromThrift(TDelete)
 */
public static List<Delete> deletesFromThrift(List<TDelete> in) {
 List<Delete> out = new ArrayList<>(in.size());
 for (TDelete delete : in) {
  out.add(deleteFromThrift(delete));
 }
 return out;
}
origin: apache/hbase

/**
 * Creates a {@link RowMutations} (HBase) from a {@link TRowMutations} (Thrift)
 *
 * @param in the <code>TRowMutations</code> to convert
 *
 * @return converted <code>RowMutations</code>
 */
public static RowMutations rowMutationsFromThrift(TRowMutations in) throws IOException {
 List<TMutation> mutations = in.getMutations();
 RowMutations out = new RowMutations(in.getRow(), mutations.size());
 for (TMutation mutation : mutations) {
  if (mutation.isSetPut()) {
   out.add(putFromThrift(mutation.getPut()));
  }
  if (mutation.isSetDeleteSingle()) {
   out.add(deleteFromThrift(mutation.getDeleteSingle()));
  }
 }
 return out;
}
origin: apache/hbase

/**
 * Converts multiple {@link TGet}s (Thrift) into a list of {@link Get}s (HBase).
 *
 * @param in list of <code>TGet</code>s to convert
 *
 * @return list of <code>Get</code> objects
 *
 * @throws IOException if an invalid time range or max version parameter is given
 * @see #getFromThrift(TGet)
 */
public static List<Get> getsFromThrift(List<TGet> in) throws IOException {
 List<Get> out = new ArrayList<>(in.size());
 for (TGet get : in) {
  out.add(getFromThrift(get));
 }
 return out;
}
origin: apache/hbase

@Test
public void testConsistency() throws Exception {
 byte[] rowName = Bytes.toBytes("testConsistency");
 TGet tGet = new TGet(wrap(rowName));
 tGet.setConsistency(TConsistency.STRONG);
 Get get = getFromThrift(tGet);
 assertEquals(Consistency.STRONG, get.getConsistency());
 tGet.setConsistency(TConsistency.TIMELINE);
 tGet.setTargetReplicaId(1);
 get = getFromThrift(tGet);
 assertEquals(Consistency.TIMELINE, get.getConsistency());
 assertEquals(1, get.getReplicaId());
 TScan tScan = new TScan();
 tScan.setConsistency(TConsistency.STRONG);
 Scan scan = scanFromThrift(tScan);
 assertEquals(Consistency.STRONG, scan.getConsistency());
 tScan.setConsistency(TConsistency.TIMELINE);
 tScan.setTargetReplicaId(1);
 scan = scanFromThrift(tScan);
 assertEquals(Consistency.TIMELINE, scan.getConsistency());
 assertEquals(1, scan.getReplicaId());
 TResult tResult = new TResult();
 assertFalse(tResult.isSetStale());
 tResult.setStale(true);
 assertTrue(tResult.isSetStale());
}
origin: apache/hbase

@Override
public List<TResult> getScannerResults(ByteBuffer table, TScan scan, int numRows)
  throws TIOError, TException {
 Table htable = getTable(table);
 List<TResult> results = null;
 ResultScanner scanner = null;
 try {
  scanner = htable.getScanner(scanFromThrift(scan));
  results = resultsFromHBase(scanner.next(numRows));
 } catch (IOException e) {
  throw getTIOError(e);
 } finally {
  if (scanner != null) {
   scanner.close();
  }
  closeTable(htable);
 }
 return results;
}
origin: apache/hbase

@Override
public int openScanner(ByteBuffer table, TScan scan) throws TIOError, TException {
 Table htable = getTable(table);
 ResultScanner resultScanner = null;
 try {
  resultScanner = htable.getScanner(scanFromThrift(scan));
 } catch (IOException e) {
  throw getTIOError(e);
 } finally {
  closeTable(htable);
 }
 return addScanner(resultScanner);
}
origin: apache/hbase

@Override
public TResult append(ByteBuffer table, TAppend append) throws TIOError, TException {
 checkReadOnlyMode();
 Table htable = getTable(table);
 try {
  return resultFromHBase(htable.append(appendFromThrift(append)));
 } catch (IOException e) {
  throw getTIOError(e);
 } finally {
  closeTable(htable);
 }
}
origin: apache/hbase

@Override
public void putMultiple(ByteBuffer table, List<TPut> puts) throws TIOError, TException {
 checkReadOnlyMode();
 Table htable = getTable(table);
 try {
  htable.put(putsFromThrift(puts));
 } catch (IOException e) {
  throw getTIOError(e);
 } finally {
  closeTable(htable);
 }
}
origin: apache/hbase

/**
 * Converts multiple {@link Result}s (HBase) into a list of {@link TResult}s (Thrift).
 *
 * @param in array of <code>Result</code>s to convert
 *
 * @return list of converted <code>TResult</code>s
 *
 * @see #resultFromHBase(Result)
 */
public static List<TResult> resultsFromHBase(Result[] in) {
 List<TResult> out = new ArrayList<>(in.length);
 for (Result result : in) {
  out.add(resultFromHBase(result));
 }
 return out;
}
origin: apache/hbase

@Override
public List<TResult> getScannerRows(int scannerId, int numRows) throws TIOError,
  TIllegalArgument, TException {
 ResultScanner scanner = getScanner(scannerId);
 if (scanner == null) {
  TIllegalArgument ex = new TIllegalArgument();
  ex.setMessage("Invalid scanner Id");
  throw ex;
 }
 try {
  connectionCache.updateConnectionAccessTime();
  return resultsFromHBase(scanner.next(numRows));
 } catch (IOException e) {
  throw getTIOError(e);
 }
}
origin: apache/hbase

@Override
public List<Boolean> existsAll(ByteBuffer table, List<TGet> gets) throws TIOError, TException {
 Table htable = getTable(table);
 try {
  boolean[] exists = htable.existsAll(getsFromThrift(gets));
  List<Boolean> result = new ArrayList<>(exists.length);
  for (boolean exist : exists) {
   result.add(exist);
  }
  return result;
 } catch (IOException e) {
  throw getTIOError(e);
 } finally {
  closeTable(htable);
 }
}
origin: co.cask.hbase/hbase

@Override
public List<TDelete> deleteMultiple(ByteBuffer table, List<TDelete> deletes) throws TIOError, TException {
 HTableInterface htable = getTable(table.array());
 List<Delete> tempDeletes = deletesFromThrift(deletes);
 try {
  htable.delete(tempDeletes);
 } catch (IOException e) {
  throw getTIOError(e);
 } finally {
  closeTable(htable);
 }
 return deletesFromHBase(tempDeletes);
}
origin: org.apache.hbase/hbase-thrift

Delete delete = deleteFromThrift(tDelete);
assertEquals(Durability.SKIP_WAL, delete.getDurability());
delete = deleteFromThrift(tDelete);
assertEquals(Durability.ASYNC_WAL, delete.getDurability());
delete = deleteFromThrift(tDelete);
assertEquals(Durability.SYNC_WAL, delete.getDurability());
delete = deleteFromThrift(tDelete);
assertEquals(Durability.FSYNC_WAL, delete.getDurability());
Put put = putFromThrift(tPut);
assertEquals(Durability.SKIP_WAL, put.getDurability());
put = putFromThrift(tPut);
assertEquals(Durability.ASYNC_WAL, put.getDurability());
put = putFromThrift(tPut);
assertEquals(Durability.SYNC_WAL, put.getDurability());
put = putFromThrift(tPut);
assertEquals(Durability.FSYNC_WAL, put.getDurability());
Increment increment = incrementFromThrift(tIncrement);
assertEquals(Durability.SKIP_WAL, increment.getDurability());
increment = incrementFromThrift(tIncrement);
assertEquals(Durability.ASYNC_WAL, increment.getDurability());
org.apache.hadoop.hbase.thrift2ThriftUtilities

Most used methods

  • deleteFromThrift
    Creates a Delete (HBase) from a TDelete (Thrift).
  • getFromThrift
    Creates a Get (HBase) from a TGet (Thrift). This ignores any timestamps set on TColumn objects.
  • incrementFromThrift
  • putFromThrift
    Creates a Put (HBase) from a TPut (Thrift)
  • scanFromThrift
  • deletesFromThrift
    Converts multiple TDeletes (Thrift) into a list of Deletes (HBase).
  • getsFromThrift
    Converts multiple TGets (Thrift) into a list of Gets (HBase).
  • putsFromThrift
    Converts multiple TPuts (Thrift) into a list of Puts (HBase).
  • resultFromHBase
    Creates a TResult (Thrift) from a Result (HBase).
  • resultsFromHBase
    Converts multiple Results (HBase) into a list of TResults (Thrift).
  • addAttributes
    Adds all the attributes into the Operation object
  • appendFromThrift
  • addAttributes,
  • appendFromThrift,
  • compareOpFromThrift,
  • deleteFromHBase,
  • deletesFromHBase,
  • durabilityFromThrift,
  • readTypeFromThrift,
  • regionLocationFromHBase,
  • regionLocationsFromHBase,
  • rowMutationsFromThrift

Popular in Java

  • Finding current android device location
  • onRequestPermissionsResult (Fragment)
  • setContentView (Activity)
  • getSharedPreferences (Context)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Menu (java.awt)
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • Reference (javax.naming)
  • JTextField (javax.swing)
  • Top Vim 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