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);
}
}
}
}
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);
}
}
}
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);
}
}
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);
}
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);
}
}
}
Aggregations