Search in sources :

Example 6 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 7 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 8 with EntryVersionsList

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

the class DistTxEntryEvent method putAllToData.

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

Example 9 with EntryVersionsList

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

the class DistTxEntryEvent method putAllFromData.

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

Example 10 with EntryVersionsList

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

the class PutAllPRMessage method toData.

@Override
public void toData(DataOutput out) throws IOException {
    super.toData(out);
    if (bucketId == null) {
        InternalDataSerializer.writeSignedVL(-1, out);
    } else {
        InternalDataSerializer.writeSignedVL(bucketId, out);
    }
    if (this.bridgeContext != null) {
        DataSerializer.writeObject(this.bridgeContext, out);
    }
    DataSerializer.writeObject(this.callbackArg, out);
    InternalDataSerializer.writeUnsignedVL(this.putAllPRDataSize, out);
    if (this.putAllPRDataSize > 0) {
        EntryVersionsList versionTags = new EntryVersionsList(putAllPRDataSize);
        boolean hasTags = false;
        for (int i = 0; i < this.putAllPRDataSize; i++) {
            // If sender's version is >= 7.0.1 then we can send versions list.
            if (!hasTags && putAllPRData[i].versionTag != null) {
                hasTags = true;
            }
            VersionTag<?> tag = putAllPRData[i].versionTag;
            versionTags.add(tag);
            putAllPRData[i].versionTag = null;
            putAllPRData[i].toData(out);
            putAllPRData[i].versionTag = tag;
        // PutAllEntryData'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)

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