Search in sources :

Example 1 with EntryVersionsList

use of org.apache.geode.internal.cache.DistributedPutAllOperation.EntryVersionsList in project geode by apache.

the class RemoveAllPRMessage method fromData.

@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
    super.fromData(in);
    this.bucketId = Integer.valueOf((int) InternalDataSerializer.readSignedVL(in));
    if ((flags & HAS_BRIDGE_CONTEXT) != 0) {
        this.bridgeContext = DataSerializer.readObject(in);
    }
    Version sourceVersion = InternalDataSerializer.getVersionForDataStream(in);
    this.callbackArg = DataSerializer.readObject(in);
    this.removeAllPRDataSize = (int) InternalDataSerializer.readUnsignedVL(in);
    this.removeAllPRData = new RemoveAllEntryData[removeAllPRDataSize];
    if (this.removeAllPRDataSize > 0) {
        final Version version = InternalDataSerializer.getVersionForDataStreamOrNull(in);
        final ByteArrayDataInput bytesIn = new ByteArrayDataInput();
        for (int i = 0; i < this.removeAllPRDataSize; i++) {
            this.removeAllPRData[i] = new RemoveAllEntryData(in, null, i, version, bytesIn);
        }
        boolean hasTags = in.readBoolean();
        if (hasTags) {
            EntryVersionsList versionTags = EntryVersionsList.create(in);
            for (int i = 0; i < this.removeAllPRDataSize; i++) {
                this.removeAllPRData[i].versionTag = versionTags.get(i);
            }
        }
    }
}
Also used : EntryVersionsList(org.apache.geode.internal.cache.DistributedPutAllOperation.EntryVersionsList) Version(org.apache.geode.internal.Version) RemoveAllEntryData(org.apache.geode.internal.cache.DistributedRemoveAllOperation.RemoveAllEntryData) ByteArrayDataInput(org.apache.geode.internal.ByteArrayDataInput)

Example 2 with EntryVersionsList

use of org.apache.geode.internal.cache.DistributedPutAllOperation.EntryVersionsList in project geode by apache.

the class RemoveAllPRMessage method toData.

@Override
public void toData(DataOutput out) throws IOException {
    super.toData(out);
    if (bucketId == null) {
        InternalDataSerializer.writeSignedVL(-1, out);
    } else {
        InternalDataSerializer.writeSignedVL(bucketId.intValue(), out);
    }
    if (this.bridgeContext != null) {
        DataSerializer.writeObject(this.bridgeContext, out);
    }
    DataSerializer.writeObject(this.callbackArg, out);
    InternalDataSerializer.writeUnsignedVL(this.removeAllPRDataSize, out);
    if (this.removeAllPRDataSize > 0) {
        EntryVersionsList versionTags = new EntryVersionsList(removeAllPRDataSize);
        boolean hasTags = false;
        for (int i = 0; i < this.removeAllPRDataSize; i++) {
            // If sender's version is >= 7.0.1 then we can send versions list.
            if (!hasTags && removeAllPRData[i].versionTag != null) {
                hasTags = true;
            }
            VersionTag<?> tag = removeAllPRData[i].versionTag;
            versionTags.add(tag);
            removeAllPRData[i].versionTag = null;
            removeAllPRData[i].toData(out);
            removeAllPRData[i].versionTag = tag;
        // RemoveAllEntryData's toData did not serialize eventID to save
        // performance for DR, but in PR,
        // we pack it for each entry since we used fake eventID
        }
        out.writeBoolean(hasTags);
        if (hasTags) {
            InternalDataSerializer.invokeToData(versionTags, out);
        }
    }
}
Also used : EntryVersionsList(org.apache.geode.internal.cache.DistributedPutAllOperation.EntryVersionsList)

Example 3 with EntryVersionsList

use of org.apache.geode.internal.cache.DistributedPutAllOperation.EntryVersionsList in project geode by apache.

the class PutAllPRMessage method fromData.

@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
    super.fromData(in);
    this.bucketId = (int) InternalDataSerializer.readSignedVL(in);
    if ((flags & HAS_BRIDGE_CONTEXT) != 0) {
        this.bridgeContext = DataSerializer.readObject(in);
    }
    this.callbackArg = DataSerializer.readObject(in);
    this.putAllPRDataSize = (int) InternalDataSerializer.readUnsignedVL(in);
    this.putAllPRData = new PutAllEntryData[putAllPRDataSize];
    if (this.putAllPRDataSize > 0) {
        final Version version = InternalDataSerializer.getVersionForDataStreamOrNull(in);
        final ByteArrayDataInput bytesIn = new ByteArrayDataInput();
        for (int i = 0; i < this.putAllPRDataSize; i++) {
            this.putAllPRData[i] = new PutAllEntryData(in, null, i, version, bytesIn);
        }
        boolean hasTags = in.readBoolean();
        if (hasTags) {
            EntryVersionsList versionTags = EntryVersionsList.create(in);
            for (int i = 0; i < this.putAllPRDataSize; i++) {
                this.putAllPRData[i].versionTag = versionTags.get(i);
            }
        }
    }
}
Also used : EntryVersionsList(org.apache.geode.internal.cache.DistributedPutAllOperation.EntryVersionsList) Version(org.apache.geode.internal.Version) ByteArrayDataInput(org.apache.geode.internal.ByteArrayDataInput) PutAllEntryData(org.apache.geode.internal.cache.DistributedPutAllOperation.PutAllEntryData)

