com.datasift.dropwizard.hbase.HBaseClient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dropwizard-extra-hbase Show documentation
Show all versions of dropwizard-extra-hbase Show documentation
Dropwizard integration for working with HBase in Scala.
package com.datasift.dropwizard.hbase;
import com.datasift.dropwizard.hbase.scanner.RowScanner;
import com.stumbleupon.async.Deferred;
import com.yammer.dropwizard.util.Duration;
import com.yammer.dropwizard.util.Size;
import org.hbase.async.*;
import org.jboss.netty.util.Timer;
import java.util.ArrayList;
/**
* Client for interacting with an HBase cluster.
*
* To create an instance, use {@link HBaseClientFactory}.
*
* All implementations are wrapper proxies around {@link org.hbase.async.HBaseClient} providing
* additional functionality.
*
* @see HBaseClientFactory
* @see org.hbase.async.HBaseClient
*/
public interface HBaseClient {
/**
* Get the maximum time for which edits may be buffered before being flushed.
*
* @return the maximum time for which edits may be buffered.
*
* @see org.hbase.async.HBaseClient#getFlushInterval()
*/
public Duration getFlushInterval();
/**
* Get the capacity of the increment buffer.
*
* @return the capacity of the increment buffer.
*
* @see org.hbase.async.HBaseClient#getIncrementBufferSize()
*/
public Size getIncrementBufferSize();
/**
* Sets the maximum time for which edits may be buffered before being flushed.
*
* @param flushInterval the maximum time for which edits may be buffered.
*
* @return the previous flush interval.
*
* @see org.hbase.async.HBaseClient#setFlushInterval(short)
*/
public Duration setFlushInterval(Duration flushInterval);
/**
* Sets the capacity of the increment buffer.
*
* @param incrementBufferSize the capacity of the increment buffer.
*
* @return the previous increment buffer capacity.
*
* @see org.hbase.async.HBaseClient#setIncrementBufferSize(int)
*/
public Size setIncrementBufferSize(Size incrementBufferSize);
/**
* Atomically creates a cell if, and only if, it doesn't already exist.
*
* @param edit the new cell to create.
*
* @return true if the cell was created, false if the cell already exists.
*
* @see org.hbase.async.HBaseClient#atomicCreate(org.hbase.async.PutRequest)
*/
public Deferred create(PutRequest edit);
/**
* Buffer a durable increment for coalescing.
*
* @param request the increment to buffer
*
* @return the new value of the cell, after the increment.
*
* @see org.hbase.async.HBaseClient#bufferAtomicIncrement(org.hbase.async.AtomicIncrementRequest)
*/
public Deferred bufferIncrement(AtomicIncrementRequest request);
/**
* Atomically and durably increment a cell value.
*
* @param request the increment to make.
*
* @return the new value of the cell, after the increment.
*
* @see org.hbase.async.HBaseClient#atomicIncrement(org.hbase.async.AtomicIncrementRequest)
*/
public Deferred increment(AtomicIncrementRequest request);
/**
* Atomically increment a cell value, with optional durability.
*
* @param request the increment to make.
* @param durable whether to guarantee this increment succeeded durably.
*
* @return the new value of the cell, after the increment.
*
* @see org.hbase.async.HBaseClient#atomicIncrement(org.hbase.async.AtomicIncrementRequest, boolean)
*/
public Deferred increment(AtomicIncrementRequest request, Boolean durable);
/**
* Atomically compares and sets (CAS) a single cell
*
* @param edit the cell to set.
* @param expected the expected current value.
*
* @return true if the expectation was met and the cell was set, otherwise, false.
*
* @see org.hbase.async.HBaseClient#compareAndSet(org.hbase.async.PutRequest, byte[])
*/
public Deferred compareAndSet(PutRequest edit, byte[] expected);
/**
* Atomically compares and sets (CAS) a single cell.
*
* @param edit the cell to set.
* @param expected the expected current value.
*
* @return true if the expectation was met and the cell was set, otherwise, false.
*
* @see org.hbase.async.HBaseClient#compareAndSet(org.hbase.async.PutRequest, String)
*/
public Deferred compareAndSet(PutRequest edit, String expected);
/**
* Deletes the specified cells
*
* @param request the cell(s) to delete.
*
* @return a {@link Deferred} indicating when the deletion completes.
*
* @see org.hbase.async.HBaseClient#delete(org.hbase.async.DeleteRequest)
*/
public Deferred