本文整理汇总了Java中org.apache.cassandra.net.MessagingService.VERSION_20属性的典型用法代码示例。如果您正苦于以下问题:Java MessagingService.VERSION_20属性的具体用法?Java MessagingService.VERSION_20怎么用?Java MessagingService.VERSION_20使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.cassandra.net.MessagingService
的用法示例。
在下文中一共展示了MessagingService.VERSION_20属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deserialize
public ColumnFamily deserialize(DataInput in, ColumnFamily.Factory factory, ColumnSerializer.Flag flag, int version) throws IOException
{
if (!in.readBoolean())
return null;
ColumnFamily cf = factory.create(Schema.instance.getCFMetaData(deserializeCfId(in, version)));
if (cf.metadata().isSuper() && version < MessagingService.VERSION_20)
{
SuperColumns.deserializerSuperColumnFamily(in, cf, flag, version);
}
else
{
cf.delete(cf.getComparator().deletionInfoSerializer().deserialize(in, version));
ColumnSerializer columnSerializer = cf.getComparator().columnSerializer();
int size = in.readInt();
for (int i = 0; i < size; ++i)
cf.addColumn(columnSerializer.deserialize(in, flag));
}
return cf;
}
示例2: serializedSize
public long serializedSize(Mutation mutation, int version)
{
TypeSizes sizes = TypeSizes.NATIVE;
int size = 0;
if (version < MessagingService.VERSION_20)
size += sizes.sizeof(mutation.getKeyspaceName());
int keySize = mutation.key().remaining();
size += sizes.sizeof((short) keySize) + keySize;
size += sizes.sizeof(mutation.modifications.size());
for (Map.Entry<UUID,ColumnFamily> entry : mutation.modifications.entrySet())
size += ColumnFamily.serializer.serializedSize(entry.getValue(), TypeSizes.NATIVE, version);
return size;
}
示例3: deserialize
public ColumnFamily deserialize(DataInput in, ColumnFamily.Factory factory, ColumnSerializer.Flag flag, int version) throws IOException
{
if (!in.readBoolean())
return null;
ColumnFamily cf = factory.create(Schema.instance.getCFMetaData(deserializeCfId(in, version)));
if (cf.metadata().isSuper() && version < MessagingService.VERSION_20)
{
SuperColumns.deserializerSuperColumnFamily(in, cf, flag, version);
}
else
{
cf.delete(DeletionInfo.serializer().deserialize(in, version, cf.getComparator()));
ColumnSerializer columnSerializer = Column.serializer;
int size = in.readInt();
for (int i = 0; i < size; ++i)
cf.addColumn(columnSerializer.deserialize(in, flag));
}
return cf;
}
示例4: contentSerializedSize
public long contentSerializedSize(ColumnFamily cf, TypeSizes typeSizes, int version)
{
long size = 0L;
if (cf.metadata().isSuper() && version < MessagingService.VERSION_20)
{
size += SuperColumns.serializedSize(cf, typeSizes, version);
}
else
{
size += DeletionInfo.serializer().serializedSize(cf.deletionInfo(), typeSizes, version);
size += typeSizes.sizeof(cf.getColumnCount());
for (Column column : cf)
size += column.serializedSize(typeSizes);
}
return size;
}
示例5: serializedSize
public long serializedSize(RowMutation rm, int version)
{
TypeSizes sizes = TypeSizes.NATIVE;
int size = 0;
if (version < MessagingService.VERSION_20)
size += sizes.sizeof(rm.getKeyspaceName());
int keySize = rm.key().remaining();
size += sizes.sizeof((short) keySize) + keySize;
size += sizes.sizeof(rm.modifications.size());
for (Map.Entry<UUID,ColumnFamily> entry : rm.modifications.entrySet())
size += ColumnFamily.serializer.serializedSize(entry.getValue(), TypeSizes.NATIVE, version);
return size;
}
示例6: getMessagingVersion
public int getMessagingVersion()
{
switch (version)
{
case VERSION_12:
return MessagingService.VERSION_12;
case VERSION_20:
return MessagingService.VERSION_20;
case VERSION_21:
return MessagingService.VERSION_21;
case VERSION_22:
return MessagingService.VERSION_22;
case VERSION_30:
return MessagingService.VERSION_30;
default:
throw new IllegalStateException("Unknown commitlog version " + version);
}
}
示例7: serializedSize
public long serializedSize(Mutation mutation, int version)
{
int size = 0;
if (version < MessagingService.VERSION_20)
size += TypeSizes.sizeof(mutation.getKeyspaceName());
if (version < MessagingService.VERSION_30)
{
int keySize = mutation.key().getKey().remaining();
size += TypeSizes.sizeof((short) keySize) + keySize;
size += TypeSizes.sizeof(mutation.modifications.size());
}
else
{
size += TypeSizes.sizeofUnsignedVInt(mutation.modifications.size());
}
for (Map.Entry<UUID, PartitionUpdate> entry : mutation.modifications.entrySet())
size += PartitionUpdate.serializer.serializedSize(entry.getValue(), version);
return size;
}
示例8: enqueue
public synchronized void enqueue(MessageOut<?> message, int id) throws IOException {
long timestamp = System.currentTimeMillis();
out.writeInt(MessagingService.PROTOCOL_MAGIC);
if (targetVersion < MessagingService.VERSION_20)
out.writeUTF(String.valueOf(id));
else
out.writeInt(id);
out.writeInt((int) timestamp);
message.serialize(out, targetVersion);
out.flush();
}
示例9: markAlive
private void markAlive(final InetAddress addr, final EndpointState localState)
{
if (MessagingService.instance().getVersion(addr) < MessagingService.VERSION_20)
{
realMarkAlive(addr, localState);
return;
}
localState.markDead();
MessageOut<EchoMessage> echoMessage = new MessageOut<EchoMessage>(MessagingService.Verb.ECHO, new EchoMessage(), EchoMessage.serializer);
logger.trace("Sending a EchoMessage to {}", addr);
IAsyncCallback echoHandler = new IAsyncCallback()
{
public boolean isLatencyForSnitch()
{
return false;
}
public void response(MessageIn msg)
{
realMarkAlive(addr, localState);
}
};
MessagingService.instance().sendRR(echoMessage, addr, echoHandler);
}
示例10: getMessagingVersion
public int getMessagingVersion()
{
switch (version)
{
case VERSION_12:
return MessagingService.VERSION_12;
case VERSION_20:
return MessagingService.VERSION_20;
case VERSION_21:
return MessagingService.VERSION_21;
default:
throw new IllegalStateException("Unknown commitlog version " + version);
}
}
示例11: deserialize
public RangeTombstoneList deserialize(DataInput in, int version) throws IOException
{
int size = in.readInt();
if (size == 0)
return null;
RangeTombstoneList tombstones = new RangeTombstoneList(type, size);
for (int i = 0; i < size; i++)
{
Composite start = type.serializer().deserialize(in);
Composite end = type.serializer().deserialize(in);
int delTime = in.readInt();
long markedAt = in.readLong();
if (version >= MessagingService.VERSION_20)
{
tombstones.setInternal(i, start, end, markedAt, delTime);
}
else
{
/*
* The old implementation used to have range sorted by left value, but with potentially
* overlapping range. So we need to use the "slow" path.
*/
tombstones.add(start, end, markedAt, delTime);
}
}
// The "slow" path take care of updating the size, but not the fast one
if (version >= MessagingService.VERSION_20)
tombstones.size = size;
return tombstones;
}
示例12: deserialize
public RangeTombstoneList deserialize(DataInput in, int version, Comparator<ByteBuffer> comparator) throws IOException
{
int size = in.readInt();
if (size == 0)
return null;
RangeTombstoneList tombstones = new RangeTombstoneList(comparator, size);
for (int i = 0; i < size; i++)
{
ByteBuffer start = ByteBufferUtil.readWithShortLength(in);
ByteBuffer end = ByteBufferUtil.readWithShortLength(in);
int delTime = in.readInt();
long markedAt = in.readLong();
if (version >= MessagingService.VERSION_20)
{
tombstones.setInternal(i, start, end, markedAt, delTime);
}
else
{
/*
* The old implementation used to have range sorted by left value, but with potentially
* overlapping range. So we need to use the "slow" path.
*/
tombstones.add(start, end, markedAt, delTime);
}
}
// The "slow" path take care of updating the size, but not the fast one
if (version >= MessagingService.VERSION_20)
tombstones.size = size;
return tombstones;
}
示例13: markAlive
private void markAlive(final InetAddress addr, final EndpointState localState)
{
if (MessagingService.instance().getVersion(addr) < MessagingService.VERSION_20)
{
realMarkAlive(addr, localState);
return;
}
localState.markDead();
MessageOut<EchoMessage> echoMessage = new MessageOut<EchoMessage>(MessagingService.Verb.ECHO, EchoMessage.instance, EchoMessage.serializer);
logger.trace("Sending a EchoMessage to {}", addr);
IAsyncCallback echoHandler = new IAsyncCallback()
{
public boolean isLatencyForSnitch()
{
return false;
}
public void response(MessageIn msg)
{
realMarkAlive(addr, localState);
}
};
MessagingService.instance().sendRR(echoMessage, addr, echoHandler);
}