本文整理汇总了Java中com.basho.riak.client.IRiakObject类的典型用法代码示例。如果您正苦于以下问题:Java IRiakObject类的具体用法?Java IRiakObject怎么用?Java IRiakObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IRiakObject类属于com.basho.riak.client包,在下文中一共展示了IRiakObject类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: write
import com.basho.riak.client.IRiakObject; //导入依赖的package包/类
@Override
public synchronized boolean write(CRDTIdentifier id, CRDTData<?> data) {
try {
DCConstants.DCLogger.info("RIAK.store " + id + ": what:" + data.getId());
byte[] arr = Networking.serializer().writeObject(data);
IRiakObject riakObject = RiakObjectBuilder.newBuilder(id.getTable(), id.getKey()).withValue(arr).build();
riak.store(riakObject);
return true;
} catch (IOException e) {
DCConstants.DCLogger.throwing("DCRiakDatabase", "write", e);
return false;
}
}
示例2: writeSysData
import com.basho.riak.client.IRiakObject; //导入依赖的package包/类
@Override
public synchronized boolean writeSysData(String table, String key, Object data) {
try {
DCConstants.DCLogger.info("RIAK.SYSstore " + table + ": what:" + key);
byte[] arr = Networking.serializer().writeObject(data);
IRiakObject riakObject = RiakObjectBuilder.newBuilder(table, key).withValue(arr).build();
riak.store(riakObject);
return true;
} catch (IOException e) {
DCConstants.DCLogger.throwing("DCRiakDatabase", "write", e);
return false;
}
}
示例3: getValue
import com.basho.riak.client.IRiakObject; //导入依赖的package包/类
static private byte[] getValue(String bucket, String key) {
try {
Bucket b = riak.fetchBucket(bucket).execute();
if (b != null) {
IRiakObject obj = b.fetch(key).execute();
if (obj != null)
return obj.getValue();
}
} catch (RiakRetryFailedException e) {
e.printStackTrace();
}
return null;
}