本文整理汇总了Java中org.sdnplatform.sync.thrift.KeyedVersions类的典型用法代码示例。如果您正苦于以下问题:Java KeyedVersions类的具体用法?Java KeyedVersions怎么用?Java KeyedVersions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
KeyedVersions类属于org.sdnplatform.sync.thrift包,在下文中一共展示了KeyedVersions类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTKeyedVersions
import org.sdnplatform.sync.thrift.KeyedVersions; //导入依赖的package包/类
/**
* Construct a thrift {@link org.sdnplatform.sync.thrift.KeyedValues}
* @param key the key
* @param value the versioned values
* @return the thrift object
*/
public static KeyedVersions
getTKeyedVersions(ByteArray key, List<Versioned<byte[]>> values) {
KeyedVersions kv = new KeyedVersions();
kv.setKey(key.get());
for (Versioned<byte[]> v : values) {
kv.addToVersions(getTVectorClock((VectorClock)v.getVersion()));
}
return kv;
}
示例2: getTKeyedVersions
import org.sdnplatform.sync.thrift.KeyedVersions; //导入依赖的package包/类
/**
* Construct a thrift {@link org.sdnplatform.sync.thrift.KeyedValues}
* @param key the key
* @param value the versioned values
* @return the thrift object
*/
public static KeyedVersions
getTKeyedVersions(ByteArray key, List<Versioned<byte[]>> values) {
KeyedVersions kv = new KeyedVersions();
kv.setKey(key.get());
for (Versioned<byte[]> v : values) {
kv.addToVersions(getTVectorClock((VectorClock)v.getVersion()));
}
return kv;
}
示例3: antientropy
import org.sdnplatform.sync.thrift.KeyedVersions; //导入依赖的package包/类
/**
* Perform a synchronization with the node specified
*/
public void antientropy(Node node) {
if (!rpcService.isConnected(node.getNodeId())) return;
logger.info("[{}->{}] Synchronizing local state to remote node",
getLocalNodeId(), node.getNodeId());
for (SynchronizingStorageEngine store : storeRegistry.values()) {
if (Scope.LOCAL.equals(store.getScope())) {
if (node.getDomainId() !=
getClusterConfig().getNode().getDomainId())
continue;
} else if (Scope.UNSYNCHRONIZED.equals(store.getScope())) {
continue;
}
IClosableIterator<Entry<ByteArray,
List<Versioned<byte[]>>>> entries =
store.entries();
try {
SyncMessage bsm =
TProtocolUtil.getTSyncOfferMessage(store.getName(),
store.getScope(),
store.isPersistent());
int count = 0;
while (entries.hasNext()) {
if (!rpcService.isConnected(node.getNodeId())) return;
Entry<ByteArray, List<Versioned<byte[]>>> pair =
entries.next();
KeyedVersions kv =
TProtocolUtil.getTKeyedVersions(pair.getKey(),
pair.getValue());
bsm.getSyncOffer().addToVersions(kv);
count += 1;
if (count >= 50) {
sendSyncOffer(node.getNodeId(), bsm);
// realloc sync message - it is still queued up by netty!
bsm = TProtocolUtil.getTSyncOfferMessage(store.getName(),
store.getScope(),
store.isPersistent());
count = 0;
}
}
sendSyncOffer(node.getNodeId(), bsm);
} catch (InterruptedException e) {
// This can't really happen
throw new RuntimeException(e);
} finally {
entries.close();
}
}
}
示例4: antientropy
import org.sdnplatform.sync.thrift.KeyedVersions; //导入依赖的package包/类
/**
* Perform a synchronization with the node specified
*/
@LogMessageDoc(level="INFO",
message="[{id}->{id}] Synchronizing local state to remote node",
explanation="Normal state resynchronization is occurring")
public void antientropy(Node node) {
if (!rpcService.isConnected(node.getNodeId())) return;
logger.info("[{}->{}] Synchronizing local state to remote node",
getLocalNodeId(), node.getNodeId());
for (SynchronizingStorageEngine store : storeRegistry.values()) {
if (Scope.LOCAL.equals(store.getScope())) {
if (node.getDomainId() !=
getClusterConfig().getNode().getDomainId())
continue;
} else if (Scope.UNSYNCHRONIZED.equals(store.getScope())) {
continue;
}
IClosableIterator<Entry<ByteArray,
List<Versioned<byte[]>>>> entries =
store.entries();
try {
SyncMessage bsm =
TProtocolUtil.getTSyncOfferMessage(store.getName(),
store.getScope(),
store.isPersistent());
int count = 0;
while (entries.hasNext()) {
if (!rpcService.isConnected(node.getNodeId())) return;
Entry<ByteArray, List<Versioned<byte[]>>> pair =
entries.next();
KeyedVersions kv =
TProtocolUtil.getTKeyedVersions(pair.getKey(),
pair.getValue());
bsm.getSyncOffer().addToVersions(kv);
count += 1;
if (count >= 50) {
sendSyncOffer(node.getNodeId(), bsm);
bsm.getSyncOffer().unsetVersions();
count = 0;
}
}
sendSyncOffer(node.getNodeId(), bsm);
} catch (InterruptedException e) {
// This can't really happen
throw new RuntimeException(e);
} finally {
entries.close();
}
}
}
示例5: antientropy
import org.sdnplatform.sync.thrift.KeyedVersions; //导入依赖的package包/类
/**
* Perform a synchronization with the node specified
*/
public void antientropy(Node node) {
if (!rpcService.isConnected(node.getNodeId())) return;
logger.info("[{}->{}] Synchronizing local state to remote node",
getLocalNodeId(), node.getNodeId());
for (SynchronizingStorageEngine store : storeRegistry.values()) {
if (Scope.LOCAL.equals(store.getScope())) {
if (node.getDomainId() !=
getClusterConfig().getNode().getDomainId())
continue;
} else if (Scope.UNSYNCHRONIZED.equals(store.getScope())) {
continue;
}
IClosableIterator<Entry<ByteArray,
List<Versioned<byte[]>>>> entries =
store.entries();
try {
SyncMessage bsm =
TProtocolUtil.getTSyncOfferMessage(store.getName(),
store.getScope(),
store.isPersistent());
int count = 0;
while (entries.hasNext()) {
if (!rpcService.isConnected(node.getNodeId())) return;
Entry<ByteArray, List<Versioned<byte[]>>> pair =
entries.next();
KeyedVersions kv =
TProtocolUtil.getTKeyedVersions(pair.getKey(),
pair.getValue());
bsm.getSyncOffer().addToVersions(kv);
count += 1;
if (count >= 50) {
sendSyncOffer(node.getNodeId(), bsm);
bsm.getSyncOffer().unsetVersions();
count = 0;
}
}
sendSyncOffer(node.getNodeId(), bsm);
} catch (InterruptedException e) {
// This can't really happen
throw new RuntimeException(e);
} finally {
entries.close();
}
}
}