热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

com.thinkaurelius.titan.diskstorage.keycolumnvalue.KCVSUtil.get()方法的使用及代码示例

本文整理了Java中com.thinkaurelius.titan.diskstorage.keycolumnvalue.KCVSUtil.get()方法的一些代码示例

本文整理了Java中com.thinkaurelius.titan.diskstorage.keycolumnvalue.KCVSUtil.get()方法的一些代码示例,展示了KCVSUtil.get()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。KCVSUtil.get()方法的具体详情如下:
包路径:com.thinkaurelius.titan.diskstorage.keycolumnvalue.KCVSUtil
类名称:KCVSUtil
方法名:get

KCVSUtil.get介绍

[英]Retrieves the value for the specified column and key under the given transaction from the store if such exists, otherwise returns NULL
[中]从存储中检索给定事务下指定列和键的值(如果存在),否则返回NULL

代码示例

代码示例来源:origin: thinkaurelius/titan

/**
* Returns true if the specified key-column pair exists in the store.
*
* @param store Store
* @param key Key
* @param column Column
* @param txh Transaction
* @return TRUE, if key has at least one column-value pair, else FALSE
*/
public static boolean containsKeyColumn(KeyColumnValueStore store, StaticBuffer key, StaticBuffer column, StoreTransaction txh) throws BackendException {
return get(store, key, column, txh) != null;
}

代码示例来源:origin: thinkaurelius/titan

public int checkThatStateExistsInStore(Map> state, KeyColumnValueStore store, int round) throws BackendException {
int checked = 0;
for (StaticBuffer key : state.keySet()) {
for (StaticBuffer col : state.get(key).keySet()) {
StaticBuffer val = state.get(key).get(col);
Assert.assertEquals(val, KCVSUtil.get(store, key, col, tx));
checked++;
}
}
log.debug("Checked existence of {} key-column-value triples on round {}", checked, round);
return checked;
}

代码示例来源:origin: thinkaurelius/titan

public static String get(KeyColumnValueStore store, StoreTransaction txn, long key, String col) throws BackendException {
StaticBuffer k = longToByteBuffer(key);
StaticBuffer c = stringToByteBuffer(col);
StaticBuffer valBytes = KCVSUtil.get(store, k, c, txn);
if (null == valBytes)
return null;
return byteBufferToString(valBytes);
}

代码示例来源:origin: thinkaurelius/titan

private void tryWrites(KeyColumnValueStore store1, KeyColumnValueStoreManager checkmgr,
StoreTransaction tx1, KeyColumnValueStore store2,
StoreTransaction tx2) throws BackendException {
Assert.assertNull(KCVSUtil.get(store1, k, c1, tx1));
Assert.assertNull(KCVSUtil.get(store2, k, c2, tx2));
store1.acquireLock(k, c1, null, tx1);
store2.acquireLock(k, c2, null, tx2);
store1.mutate(k, Arrays.asList(StaticArrayEntry.of(c1, v1)), NO_DELETIONS, tx1);
store2.mutate(k, Arrays.asList(StaticArrayEntry.of(c2, v2)), NO_DELETIONS, tx2);
tx1.commit();
if (tx2 != tx1)
tx2.commit();
StoreTransaction checktx = newTransaction(checkmgr);
Assert.assertEquals(v1, KCVSUtil.get(store1, k, c1, checktx));
Assert.assertEquals(v2, KCVSUtil.get(store2, k, c2, checktx));
checktx.commit();
}

代码示例来源:origin: thinkaurelius/titan

public int checkThatDeletionsApplied(Map changes, KeyColumnValueStore store, int round) throws BackendException {
int checked = 0;
int skipped = 0;
for (StaticBuffer key : changes.keySet()) {
KCVEntryMutation m = changes.get(key);
if (!m.hasDeletions())
continue;
List deletiOns= m.getDeletions();
List additiOns= m.getAdditions();
for (Entry entry : deletions) {
StaticBuffer col = entry.getColumn();
if (null != additions && additions.contains(StaticArrayEntry.of(col, col))) {
skipped++;
continue;
}
Assert.assertNull(KCVSUtil.get(store, key, col, tx));
checked++;
}
}
log.debug("Checked absence of {} key-column-value deletions on round {} (skipped {})", new Object[]{checked, round, skipped});
return checked;
}

