use of org.apache.cassandra.db.Column.EVTComparator in project eiger by wlloyd.
the class ColumnSerializer method deserialize.
@Override
public Column deserialize(DataInput dis, IColumnSerializer.Flag flag, int expireBefore) throws IOException {
ByteBuffer name = ByteBufferUtil.readWithShortLength(dis);
if (name.remaining() <= 0) {
String format = "invalid column name length %d%s";
String details = "";
if (dis instanceof FileDataInput) {
FileDataInput fdis = (FileDataInput) dis;
details = String.format(" (%s, %d bytes remaining)", fdis.getPath(), fdis.bytesRemaining());
}
throw new CorruptColumnException(String.format(format, name.remaining(), details));
}
int b = dis.readUnsignedByte();
if ((b & COUNTER_MASK) != 0) {
long timestampOfLastDelete = dis.readLong();
long ts = dis.readLong();
ByteBuffer value = ByteBufferUtil.readWithLength(dis);
Long lastAccessTime = dis.readLong();
if (lastAccessTime == Long.MIN_VALUE) {
lastAccessTime = null;
}
Long previousVersionLastAccessTime = dis.readLong();
if (previousVersionLastAccessTime == Long.MIN_VALUE) {
previousVersionLastAccessTime = null;
}
Long earliestValidTime = dis.readLong();
if (earliestValidTime == Long.MIN_VALUE) {
earliestValidTime = null;
}
Long latestValidTime = dis.readLong();
if (latestValidTime == Long.MIN_VALUE) {
latestValidTime = null;
}
NavigableSet<IColumn> previousVersions;
int previousVersionsLength = dis.readInt();
if (previousVersionsLength == -1) {
previousVersions = null;
} else {
previousVersions = new TreeSet<IColumn>(new EVTComparator());
for (int i = 0; i < previousVersionsLength; ++i) {
previousVersions.add(deserialize(dis));
}
}
int transactionCoordinatorKeyLength = dis.readInt();
ByteBuffer transactionCoordinatorKey = null;
if (transactionCoordinatorKeyLength > 0) {
ByteBufferUtil.readWithLength(dis);
}
return CounterColumn.create(name, value, ts, timestampOfLastDelete, flag, lastAccessTime, previousVersionLastAccessTime, earliestValidTime, latestValidTime, previousVersions);
} else if ((b & EXPIRATION_MASK) != 0) {
int ttl = dis.readInt();
int expiration = dis.readInt();
long ts = dis.readLong();
ByteBuffer value = ByteBufferUtil.readWithLength(dis);
Long lastAccessTime = dis.readLong();
if (lastAccessTime == Long.MIN_VALUE) {
lastAccessTime = null;
}
Long previousVersionLastAccessTime = dis.readLong();
if (previousVersionLastAccessTime == Long.MIN_VALUE) {
previousVersionLastAccessTime = null;
}
Long earliestValidTime = dis.readLong();
if (earliestValidTime == Long.MIN_VALUE) {
earliestValidTime = null;
}
Long latestValidTime = dis.readLong();
if (latestValidTime == Long.MIN_VALUE) {
latestValidTime = null;
}
SortedSet<IColumn> previousVersions;
int previousVersionsLength = dis.readInt();
if (previousVersionsLength == -1) {
previousVersions = null;
} else {
previousVersions = new TreeSet<IColumn>(new EVTComparator());
for (int i = 0; i < previousVersionsLength; ++i) {
previousVersions.add(deserialize(dis));
}
}
int transactionCoordinatorKeyLength = dis.readInt();
ByteBuffer transactionCoordinatorKey = null;
if (transactionCoordinatorKeyLength > 0) {
ByteBufferUtil.readWithLength(dis);
}
return ExpiringColumn.create(name, value, ts, ttl, expiration, expireBefore, flag);
} else {
long ts = dis.readLong();
ByteBuffer value = ByteBufferUtil.readWithLength(dis);
Long lastAccessTime = dis.readLong();
if (lastAccessTime == Long.MIN_VALUE) {
lastAccessTime = null;
}
Long previousVersionLastAccessTime = dis.readLong();
if (previousVersionLastAccessTime == Long.MIN_VALUE) {
previousVersionLastAccessTime = null;
}
Long earliestValidTime = dis.readLong();
if (earliestValidTime == Long.MIN_VALUE) {
earliestValidTime = null;
}
Long latestValidTime = dis.readLong();
if (latestValidTime == Long.MIN_VALUE) {
latestValidTime = null;
}
NavigableSet<IColumn> previousVersions;
int previousVersionsLength = dis.readInt();
if (previousVersionsLength == -1) {
previousVersions = null;
} else {
previousVersions = new TreeSet<IColumn>(new EVTComparator());
for (int i = 0; i < previousVersionsLength; ++i) {
previousVersions.add(deserialize(dis));
}
}
int transactionCoordinatorKeyLength = dis.readInt();
ByteBuffer transactionCoordinatorKey = null;
if (transactionCoordinatorKeyLength > 0) {
ByteBufferUtil.readWithLength(dis);
}
return (b & COUNTER_UPDATE_MASK) != 0 ? new CounterUpdateColumn(name, value, ts, lastAccessTime, previousVersionLastAccessTime, earliestValidTime, latestValidTime, previousVersions, transactionCoordinatorKey) : ((b & DELETION_MASK) != 0) ? new DeletedColumn(name, value, ts, lastAccessTime, previousVersionLastAccessTime, earliestValidTime, latestValidTime, previousVersions, transactionCoordinatorKey) : ((b & PENDING_TRANSACTION_MASK) != 0) ? new PendingTransactionColumn(name, value, ts, lastAccessTime, previousVersionLastAccessTime, earliestValidTime, latestValidTime, previousVersions, transactionCoordinatorKey) : new Column(name, value, ts, lastAccessTime, previousVersionLastAccessTime, earliestValidTime, latestValidTime, previousVersions, transactionCoordinatorKey);
}
}
Aggregations