本文整理汇总了Java中org.sdnplatform.sync.internal.store.SynchronizingStorageEngine类的典型用法代码示例。如果您正苦于以下问题:Java SynchronizingStorageEngine类的具体用法?Java SynchronizingStorageEngine怎么用?Java SynchronizingStorageEngine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SynchronizingStorageEngine类属于org.sdnplatform.sync.internal.store包,在下文中一共展示了SynchronizingStorageEngine类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleSyncOffer
import org.sdnplatform.sync.internal.store.SynchronizingStorageEngine; //导入依赖的package包/类
/**
* Check whether any of the specified versions for the key are not older
* than the versions we already have
* @param storeName the store to check
* @param key the key to check
* @param versions an iterable over the versions
* @return true if we'd like a copy of the data indicated
* @throws SyncException
*/
public boolean handleSyncOffer(String storeName,
byte[] key,
Iterable<VectorClock> versions)
throws SyncException {
SynchronizingStorageEngine store = storeRegistry.get(storeName);
if (store == null) return true;
List<Versioned<byte[]>> values = store.get(new ByteArray(key));
if (values == null || values.size() == 0) return true;
// check whether any of the versions are not older than what we have
for (VectorClock vc : versions) {
for (Versioned<byte[]> value : values) {
VectorClock existingVc = (VectorClock)value.getVersion();
if (!vc.compare(existingVc).equals(Occurred.BEFORE))
return true;
}
}
return false;
}
示例2: handleSyncOffer
import org.sdnplatform.sync.internal.store.SynchronizingStorageEngine; //导入依赖的package包/类
/**
* Check whether any of the specified versions for the key are not older
* than the versions we already have
* @param storeName the store to check
* @param key the key to check
* @param versions an iterable over the versions
* @return true if we'd like a copy of the data indicated
* @throws SyncException
*/
public boolean handleSyncOffer(String storeName,
byte[] key,
Iterable<VectorClock> versions)
throws SyncException {
SynchronizingStorageEngine store = storeRegistry.get(storeName);
if (store == null) return true;
List<Versioned<byte[]>> values = store.get(new ByteArray(key));
if (values == null || values.size() == 0) return true;
// check whether any of the versions are not older than what we have
for (VectorClock vc : versions) {
for (Versioned<byte[]> value : values) {
VectorClock existingVc = (VectorClock)value.getVersion();
if (!vc.compare(existingVc).equals(Occurred.BEFORE))
return true;
}
}
return false;
}
示例3: getStoreInternal
import org.sdnplatform.sync.internal.store.SynchronizingStorageEngine; //导入依赖的package包/类
protected SynchronizingStorageEngine getStoreInternal(String storeName)
throws UnknownStoreException {
SynchronizingStorageEngine store = storeRegistry.get(storeName);
if (store == null) {
throw new UnknownStoreException("Store " + storeName +
" has not been registered");
}
return store;
}
示例4: getMessage
import org.sdnplatform.sync.internal.store.SynchronizingStorageEngine; //导入依赖的package包/类
/**
* Allocate a partially-initialized {@link SyncMessage} object for
* the given store
* @param store the store
* @return the {@link SyncMessage} object
*/
private SyncMessage getMessage(SynchronizingStorageEngine store) {
String storeName = store.getName();
SyncMessage bsm = messages.get(storeName);
if (bsm == null) {
bsm = TProtocolUtil.getTSyncValueMessage(storeName,
store.getScope(),
store.isPersistent());
messages.put(storeName, bsm);
}
return bsm;
}
示例5: queueSyncTask
import org.sdnplatform.sync.internal.store.SynchronizingStorageEngine; //导入依赖的package包/类
/**
* Queue a synchronization of the specified {@link KeyedValues} to all nodes
* assocatiated with the storage engine specified
* @param e the storage engine for the values
* @param kv the values to synchronize
*/
@LogMessageDoc(level="WARN",
message="Sync task queue full and not emptying",
explanation="The synchronization service is overloaded",
recommendation=LogMessageDoc.CHECK_CONTROLLER)
public void queueSyncTask(SynchronizingStorageEngine e,
ByteArray key, Versioned<byte[]> value) {
storeRegistry.queueHint(e.getName(), key, value);
}
示例6: getStoreInternal
import org.sdnplatform.sync.internal.store.SynchronizingStorageEngine; //导入依赖的package包/类
protected SynchronizingStorageEngine getStoreInternal(String storeName)
throws UnknownStoreException {
SynchronizingStorageEngine store = storeRegistry.get(storeName);
if (store == null) {
throw new UnknownStoreException("Store " + storeName +
" has not been registered");
}
return store;
}
示例7: getMessage
import org.sdnplatform.sync.internal.store.SynchronizingStorageEngine; //导入依赖的package包/类
/**
* Allocate a partially-initialized {@link SyncMessage} object for
* the given store
* @param store the store
* @return the {@link SyncMessage} object
*/
private SyncMessage getMessage(SynchronizingStorageEngine store) {
String storeName = store.getName();
SyncMessage bsm = messages.get(storeName);
if (bsm == null) {
bsm = TProtocolUtil.getTSyncValueMessage(storeName,
store.getScope(),
store.isPersistent());
messages.put(storeName, bsm);
}
return bsm;
}