当前位置: 首页>>代码示例>>Java>>正文


Java SynchronizingStorageEngine类代码示例

本文整理汇总了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;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:31,代码来源:SyncManager.java

示例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;
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:31,代码来源:SyncManager.java

示例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;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:10,代码来源:SyncManager.java

示例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;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:18,代码来源:SyncManager.java

示例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);
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:15,代码来源:SyncManager.java

示例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;
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:10,代码来源:SyncManager.java

示例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;
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:18,代码来源:SyncManager.java


注:本文中的org.sdnplatform.sync.internal.store.SynchronizingStorageEngine类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。