代码示例来源:origin: thinkaurelius/titan

public void checkValues(String[][] values, Set removed) throws BackendException {
for (int i = 0; i for (int j = 0; j StaticBuffer result = KCVSUtil.get(store, KeyValueStoreUtil.getBuffer(i), KeyValueStoreUtil.getBuffer(j), tx);
if (removed.contains(new KeyColumn(i, j))) {
Assert.assertNull(result);
} else {
Assert.assertEquals(values[i][j], KeyValueStoreUtil.getString(result));
}
}
}
}

代码示例来源:origin: thinkaurelius/titan

@Test
public void singleLockAndUnlock() throws BackendException {
store[0].acquireLock(k, c1, null, tx[0][0]);
store[0].mutate(k, Arrays.asList(StaticArrayEntry.of(c1, v1)), NO_DELETIONS, tx[0][0]);
tx[0][0].commit();
tx[0][0] = newTransaction(manager[0]);
Assert.assertEquals(v1, KCVSUtil.get(store[0], k, c1, tx[0][0]));
}

代码示例来源:origin: thinkaurelius/titan

Assert.assertNull(KCVSUtil.get(store1, b1, b1, tx));
newTx();
StaticBuffer result = KCVSUtil.get(store1, b1, b1, tx);
StaticBuffer n = KCVSUtil.get(store1, b1, b1, tx);
Assert.assertNull(n);
store1.mutateEntries(b1, additions, KCVSCache.NO_DELETIONS, tx);
store1.mutateEntries(b1, NO_ADDITIONS, deletions, tx);
newTx();
n = KCVSUtil.get(store1, b1, b1, tx);
Assert.assertNull(n);
store1.mutateEntries(b1, additions, KCVSCache.NO_DELETIONS, tx);
newTx();
Assert.assertEquals(b1, KCVSUtil.get(store1, b1, b1, tx));
store1.mutateEntries(b1, additions, deletions, tx);
newTx();
Assert.assertEquals(b1, KCVSUtil.get(store1, b1, b1, tx));

代码示例来源:origin: thinkaurelius/titan

@Test
public void transactionMayReenterLock() throws BackendException {
store[0].acquireLock(k, c1, null, tx[0][0]);
store[0].acquireLock(k, c1, null, tx[0][0]);
store[0].acquireLock(k, c1, null, tx[0][0]);
store[0].mutate(k, Arrays.asList(StaticArrayEntry.of(c1, v1)), NO_DELETIONS, tx[0][0]);
tx[0][0].commit();
tx[0][0] = newTransaction(manager[0]);
Assert.assertEquals(v1, KCVSUtil.get(store[0], k, c1, tx[0][0]));
}

代码示例来源:origin: thinkaurelius/titan

Assert.assertEquals(v1, KCVSUtil.get(store[0], k, c1, tx[0][0]));

代码示例来源:origin: org.hawkular.titan/titan-core

/**
* Returns true if the specified key-column pair exists in the store.
*
* @param store Store
* @param key Key
* @param column Column
* @param txh Transaction
* @return TRUE, if key has at least one column-value pair, else FALSE
*/
public static boolean containsKeyColumn(KeyColumnValueStore store, StaticBuffer key, StaticBuffer column, StoreTransaction txh) throws BackendException {
return get(store, key, column, txh) != null;
}

代码示例来源:origin: com.thinkaurelius.titan/titan-core

/**
* Returns true if the specified key-column pair exists in the store.
*
* @param store Store
* @param key Key
* @param column Column
* @param txh Transaction
* @return TRUE, if key has at least one column-value pair, else FALSE
*/
public static boolean containsKeyColumn(KeyColumnValueStore store, StaticBuffer key, StaticBuffer column, StoreTransaction txh) throws BackendException {
return get(store, key, column, txh) != null;
}

代码示例来源:origin: com.thinkaurelius.titan/titan-test-jre6

public int checkThatStateExistsInStore(Map> state, KeyColumnValueStore store, int round) throws StorageException {
int checked = 0;
for (StaticBuffer key : state.keySet()) {
for (StaticBuffer col : state.get(key).keySet()) {
StaticBuffer val = state.get(key).get(col);
Assert.assertEquals(val, KCVSUtil.get(store, key, col, tx));
checked++;
}
}
log.debug("Checked existence of {} key-column-value triples on round {}", checked, round);
return checked;
}

