本文整理汇总了Java中com.yahoo.ycsb.ByteArrayByteIterator类的典型用法代码示例。如果您正苦于以下问题:Java ByteArrayByteIterator类的具体用法?Java ByteArrayByteIterator怎么用?Java ByteArrayByteIterator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ByteArrayByteIterator类属于com.yahoo.ycsb包,在下文中一共展示了ByteArrayByteIterator类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: deserialize
import com.yahoo.ycsb.ByteArrayByteIterator; //导入依赖的package包/类
@Override
public Map<String,ByteIterator> deserialize(ByteBuffer buf) {
Map<String,ByteIterator> map;
buf = buf.asReadOnlyBuffer();
if (debug) {
System.out.println("\n\ndeserialize **** "+ buf);
}
map = new HashMap<>();
while (buf.hasRemaining()) {
if (debug) {
System.out.println("\n"+ buf);
}
map.put(new String(readArray(buf)), new ByteArrayByteIterator(readArray(buf)));
}
return map;
}
开发者ID:Morgan-Stanley,项目名称:SilverKing,代码行数:18,代码来源:RecordSerDes.java
示例2: unpackRowData
import com.yahoo.ycsb.ByteArrayByteIterator; //导入依赖的package包/类
private HashMap<String, ByteIterator> unpackRowData(byte[] rowData, ByteBuffer buf, int nFields, Set<String> fields, HashMap<String, ByteIterator> result)
{
for (int i = 0; i < nFields; i++)
{
int len = buf.getInt();
int off = buf.position();
String key = new String(rowData, off, len, UTF8);
buf.position(off + len);
len = buf.getInt();
off = buf.position();
if (fields == null || fields.contains(key))
{
result.put(key, new ByteArrayByteIterator(rowData, off, len));
}
buf.position(off + len);
}
return result;
}
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:19,代码来源:VoltClient4.java
示例3: populateByteResult
import com.yahoo.ycsb.ByteArrayByteIterator; //导入依赖的package包/类
protected void populateByteResult(final Map document, final Set<String> fields,
final HashMap<String, ByteIterator> result) {
// fill results
if (fields == null) {
for (Map.Entry<String, byte[]> entry: (Set<Map.Entry<String, byte[]>>) document.entrySet()) {
result.put(entry.getKey(), new ByteArrayByteIterator(entry.getValue()));
}
} else {
for (String field: fields) {
byte[] value = (byte[]) document.get(field);
if (value != null) {
result.put(field, new ByteArrayByteIterator(value));
}
}
}
}
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:17,代码来源:BagriClientBase.java
示例4: scan
import com.yahoo.ycsb.ByteArrayByteIterator; //导入依赖的package包/类
@Override
public int scan(String table, String startkey, int limit, Set<String> fields, Vector<HashMap<String, ByteIterator>> result) {
KeyRange range = KeyRange.closed(new Key(startkey)).open(Key.INF);
RangeResponse resp = client.rangeRequest(table, range, Limit.toItems(limit));
if (resp.code != ResponseCode.SUCCESS) {
return 2;
}
if (resp.results == null || resp.results.isEmpty()) {
return 1;
}
for (Entry<Key, byte[]> e : resp.results.entrySet()) {
String key = new String(e.getKey().getArray());
HashMap<String, ByteIterator> r = new HashMap<String, ByteIterator>();
r.put(key, new ByteArrayByteIterator(e.getValue()));
result.add(r);
}
return 0;
}
开发者ID:CaracalDB,项目名称:CaracalDB,代码行数:21,代码来源:CaracalDB.java
示例5: read
import com.yahoo.ycsb.ByteArrayByteIterator; //导入依赖的package包/类
@Override
public int read(String table, String key, Set<String> fields,
HashMap<String, ByteIterator> result) {
Region<String, Map<String, byte[]>> r = getRegion(table);
Map<String, byte[]> val = r.get(key);
if (val != null) {
if (fields == null) {
for (String k : val.keySet()) {
result.put(key, new ByteArrayByteIterator(val.get(key)));
}
} else {
for (String field : fields) {
result.put(field, new ByteArrayByteIterator(val.get(field)));
}
}
return SUCCESS;
}
return ERROR;
}
开发者ID:pbailis,项目名称:hat-vldb2014-code,代码行数:20,代码来源:GemFireClient.java
示例6: read
import com.yahoo.ycsb.ByteArrayByteIterator; //导入依赖的package包/类
@Override
public int read(String table, String key, Set<String> fields, HashMap<String, ByteIterator> result) {
Key kvKey = createKey(table, key);
SortedMap<Key, ValueVersion> kvResult;
try {
kvResult = store.multiGet(kvKey, null, null);
} catch (FaultException e) {
System.err.println(e);
return ERROR;
}
for (Map.Entry<Key, ValueVersion> entry : kvResult.entrySet()) {
/* If fields is null, read all fields */
String field = getFieldFromKey(entry.getKey());
if (fields != null && !fields.contains(field)) {
continue;
}
result.put(field, new ByteArrayByteIterator(entry.getValue().getValue().getValue()));
}
return OK;
}
开发者ID:pbailis,项目名称:hat-vldb2014-code,代码行数:23,代码来源:NoSqlDbClient.java
示例7: read
import com.yahoo.ycsb.ByteArrayByteIterator; //导入依赖的package包/类
@Override
public int read(String table, String key, Set<String> fields, HashMap<String, ByteIterator> result) {
Key k = new Key(key);
GetResponse resp = client.get(table, k);
if (resp.code != ResponseCode.SUCCESS) {
return 2;
}
if (resp.data == null) {
return 1;
}
result.put(key, new ByteArrayByteIterator(resp.data));
return 0;
}
开发者ID:CaracalDB,项目名称:CaracalDB,代码行数:14,代码来源:CaracalDB.java
示例8: fillMap
import com.yahoo.ycsb.ByteArrayByteIterator; //导入依赖的package包/类
/**
* Fills the map with the ByteIterators from the document.
*
* @param result
* The map to fill.
* @param queryResult
* The document to fill from.
*/
protected final void fillMap(final HashMap<String, ByteIterator> result,
final Document queryResult) {
for (final Element be : queryResult) {
if (be instanceof BinaryElement) {
result.put(be.getName(), new ByteArrayByteIterator(
((BinaryElement) be).getValue()));
}
}
}
开发者ID:allanbank,项目名称:mongodb-async-driver,代码行数:18,代码来源:AsyncMongoDbClient.java
示例9: read
import com.yahoo.ycsb.ByteArrayByteIterator; //导入依赖的package包/类
@Override
public int read(String table, String key, Set<String> fields,
HashMap<String, ByteIterator> result) {
try {
ByteBuffer ret = client.get(key);
if(ret == null || ret.array() == null) {
if(fields != null)
result.put(fields.iterator().next(), new ByteArrayByteIterator("null".getBytes()));
else
result.put("value", new ByteArrayByteIterator("null".getBytes()));
return OK;
}
if(fields != null)
result.put(fields.iterator().next(), new ByteArrayByteIterator(ret.array()));
else
result.put("value", new ByteArrayByteIterator(ret.array()));
} catch (Exception e) {
logger.warn("Error on read:", e);
// e.printStackTrace();
return ERROR;
}
return OK;
}
开发者ID:pbailis,项目名称:hat-vldb2014-code,代码行数:30,代码来源:ThebesYCSBClient.java
注:本文中的com.yahoo.ycsb.ByteArrayByteIterator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论