本文整理汇总了Java中com.persistit.Persistit类的典型用法代码示例。如果您正苦于以下问题:Java Persistit类的具体用法?Java Persistit怎么用?Java Persistit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Persistit类属于com.persistit包,在下文中一共展示了Persistit类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: traverse
import com.persistit.Persistit; //导入依赖的package包/类
@Override
public <V extends IndexVisitor<Key, Value>> V traverse(Session session,
Index index,
V visitor,
long scanTimeLimit,
long sleepTime) {
MemoryStoreData storeData = createStoreData(session, index);
storeData.persistitValue = new Value((Persistit)null);
indexIterator(session, storeData, false);
while(storeData.next()) {
// Key
unpackKey(storeData);
// Value
unpackValue(storeData);
// Visit
visitor.visit(storeData.persistitKey, storeData.persistitValue);
}
return visitor;
}
开发者ID:jaytaylor,项目名称:sql-layer,代码行数:20,代码来源:MemoryStore.java
示例2: traverse
import com.persistit.Persistit; //导入依赖的package包/类
@Override
public <V extends IndexVisitor<Key, Value>> V traverse(Session session, Index index, V visitor, long scanTimeLimit, long sleepTime) {
FDBStoreData storeData = createStoreData(session, index);
storeData.persistitValue = new Value((Persistit)null);
TransactionState txn = txnService.getTransaction(session);
FDBScanTransactionOptions transactionOptions;
if (scanTimeLimit > 0) {
transactionOptions = new FDBScanTransactionOptions(true, -1,
scanTimeLimit, sleepTime);
}
else {
transactionOptions = FDBScanTransactionOptions.SNAPSHOT;
}
indexIterator(session, storeData, false, false, true, false, transactionOptions);
while(storeData.next()) {
// Key
unpackKey(storeData);
// Value
unpackValue(storeData);
// Visit
visitor.visit(storeData.persistitKey, storeData.persistitValue);
}
return visitor;
}
开发者ID:jaytaylor,项目名称:sql-layer,代码行数:27,代码来源:FDBStore.java
示例3: createEnvironment
import com.persistit.Persistit; //导入依赖的package包/类
private void createEnvironment() throws IOException, PersistitException {
closeDb();
temporaryFolder = new TemporaryFolder();
temporaryFolder.create();
persistit = new Persistit();
persistit.setPersistitLogger(new Slf4jAdapter(LoggerFactory.getLogger("PERSISTIT")));
Properties props = new Properties();
props.setProperty("datapath", temporaryFolder.getRoot().getAbsolutePath());
props.setProperty("logpath", "${datapath}/log");
props.setProperty("logfile", "${logpath}/persistit_${timestamp}.log");
props.setProperty("buffer.count.8192", "5000");
props.setProperty("journalpath", "${datapath}/journal");
props.setProperty("tmpvoldir", "${datapath}");
props.setProperty("volume.1", "${datapath}/persistit,create,pageSize:8192,initialPages:10,extensionPages:100,maximumPages:25000");
props.setProperty("jmx", "false");
persistit.setProperties(props);
persistit.initialize();
volume = persistit.createTemporaryVolume();
}
开发者ID:JetBrains,项目名称:xodus,代码行数:21,代码来源:JMHPersistItTokyoCabinetBenchmarkBase.java
示例4: PersistitTransaction
import com.persistit.Persistit; //导入依赖的package包/类
public PersistitTransaction(Persistit p, StoreTxConfig config) throws StorageException {
super(config);
db = p;
synchronized (this) {
sessionId = getSessionId();
}
assign();
Preconditions.checkNotNull(sessionId);
Transaction tx = db.getTransaction();
assert sessionId == tx.getSessionId();
try {
tx.begin();
} catch (PersistitException ex) {
throw new PermanentStorageException(ex);
}
}
开发者ID:thinkaurelius,项目名称:titan-experimental,代码行数:18,代码来源:PersistitTransaction.java
示例5: resetForWrite
import com.persistit.Persistit; //导入依赖的package包/类
@Override
void resetForWrite(MemoryStoreData storeData, Index index, WriteIndexRow indexRowBuffer) {
if(storeData.persistitValue == null) {
storeData.persistitValue = new Value((Persistit) null);
}
indexRowBuffer.resetForWrite(index, storeData.persistitKey, storeData.persistitValue);
}
开发者ID:jaytaylor,项目名称:sql-layer,代码行数:8,代码来源:MemoryStore.java
示例6: resetForWrite
import com.persistit.Persistit; //导入依赖的package包/类
@Override
void resetForWrite(FDBStoreData storeData, Index index, WriteIndexRow indexRowBuffer) {
if(storeData.persistitValue == null) {
storeData.persistitValue = new Value((Persistit) null);
}
indexRowBuffer.resetForWrite(index, storeData.persistitKey, storeData.persistitValue);
}
开发者ID:jaytaylor,项目名称:sql-layer,代码行数:8,代码来源:FDBStore.java
示例7: createException
import com.persistit.Persistit; //导入依赖的package包/类
@Override
public RuntimeException createException(Session session, TransactionState txn, Index index) {
// Recover Key for error message.
Key persistitKey = new Key((Persistit)null);
FDBStoreDataHelper.unpackTuple(index, persistitKey, bkey);
String msg = formatIndexRowString(index, persistitKey);
return new DuplicateKeyException(index.getIndexName(), msg);
}
开发者ID:jaytaylor,项目名称:sql-layer,代码行数:9,代码来源:FDBPendingIndexChecks.java
示例8: createSource
import com.persistit.Persistit; //导入依赖的package包/类
private PersistitValueValueSource createSource(ValueInit values) {
Value value = new Value((Persistit)null);
value.setStreamMode(true);
values.putValues(value);
value.setStreamMode(false); // need to reset the Value before reading
value.setStreamMode(true);
PersistitValueValueSource source = new PersistitValueValueSource();
source.attach(value);
return source;
}
开发者ID:jaytaylor,项目名称:sql-layer,代码行数:14,代码来源:PersistitValueValueSourceTest.java
示例9: createFileBuffers
import com.persistit.Persistit; //导入依赖的package包/类
@Before
public void createFileBuffers() {
os = new ByteArrayOutputStream();
startKey = new SortKey();
testKey = new Key ((Persistit)null);
writer = new KeyWriter(os);
}
开发者ID:jaytaylor,项目名称:sql-layer,代码行数:8,代码来源:KeyReaderWriterTest.java
示例10: PersistitStoreManager
import com.persistit.Persistit; //导入依赖的package包/类
public PersistitStoreManager(Configuration configuration) throws StorageException {
super(configuration);
stores = new HashMap<String, PersistitKeyValueStore>();
// read config and setup
String datapath = configuration.getString(GraphDatabaseConfiguration.STORAGE_DIRECTORY_KEY);
Integer bufferCount = configuration.getInt(BUFFER_COUNT_KEY, BUFFER_COUNT_DEFAULT);
properties = new Properties();
properties.put("datapath", datapath);
// On pathSeparator is ":" on 'Nix systems - File.separator is what is intended.
properties.put("journalpath", directory + File.separator + VOLUME_NAME);
properties.put("logfile", directory + File.separator + VOLUME_NAME + ".log");
// @todo: make these tunable
properties.put("buffer.count.16384", bufferCount.toString());
properties.put("volume.1", directory + File.separator + VOLUME_NAME
+ ",create,pageSize:16384,initialPages:1000,extensionPages:1000,maximumPages:1000000");
try {
db = new Persistit(properties);
db.initialize();
} catch (PersistitException ex) {
throw new PermanentStorageException(ex);
}
}
开发者ID:thinkaurelius,项目名称:titan-experimental,代码行数:30,代码来源:PersistitStoreManager.java
示例11: MemoryIterationHelper
import com.persistit.Persistit; //导入依赖的package包/类
public MemoryIterationHelper(MemoryAdapter adapter, IndexRowType indexRowType) {
this.adapter = adapter;
this.rowType = indexRowType.physicalRowType();
this.storeData = adapter.getUnderlyingStore().createStoreData(adapter.getSession(), rowType.index());
this.storeData.persistitValue = new Value((Persistit)null);
}
开发者ID:jaytaylor,项目名称:sql-layer,代码行数:7,代码来源:MemoryIterationHelper.java
示例12: FDBIterationHelper
import com.persistit.Persistit; //导入依赖的package包/类
public FDBIterationHelper(FDBAdapter adapter, IndexRowType rowType) {
this.adapter = adapter;
this.rowType = rowType.physicalRowType();
this.storeData = adapter.getUnderlyingStore().createStoreData(adapter.getSession(), rowType.index());
this.storeData.persistitValue = new Value((Persistit)null);
}
开发者ID:jaytaylor,项目名称:sql-layer,代码行数:7,代码来源:FDBIterationHelper.java
示例13: SortKey
import com.persistit.Persistit; //导入依赖的package包/类
public SortKey () {
this.sortKeys = new ArrayList<>();
this.rowValue = new Value((Persistit)null);
rowValue.clear();
}
开发者ID:jaytaylor,项目名称:sql-layer,代码行数:6,代码来源:MergeJoinSorter.java
示例14: createValue
import com.persistit.Persistit; //导入依赖的package包/类
private Value createValue(Row row)
{
// Do a rough calculation of size of the row data
int size = 0;
for (int i = 0; i < rowFields; i++) {
if (tFieldTypes[i] == null) {
size += 1;
} else if (tFieldTypes[i].typeClass().hasFixedSerializationSize()) {
size += tFieldTypes[i].typeClass().fixedSerializationSize() + 2;
} else {
ValueSource src = row.value(i);
if (!src.isNull()) {
switch (TInstance.underlyingType(src.getType())) {
case STRING:
size += AkCollator.getDebugString(src, collators[i]).length() * 2 + 3;
break;
case BYTES:
size += src.getBytes().length;
break;
default:
throw new IllegalArgumentException("Unexpected UnderlyingType: " + src.getType());
}
} else {
size += 1;
}
}
}
size = ((size + SIZE_GRANULARITY - 1) / SIZE_GRANULARITY) * SIZE_GRANULARITY;
// Create a new conversion value
Value convertValue = new Value ((Persistit)null,
Math.max(size, Value.INITIAL_SIZE),
Math.max(size, Value.DEFAULT_MAXIMUM_SIZE));
valueTarget.attach(convertValue);
// Covert the row to the Value for storage in the SortKey
while(true) {
try {
convertValue.clear();
convertValue.setStreamMode(true);
for (int i = 0; i < rowFields; i++) {
ValueSource field = row.value(i);
if (field.isNull()) {
valueTarget.putNull();
} else {
tFieldTypes[i].writeCanonical(field, valueTarget);
}
}
break;
} catch (ConversionException e) {
enlargeValue(convertValue);
}
}
// reset some more un-needed internal state. But this requires
// making a copy of the internal data, again.
return new Value(convertValue);
}
开发者ID:jaytaylor,项目名称:sql-layer,代码行数:57,代码来源:MergeJoinSorter.java
注:本文中的com.persistit.Persistit类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论