Example 4 with EntryVersionsList

use of org.apache.geode.internal.cache.DistributedPutAllOperation.EntryVersionsList in project geode by apache.

the class DistTxEntryEvent method removeAllFromData.

/**
   * @param in
   * @throws IOException
   * @throws ClassNotFoundException
   */
private void removeAllFromData(DataInput in) throws IOException, ClassNotFoundException {
    int removeAllSize = DataSerializer.readInteger(in);
    final RemoveAllEntryData[] removeAllData = new RemoveAllEntryData[removeAllSize];
    final Version version = InternalDataSerializer.getVersionForDataStreamOrNull(in);
    final ByteArrayDataInput bytesIn = new ByteArrayDataInput();
    for (int i = 0; i < removeAllSize; i++) {
        removeAllData[i] = new RemoveAllEntryData(in, this.eventID, i, version, bytesIn);
    }
    boolean hasTags = in.readBoolean();
    if (hasTags) {
        EntryVersionsList versionTags = EntryVersionsList.create(in);
        for (int i = 0; i < removeAllSize; i++) {
            removeAllData[i].versionTag = versionTags.get(i);
        }
    }
    // TODO DISTTX: release this event
    EntryEventImpl e = EntryEventImpl.create(this.region, Operation.REMOVEALL_DESTROY, null, null, null, true, this.getDistributedMember(), true, true);
    this.removeAllOp = new DistributedRemoveAllOperation(e, removeAllSize, false);
    this.removeAllOp.setRemoveAllEntryData(removeAllData);
}
Also used : EntryVersionsList(org.apache.geode.internal.cache.DistributedPutAllOperation.EntryVersionsList) DistributedRemoveAllOperation(org.apache.geode.internal.cache.DistributedRemoveAllOperation) Version(org.apache.geode.internal.Version) EntryEventImpl(org.apache.geode.internal.cache.EntryEventImpl) RemoveAllEntryData(org.apache.geode.internal.cache.DistributedRemoveAllOperation.RemoveAllEntryData) ByteArrayDataInput(org.apache.geode.internal.ByteArrayDataInput)

Example 5 with EntryVersionsList

use of org.apache.geode.internal.cache.DistributedPutAllOperation.EntryVersionsList in project geode by apache.

the class DistTxEntryEvent method removeAllToData.

/**
   * @param out
   * @throws IOException
   */
private void removeAllToData(DataOutput out) throws IOException {
    DataSerializer.writeInteger(this.removeAllOp.removeAllDataSize, out);
    EntryVersionsList versionTags = new EntryVersionsList(this.removeAllOp.removeAllDataSize);
    boolean hasTags = false;
    final RemoveAllEntryData[] removeAllData = this.removeAllOp.getRemoveAllEntryData();
    for (int i = 0; i < this.removeAllOp.removeAllDataSize; i++) {
        if (!hasTags && removeAllData[i].versionTag != null) {
            hasTags = true;
        }
        VersionTag<?> tag = removeAllData[i].versionTag;
        versionTags.add(tag);
        removeAllData[i].versionTag = null;
        removeAllData[i].toData(out);
        removeAllData[i].versionTag = tag;
    }
    out.writeBoolean(hasTags);
    if (hasTags) {
        InternalDataSerializer.invokeToData(versionTags, out);
    }
}
Also used : EntryVersionsList(org.apache.geode.internal.cache.DistributedPutAllOperation.EntryVersionsList) RemoveAllEntryData(org.apache.geode.internal.cache.DistributedRemoveAllOperation.RemoveAllEntryData)

Aggregations

EntryVersionsList (org.apache.geode.internal.cache.DistributedPutAllOperation.EntryVersionsList)12 ByteArrayDataInput (org.apache.geode.internal.ByteArrayDataInput)6 Version (org.apache.geode.internal.Version)6 PutAllEntryData (org.apache.geode.internal.cache.DistributedPutAllOperation.PutAllEntryData)4 RemoveAllEntryData (org.apache.geode.internal.cache.DistributedRemoveAllOperation.RemoveAllEntryData)4 EntryEventImpl (org.apache.geode.internal.cache.EntryEventImpl)2 DistributedPutAllOperation (org.apache.geode.internal.cache.DistributedPutAllOperation)1 DistributedRemoveAllOperation (org.apache.geode.internal.cache.DistributedRemoveAllOperation)1