本文整理汇总了Java中com.google.protos.ipc.invalidation.ClientProtocol.ObjectIdP类的典型用法代码示例。如果您正苦于以下问题:Java ObjectIdP类的具体用法?Java ObjectIdP怎么用?Java ObjectIdP使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectIdP类属于com.google.protos.ipc.invalidation.ClientProtocol包,在下文中一共展示了ObjectIdP类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: toCompactString
import com.google.protos.ipc.invalidation.ClientProtocol.ObjectIdP; //导入依赖的package包/类
/**
* Appends a description of the given {@code registration} downcall to the given {@code builder}.
*/
public static TextBuilder toCompactString(TextBuilder builder,
RegistrationDowncall registration) {
if (registration == null) {
return builder;
}
List<ObjectIdP> objects;
if (registration.getRegistrationsCount() > 0) {
builder.append("register(");
objects = registration.getRegistrationsList();
} else {
builder.append("unregister(");
objects = registration.getUnregistrationsList();
}
return CommonProtoStrings2.toCompactStringForObjectIds(builder, objects).append(")");
}
开发者ID:morristech,项目名称:android-chromium,代码行数:19,代码来源:AndroidStrings.java
示例2: informServerRegistrationSummary
import com.google.protos.ipc.invalidation.ClientProtocol.ObjectIdP; //导入依赖的package包/类
/**
* Informs the manager of a new registration state summary from the server.
* Returns a possibly-empty map of <object-id, reg-op-type>. For each entry in the map,
* the caller should make an inform-registration-status upcall on the listener.
*/
Set<ProtoWrapper<RegistrationP>> informServerRegistrationSummary(
RegistrationSummary regSummary) {
if (regSummary != null) {
this.lastKnownServerSummary = ProtoWrapper.of(regSummary);
}
if (isStateInSyncWithServer()) {
// If we are now in sync with the server, then the caller should make inform-reg-status
// upcalls for all operations that we had pending, if any; they are also no longer pending.
Set<ProtoWrapper<RegistrationP>> upcallsToMake =
new HashSet<ProtoWrapper<RegistrationP>>(pendingOperations.size());
for (Map.Entry<ProtoWrapper<ObjectIdP>, RegistrationP.OpType> entry :
pendingOperations.entrySet()) {
ObjectIdP objectId = entry.getKey().getProto();
boolean isReg = entry.getValue() == OpType.REGISTER;
upcallsToMake.add(ProtoWrapper.of(CommonProtos2.newRegistrationP(objectId, isReg)));
}
pendingOperations.clear();
return upcallsToMake;
} else {
// If we are not in sync with the server, then the caller should make no upcalls.
return Collections.emptySet();
}
}
开发者ID:morristech,项目名称:android-chromium,代码行数:29,代码来源:RegistrationManager.java
示例3: AndroidListenerState
import com.google.protos.ipc.invalidation.ClientProtocol.ObjectIdP; //导入依赖的package包/类
/** Initializes state from proto. */
AndroidListenerState(int initialMaxDelayMs, int maxDelayFactor,
AndroidListenerProtocol.AndroidListenerState state) {
desiredRegistrations = new HashSet<ObjectId>();
for (ObjectIdP objectIdProto : state.getRegistrationList()) {
desiredRegistrations.add(ProtoConverter.convertFromObjectIdProto(objectIdProto));
}
for (RetryRegistrationState retryState : state.getRetryRegistrationStateList()) {
ObjectId objectId = ProtoConverter.convertFromObjectIdProto(retryState.getObjectId());
delayGenerators.put(objectId, new TiclExponentialBackoffDelayGenerator(random,
initialMaxDelayMs, maxDelayFactor, retryState.getExponentialBackoffState()));
}
clientId = state.getClientId();
requestCodeSeqNum = state.getRequestCodeSeqNum();
isDirty = false;
this.initialMaxDelayMs = initialMaxDelayMs;
this.maxDelayFactor = maxDelayFactor;
}
开发者ID:morristech,项目名称:android-chromium,代码行数:19,代码来源:AndroidListenerState.java
示例4: toCompactStringForObjectIds
import com.google.protos.ipc.invalidation.ClientProtocol.ObjectIdP; //导入依赖的package包/类
/** See spec in implementation notes. */
public static TextBuilder toCompactStringForObjectIds(TextBuilder builder,
Collection<ObjectIdP> objectIds) {
if (objectIds == null) {
return builder;
}
boolean first = true;
builder.append("ObjectIds: ");
for (ObjectIdP objectId : objectIds) {
if (!first) {
builder.append(", ");
}
toCompactString(builder, objectId);
first = false;
}
return builder;
}
开发者ID:morristech,项目名称:android-chromium,代码行数:18,代码来源:CommonProtoStrings2.java
示例5: Batcher
import com.google.protos.ipc.invalidation.ClientProtocol.ObjectIdP; //导入依赖的package包/类
/** Creates a batcher from {@code marshalledState}. */
Batcher(SystemResources resources, Statistics statistics, BatcherState marshalledState) {
this(resources, statistics);
for (ObjectIdP registration : marshalledState.getRegistrationList()) {
pendingRegistrations.put(ProtoWrapper.of(registration), RegistrationP.OpType.REGISTER);
}
for (ObjectIdP unregistration : marshalledState.getUnregistrationList()) {
pendingRegistrations.put(ProtoWrapper.of(unregistration), RegistrationP.OpType.UNREGISTER);
}
for (InvalidationP ack : marshalledState.getAcknowledgementList()) {
pendingAckedInvalidations.add(ProtoWrapper.of(ack));
}
for (RegistrationSubtree subtree : marshalledState.getRegistrationSubtreeList()) {
pendingRegSubtrees.add(ProtoWrapper.of(subtree));
}
if (marshalledState.hasInitializeMessage()) {
pendingInitializeMessage = marshalledState.getInitializeMessage();
}
if (marshalledState.hasInfoMessage()) {
pendingInfoMessage = marshalledState.getInfoMessage();
}
}
开发者ID:R4md4c,项目名称:cordova-android-chromium,代码行数:23,代码来源:ProtocolHandler.java
示例6: convertToObjectIdProto
import com.google.protos.ipc.invalidation.ClientProtocol.ObjectIdP; //导入依赖的package包/类
/**
* Converts an object id {@code objectId} to the corresponding protocol buffer
* and returns it.
*/
public static ObjectIdP convertToObjectIdProto(ObjectId objectId) {
Preconditions.checkNotNull(objectId);
return CommonProtos2.newObjectIdP(objectId.getSource(),
ByteString.copyFrom(objectId.getName()));
}
开发者ID:morristech,项目名称:android-chromium,代码行数:11,代码来源:ProtoConverter.java
示例7: convertToObjectIdProtoList
import com.google.protos.ipc.invalidation.ClientProtocol.ObjectIdP; //导入依赖的package包/类
/**
* Returns a list of {@link ObjectIdP} by converting each element of {@code objectIds} to
* an {@code ObjectIdP}.
*/
public static List<ObjectIdP> convertToObjectIdProtoList(Collection<ObjectId> objectIds) {
List<ObjectIdP> objectIdPs = new ArrayList<ObjectIdP>(objectIds.size());
for (ObjectId objectId : objectIds) {
objectIdPs.add(ProtoConverter.convertToObjectIdProto(objectId));
}
return objectIdPs;
}
开发者ID:morristech,项目名称:android-chromium,代码行数:12,代码来源:ProtoConverter.java
示例8: convertToObjectIdList
import com.google.protos.ipc.invalidation.ClientProtocol.ObjectIdP; //导入依赖的package包/类
/**
* Returns a list of {@link ObjectId} by converting each element of {@code oidPs} to
* an {@code ObjectId}.
*/
public static List<ObjectId> convertToObjectIdList(List<ObjectIdP> oidPs) {
List<ObjectId> objects = new ArrayList<ObjectId>(oidPs.size());
for (ObjectIdP oidP : oidPs) {
objects.add(ObjectId.newInstance(oidP.getSource(), oidP.getName().toByteArray()));
}
return objects;
}
开发者ID:morristech,项目名称:android-chromium,代码行数:12,代码来源:ProtoConverter.java
示例9: convertToInvalidationProto
import com.google.protos.ipc.invalidation.ClientProtocol.ObjectIdP; //导入依赖的package包/类
/**
* Converts an invalidation {@code invalidation} to the corresponding protocol
* buffer and returns it.
*/
public static InvalidationP convertToInvalidationProto(Invalidation invalidation) {
Preconditions.checkNotNull(invalidation);
ObjectIdP objectId = convertToObjectIdProto(invalidation.getObjectId());
// Invalidations clients do not know about trickle restarts. Every invalidation is allowed
// to suppress earlier invalidations and acks implicitly acknowledge all previous
// invalidations. Therefore the correct semanantics are provided by setting isTrickleRestart to
// true.
return CommonProtos2.newInvalidationP(objectId, invalidation.getVersion(),
TrickleState.fromBoolean(invalidation.getIsTrickleRestartForInternalUse()),
invalidation.getPayload() == null ? null : ByteString.copyFrom(invalidation.getPayload()));
}
开发者ID:morristech,项目名称:android-chromium,代码行数:17,代码来源:ProtoConverter.java
示例10: newInvalidationPForUnknownVersion
import com.google.protos.ipc.invalidation.ClientProtocol.ObjectIdP; //导入依赖的package包/类
public static InvalidationP newInvalidationPForUnknownVersion(ObjectIdP oid,
long sequenceNumber) {
return InvalidationP.newBuilder()
.setObjectId(oid)
.setIsKnownVersion(false)
.setIsTrickleRestart(true)
.setVersion(sequenceNumber)
.build();
}
开发者ID:R4md4c,项目名称:cordova-android-chromium,代码行数:10,代码来源:CommonProtos2.java
示例11: newInvalidateUnknownIntent
import com.google.protos.ipc.invalidation.ClientProtocol.ObjectIdP; //导入依赖的package包/类
public static Intent newInvalidateUnknownIntent(ObjectIdP object, AckHandleP ackHandle) {
Intent intent = new Intent();
InvalidateUpcall invUpcall = InvalidateUpcall.newBuilder()
.setAckHandle(ackHandle.toByteString())
.setInvalidateUnknown(object).build();
intent.putExtra(LISTENER_UPCALL_KEY,
newBuilder().setInvalidate(invUpcall).build().toByteArray());
return intent;
}
开发者ID:morristech,项目名称:android-chromium,代码行数:10,代码来源:ProtocolIntents.java
示例12: newRegistrationStatusIntent
import com.google.protos.ipc.invalidation.ClientProtocol.ObjectIdP; //导入依赖的package包/类
public static Intent newRegistrationStatusIntent(ObjectIdP object, boolean isRegistered) {
Intent intent = new Intent();
RegistrationStatusUpcall regUpcall = RegistrationStatusUpcall.newBuilder()
.setObjectId(object)
.setIsRegistered(isRegistered).build();
intent.putExtra(LISTENER_UPCALL_KEY,
newBuilder().setRegistrationStatus(regUpcall).build().toByteArray());
return intent;
}
开发者ID:morristech,项目名称:android-chromium,代码行数:10,代码来源:ProtocolIntents.java
示例13: newRegistrationFailureIntent
import com.google.protos.ipc.invalidation.ClientProtocol.ObjectIdP; //导入依赖的package包/类
public static Intent newRegistrationFailureIntent(ObjectIdP object, boolean isTransient,
String message) {
Intent intent = new Intent();
RegistrationFailureUpcall regUpcall = RegistrationFailureUpcall.newBuilder()
.setObjectId(object)
.setTransient(isTransient)
.setMessage(message).build();
intent.putExtra(LISTENER_UPCALL_KEY,
newBuilder().setRegistrationFailure(regUpcall).build().toByteArray());
return intent;
}
开发者ID:morristech,项目名称:android-chromium,代码行数:12,代码来源:ProtocolIntents.java
示例14: getRegistrationManagerStateCopyForTest
import com.google.protos.ipc.invalidation.ClientProtocol.ObjectIdP; //导入依赖的package包/类
/**
* Returns a copy of the registration manager's state
* <p>
* Direct test code MUST not call this method on a random thread. It must be called on the
* InvalidationClientImpl's internal thread.
*/
RegistrationManagerState getRegistrationManagerStateCopyForTest(DigestFunction digestFunction) {
List<ObjectIdP> registeredObjects = new ArrayList<ObjectIdP>();
for (ObjectIdP oid : desiredRegistrations.getElements(EMPTY_PREFIX, 0)) {
registeredObjects.add(oid);
}
return new RegistrationManagerState(
RegistrationSummary.newBuilder(getRegistrationSummary()).build(),
RegistrationSummary.newBuilder(lastKnownServerSummary.getProto()).build(),
registeredObjects);
}
开发者ID:morristech,项目名称:android-chromium,代码行数:18,代码来源:RegistrationManager.java
示例15: performOperations
import com.google.protos.ipc.invalidation.ClientProtocol.ObjectIdP; //导入依赖的package包/类
/** Perform registration/unregistation for all objects in {@code objectIds}. */
Collection<ObjectIdP> performOperations(Collection<ObjectIdP> objectIds,
RegistrationP.OpType regOpType) {
// Record that we have pending operations on the objects.
for (ObjectIdP objectId : objectIds) {
pendingOperations.put(ProtoWrapper.of(objectId), regOpType);
}
// Update the digest appropriately.
if (regOpType == RegistrationP.OpType.REGISTER) {
return desiredRegistrations.add(objectIds);
} else {
return desiredRegistrations.remove(objectIds);
}
}
开发者ID:morristech,项目名称:android-chromium,代码行数:15,代码来源:RegistrationManager.java
示例16: removeRegisteredObjects
import com.google.protos.ipc.invalidation.ClientProtocol.ObjectIdP; //导入依赖的package包/类
/**
* Removes all desired registrations and pending operations. Returns all object ids
* that were affected.
* <p>
* REQUIRES: the caller issue a permanent failure upcall to the listener for all returned object
* ids.
*/
Collection<ProtoWrapper<ObjectIdP>> removeRegisteredObjects() {
int numObjects = desiredRegistrations.size() + pendingOperations.size();
Set<ProtoWrapper<ObjectIdP>> failureCalls = new HashSet<ProtoWrapper<ObjectIdP>>(numObjects);
for (ObjectIdP objectId : desiredRegistrations.removeAll()) {
failureCalls.add(ProtoWrapper.of(objectId));
}
failureCalls.addAll(pendingOperations.keySet());
pendingOperations.clear();
return failureCalls;
}
开发者ID:morristech,项目名称:android-chromium,代码行数:18,代码来源:RegistrationManager.java
示例17: marshal
import com.google.protos.ipc.invalidation.ClientProtocol.ObjectIdP; //导入依赖的package包/类
@Override
public RegistrationManagerStateP marshal() {
RegistrationManagerStateP.Builder builder = RegistrationManagerStateP.newBuilder();
builder.setLastKnownServerSummary(lastKnownServerSummary.getProto());
builder.addAllRegistrations(desiredRegistrations.getElements(EMPTY_PREFIX, 0));
for (Map.Entry<ProtoWrapper<ObjectIdP>, RegistrationP.OpType> pendingOp :
pendingOperations.entrySet()) {
ObjectIdP objectId = pendingOp.getKey().getProto();
boolean isReg = pendingOp.getValue() == OpType.REGISTER;
builder.addPendingOperations(CommonProtos2.newRegistrationP(objectId, isReg));
}
return builder.build();
}
开发者ID:morristech,项目名称:android-chromium,代码行数:14,代码来源:RegistrationManager.java
示例18: add
import com.google.protos.ipc.invalidation.ClientProtocol.ObjectIdP; //导入依赖的package包/类
@Override
public boolean add(ObjectIdP oid) {
if (registrations.put(ObjectIdDigestUtils.getDigest(oid, digestFunction), oid) == null) {
recomputeDigest();
return true;
}
return false;
}
开发者ID:morristech,项目名称:android-chromium,代码行数:9,代码来源:SimpleRegistrationStore.java
示例19: remove
import com.google.protos.ipc.invalidation.ClientProtocol.ObjectIdP; //导入依赖的package包/类
@Override
public boolean remove(ObjectIdP oid) {
if (registrations.remove(ObjectIdDigestUtils.getDigest(oid, digestFunction)) != null) {
recomputeDigest();
return true;
}
return false;
}
开发者ID:morristech,项目名称:android-chromium,代码行数:9,代码来源:SimpleRegistrationStore.java
示例20: removeAll
import com.google.protos.ipc.invalidation.ClientProtocol.ObjectIdP; //导入依赖的package包/类
@Override
public Collection<ObjectIdP> removeAll() {
Collection<ObjectIdP> result = new ArrayList<ObjectIdP>(registrations.values());
registrations.clear();
recomputeDigest();
return result;
}
开发者ID:morristech,项目名称:android-chromium,代码行数:8,代码来源:SimpleRegistrationStore.java
注:本文中的com.google.protos.ipc.invalidation.ClientProtocol.ObjectIdP类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论