本文整理汇总了Java中org.voltdb.TableStreamType类的典型用法代码示例。如果您正苦于以下问题:Java TableStreamType类的具体用法?Java TableStreamType怎么用?Java TableStreamType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TableStreamType类属于org.voltdb包,在下文中一共展示了TableStreamType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: activateTableStream
import org.voltdb.TableStreamType; //导入依赖的package包/类
@Override
public boolean activateTableStream(int tableId, TableStreamType streamType,
long undoQuantumToken,
byte[] predicates) {
return nativeActivateTableStream(pointer, tableId, streamType.ordinal(),
undoQuantumToken, predicates);
}
示例2: tableStreamSerializeMore
import org.voltdb.TableStreamType; //导入依赖的package包/类
@Override
public Pair<Long, int[]> tableStreamSerializeMore(int tableId,
TableStreamType streamType,
List<BBContainer> outputBuffers) {
//Clear is destructive, do it before the native call
deserializer.clear();
byte[] bytes = outputBuffers != null
? SnapshotUtil.OutputBuffersToBytes(outputBuffers)
: null;
long remaining = nativeTableStreamSerializeMore(pointer,
tableId,
streamType.ordinal(),
bytes);
int[] positions = null;
assert(deserializer != null);
int count;
try {
count = deserializer.readInt();
if (count > 0) {
positions = new int[count];
for (int i = 0; i < count; i++) {
positions[i] = deserializer.readInt();
}
return Pair.of(remaining, positions);
}
} catch (final IOException ex) {
LOG.error("Failed to deserialize position array" + ex);
throw new EEException(ERRORCODE_WRONG_SERIALIZED_BYTES);
}
return Pair.of(remaining, new int[] {0});
}
示例3: tableStreamSerializeMore
import org.voltdb.TableStreamType; //导入依赖的package包/类
@Override
public int tableStreamSerializeMore(BBContainer c, int tableId, TableStreamType streamType) {
int bytesReturned = -1;
ByteBuffer view = c.b.duplicate();
try {
m_data.clear();
m_data.putInt(Commands.TableStreamSerializeMore.m_id);
m_data.putInt(tableId);
m_data.putInt(streamType.ordinal());
m_data.putInt(c.b.remaining());
m_data.flip();
m_connection.write();
m_connection.readStatusByte();
ByteBuffer lengthBuffer = ByteBuffer.allocate(4);
while (lengthBuffer.hasRemaining()) {
int read = m_connection.m_socketChannel.read(lengthBuffer);
if (read == -1) {
throw new EOFException();
}
}
lengthBuffer.flip();
final int length = lengthBuffer.getInt();
bytesReturned = length;
/*
* Error or no more tuple data for this table.
*/
if (length == -1 || length == 0) {
return length;
}
view.limit(view.position() + length);
while (view.hasRemaining()) {
m_connection.m_socketChannel.read(view);
}
} catch (final IOException e) {
System.out.println("Exception: " + e.getMessage());
throw new RuntimeException(e);
}
return bytesReturned;
}
示例4: activateTableStream
import org.voltdb.TableStreamType; //导入依赖的package包/类
@Override
public boolean activateTableStream(int tableId, TableStreamType type) {
// TODO Auto-generated method stub
return false;
}
示例5: tableStreamSerializeMore
import org.voltdb.TableStreamType; //导入依赖的package包/类
@Override
public int tableStreamSerializeMore(BBContainer c, int tableId, TableStreamType type) {
// TODO Auto-generated method stub
return 0;
}
示例6: activateTableStream
import org.voltdb.TableStreamType; //导入依赖的package包/类
@Override
public boolean activateTableStream(int tableId, TableStreamType streamType) {
return nativeActivateTableStream( pointer, tableId, streamType.ordinal());
}
示例7: tableStreamSerializeMore
import org.voltdb.TableStreamType; //导入依赖的package包/类
@Override
public int tableStreamSerializeMore(BBContainer c, int tableId, TableStreamType streamType) {
return nativeTableStreamSerializeMore(this.pointer, c.address, c.b.position(), c.b.remaining(), tableId, streamType.ordinal());
}
示例8: testStreamTables
import org.voltdb.TableStreamType; //导入依赖的package包/类
public void testStreamTables() throws Exception {
final Catalog catalog = new Catalog();
catalog.execute(LoadCatalogToString.THE_CATALOG);
sourceEngine.loadCatalog(catalog.serialize());
ExecutionEngine destinationEngine = new ExecutionEngineJNI(null, CLUSTER_ID, NODE_ID, 0, 0, "");
destinationEngine.loadCatalog(catalog.serialize());
int WAREHOUSE_TABLEID = warehouseTableId(catalog);
int STOCK_TABLEID = stockTableId(catalog);
loadTestTables(catalog);
sourceEngine.activateTableStream( WAREHOUSE_TABLEID, TableStreamType.RECOVERY );
sourceEngine.activateTableStream( STOCK_TABLEID, TableStreamType.RECOVERY );
BBContainer origin = DBBPool.allocateDirect(1024 * 1024 * 2);
try {
origin.b.clear();
long address = org.voltdb.utils.DBBPool.getBufferAddress(origin.b);
BBContainer container = new BBContainer(origin.b, address){
@Override
public void discard() {
}};
int serialized = sourceEngine.tableStreamSerializeMore( container, WAREHOUSE_TABLEID, TableStreamType.RECOVERY);
assertTrue(serialized > 0);
container.b.limit(serialized);
destinationEngine.processRecoveryMessage( container.b, container.address);
serialized = sourceEngine.tableStreamSerializeMore( container, WAREHOUSE_TABLEID, TableStreamType.RECOVERY);
assertEquals( 21, serialized);
int id = container.b.get();
assert(id >= 0);
// assertEquals( RecoveryMessageType.Complete.ordinal(), container.b.get());
assertEquals( WAREHOUSE_TABLEID, container.b.getInt());
assertEquals( sourceEngine.tableHashCode(WAREHOUSE_TABLEID), destinationEngine.tableHashCode(WAREHOUSE_TABLEID));
container.b.clear();
serialized = sourceEngine.tableStreamSerializeMore( container, STOCK_TABLEID, TableStreamType.RECOVERY);
assertTrue(serialized > 0);
container.b.limit(serialized);
destinationEngine.processRecoveryMessage( container.b, container.address);
serialized = sourceEngine.tableStreamSerializeMore( container, STOCK_TABLEID, TableStreamType.RECOVERY);
assertEquals( 21, serialized);
id = container.b.get();
assert(id >= 0);
// assertEquals( RecoveryMessageType.Complete.ordinal(), container.b.get());
assertEquals( STOCK_TABLEID, container.b.getInt());
assertEquals( sourceEngine.tableHashCode(STOCK_TABLEID), destinationEngine.tableHashCode(STOCK_TABLEID));
} finally {
origin.discard();
}
}
示例9: tableStreamSerializeMore
import org.voltdb.TableStreamType; //导入依赖的package包/类
@Override
public Pair<Long, int[]> tableStreamSerializeMore(int tableId, TableStreamType streamType,
List<BBContainer> outputBuffers) {
try {
m_data.clear();
m_data.putInt(Commands.TableStreamSerializeMore.m_id);
m_data.putInt(tableId);
m_data.putInt(streamType.ordinal());
m_data.put(SnapshotUtil.OutputBuffersToBytes(outputBuffers));
m_data.flip();
m_connection.write();
m_connection.readStatusByte();
// Get the count.
ByteBuffer countBuffer = ByteBuffer.allocate(4);
while (countBuffer.hasRemaining()) {
int read = m_connection.m_socketChannel.read(countBuffer);
if (read == -1) {
throw new EOFException();
}
}
countBuffer.flip();
final int count = countBuffer.getInt();
assert count == outputBuffers.size();
// Get the remaining tuple count.
ByteBuffer remainingBuffer = ByteBuffer.allocate(8);
while (remainingBuffer.hasRemaining()) {
int read = m_connection.m_socketChannel.read(remainingBuffer);
if (read == -1) {
throw new EOFException();
}
}
remainingBuffer.flip();
final long remaining = remainingBuffer.getLong();
final int[] serialized = new int[count];
for (int i = 0; i < count; i++) {
ByteBuffer lengthBuffer = ByteBuffer.allocate(4);
while (lengthBuffer.hasRemaining()) {
int read = m_connection.m_socketChannel.read(lengthBuffer);
if (read == -1) {
throw new EOFException();
}
}
lengthBuffer.flip();
serialized[i] = lengthBuffer.getInt();
ByteBuffer view = outputBuffers.get(i).b().duplicate();
view.limit(view.position() + serialized[i]);
while (view.hasRemaining()) {
m_connection.m_socketChannel.read(view);
}
}
return Pair.of(remaining, serialized);
} catch (final IOException e) {
System.out.println("Exception: " + e.getMessage());
throw new RuntimeException(e);
}
}
示例10: activateTableStream
import org.voltdb.TableStreamType; //导入依赖的package包/类
@Override
public boolean activateTableStream(int tableId, TableStreamType type, long undoQuantumToken, byte[] predicates) {
return false;
}
示例11: tableStreamSerializeMore
import org.voltdb.TableStreamType; //导入依赖的package包/类
@Override
public Pair<Long, int[]> tableStreamSerializeMore(int tableId, TableStreamType type,
List<BBContainer> outputBuffers) {
return Pair.of(0l, new int[] {0});
}
示例12: activateTableStream
import org.voltdb.TableStreamType; //导入依赖的package包/类
abstract public boolean activateTableStream(final int tableId,
TableStreamType type,
long undoQuantumToken,
byte[] predicates);
示例13: activateTableStream
import org.voltdb.TableStreamType; //导入依赖的package包/类
@Override
public boolean activateTableStream(final int tableId, TableStreamType type, boolean undo, byte[] predicates)
{
return m_ee.activateTableStream(tableId, type, undo ? getNextUndoToken(m_currentTxnId) : Long.MAX_VALUE, predicates);
}
示例14: tableStreamSerializeMore
import org.voltdb.TableStreamType; //导入依赖的package包/类
@Override
public Pair<Long, int[]> tableStreamSerializeMore(int tableId, TableStreamType type,
List<DBBPool.BBContainer> outputBuffers)
{
return m_ee.tableStreamSerializeMore(tableId, type, outputBuffers);
}
示例15: activateTableStream
import org.voltdb.TableStreamType; //导入依赖的package包/类
@Override
public boolean activateTableStream(int tableId, TableStreamType type, boolean undo, byte[] predicates)
{
throw new RuntimeException("RO MP Site doesn't do this, shouldn't be here.");
}