代码示例来源:origin: org.hawkular.titan/titan-test

public int checkThatStateExistsInStore(Map> state, KeyColumnValueStore store, int round) throws BackendException {
int checked = 0;
for (StaticBuffer key : state.keySet()) {
for (StaticBuffer col : state.get(key).keySet()) {
StaticBuffer val = state.get(key).get(col);
Assert.assertEquals(val, KCVSUtil.get(store, key, col, tx));
checked++;
}
}
log.debug("Checked existence of {} key-column-value triples on round {}", checked, round);
return checked;
}

代码示例来源:origin: org.hawkular.titan/titan-test

public static String get(KeyColumnValueStore store, StoreTransaction txn, long key, String col) throws BackendException {
StaticBuffer k = longToByteBuffer(key);
StaticBuffer c = stringToByteBuffer(col);
StaticBuffer valBytes = KCVSUtil.get(store, k, c, txn);
if (null == valBytes)
return null;
return byteBufferToString(valBytes);
}

代码示例来源:origin: org.hawkular.titan/titan-test

public void checkValues(String[][] values, Set removed) throws BackendException {
for (int i = 0; i for (int j = 0; j StaticBuffer result = KCVSUtil.get(store, KeyValueStoreUtil.getBuffer(i), KeyValueStoreUtil.getBuffer(j), tx);
if (removed.contains(new KeyColumn(i, j))) {
Assert.assertNull(result);
} else {
Assert.assertEquals(values[i][j], KeyValueStoreUtil.getString(result));
}
}
}
}

代码示例来源:origin: com.thinkaurelius.titan/titan-test-jre6

public void checkValues(String[][] values, Set removed) throws StorageException {
for (int i = 0; i for (int j = 0; j StaticBuffer result = KCVSUtil.get(store, KeyValueStoreUtil.getBuffer(i), KeyValueStoreUtil.getBuffer(j), tx);
if (removed.contains(new KeyColumn(i, j))) {
Assert.assertNull(result);
} else {
Assert.assertEquals(values[i][j], KeyValueStoreUtil.getString(result));
}
}
}
}

代码示例来源:origin: org.hawkular.titan/titan-test

@Test
public void singleLockAndUnlock() throws BackendException {
store[0].acquireLock(k, c1, null, tx[0][0]);
store[0].mutate(k, Arrays.asList(StaticArrayEntry.of(c1, v1)), NO_DELETIONS, tx[0][0]);
tx[0][0].commit();
tx[0][0] = newTransaction(manager[0]);
Assert.assertEquals(v1, KCVSUtil.get(store[0], k, c1, tx[0][0]));
}

代码示例来源:origin: org.hawkular.titan/titan-test

@Test
public void transactionMayReenterLock() throws BackendException {
store[0].acquireLock(k, c1, null, tx[0][0]);
store[0].acquireLock(k, c1, null, tx[0][0]);
store[0].acquireLock(k, c1, null, tx[0][0]);
store[0].mutate(k, Arrays.asList(StaticArrayEntry.of(c1, v1)), NO_DELETIONS, tx[0][0]);
tx[0][0].commit();
tx[0][0] = newTransaction(manager[0]);
Assert.assertEquals(v1, KCVSUtil.get(store[0], k, c1, tx[0][0]));
}

代码示例来源:origin: com.thinkaurelius.titan/titan-test-jre6

@Test
public void transactionMayReenterLock() throws StorageException {
store[0].acquireLock(k, c1, null, tx[0][0]);
store[0].acquireLock(k, c1, null, tx[0][0]);
store[0].acquireLock(k, c1, null, tx[0][0]);
store[0].mutate(k, Arrays.asList(new StaticBufferEntry(c1, v1)), NO_DELETIONS, tx[0][0]);
tx[0][0].commit();
tx[0][0] = newTransaction(manager[0]);
Assert.assertEquals(v1, KCVSUtil.get(store[0], k, c1, tx[0][0]));
}

推荐阅读
author-avatar
mobiledu2502927147
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有