本文整理汇总了Java中org.apache.cassandra.utils.UUIDSerializer类的典型用法代码示例。如果您正苦于以下问题:Java UUIDSerializer类的具体用法?Java UUIDSerializer怎么用?Java UUIDSerializer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UUIDSerializer类属于org.apache.cassandra.utils包,在下文中一共展示了UUIDSerializer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deserialize
import org.apache.cassandra.utils.UUIDSerializer; //导入依赖的package包/类
public PrepareResponse deserialize(DataInput in, int version) throws IOException
{
boolean success = in.readBoolean();
ByteBuffer key = ByteBufferUtil.readWithShortLength(in);
return new PrepareResponse(success,
new Commit(key,
UUIDSerializer.serializer.deserialize(in, version),
ColumnFamily.serializer.deserialize(in,
ArrayBackedSortedColumns.factory,
ColumnSerializer.Flag.LOCAL, version)),
new Commit(key,
UUIDSerializer.serializer.deserialize(in, version),
ColumnFamily.serializer.deserialize(in,
ArrayBackedSortedColumns.factory,
ColumnSerializer.Flag.LOCAL, version)));
}
示例2: serialize
import org.apache.cassandra.utils.UUIDSerializer; //导入依赖的package包/类
public void serialize(FileMessageHeader header, DataOutputPlus out, int version) throws IOException
{
UUIDSerializer.serializer.serialize(header.cfId, out, version);
out.writeInt(header.sequenceNumber);
out.writeUTF(header.version);
out.writeLong(header.estimatedKeys);
out.writeInt(header.sections.size());
for (Pair<Long, Long> section : header.sections)
{
out.writeLong(section.left);
out.writeLong(section.right);
}
CompressionInfo.serializer.serialize(header.compressionInfo, out, version);
out.writeLong(header.repairedAt);
}
示例3: serializedSize
import org.apache.cassandra.utils.UUIDSerializer; //导入依赖的package包/类
public long serializedSize(FileMessageHeader header, int version)
{
long size = UUIDSerializer.serializer.serializedSize(header.cfId, version);
size += TypeSizes.NATIVE.sizeof(header.sequenceNumber);
size += TypeSizes.NATIVE.sizeof(header.version);
size += TypeSizes.NATIVE.sizeof(header.estimatedKeys);
size += TypeSizes.NATIVE.sizeof(header.sections.size());
for (Pair<Long, Long> section : header.sections)
{
size += TypeSizes.NATIVE.sizeof(section.left);
size += TypeSizes.NATIVE.sizeof(section.right);
}
size += CompressionInfo.serializer.serializedSize(header.compressionInfo, version);
return size;
}
示例4: deserialize
import org.apache.cassandra.utils.UUIDSerializer; //导入依赖的package包/类
public HintMessage deserialize(DataInputPlus in, int version) throws IOException
{
UUID hostId = UUIDSerializer.serializer.deserialize(in, version);
long hintSize = in.readUnsignedVInt();
TrackedDataInputPlus countingIn = new TrackedDataInputPlus(in);
try
{
return new HintMessage(hostId, Hint.serializer.deserialize(countingIn, version));
}
catch (UnknownColumnFamilyException e)
{
in.skipBytes(Ints.checkedCast(hintSize - countingIn.getBytesRead()));
return new HintMessage(hostId, e.cfId);
}
}
示例5: deserialize
import org.apache.cassandra.utils.UUIDSerializer; //导入依赖的package包/类
public PrepareResponse deserialize(DataInputPlus in, int version) throws IOException
{
boolean success = in.readBoolean();
Commit inProgress = Commit.serializer.deserialize(in, version);
Commit mostRecent;
if (version < MessagingService.VERSION_30)
{
UUID ballot = UUIDSerializer.serializer.deserialize(in, version);
PartitionUpdate update = PartitionUpdate.serializer.deserialize(in, version, SerializationHelper.Flag.LOCAL, inProgress.update.partitionKey());
mostRecent = new Commit(ballot, update);
}
else
{
mostRecent = Commit.serializer.deserialize(in, version);
}
return new PrepareResponse(success, inProgress, mostRecent);
}
示例6: serializedSize
import org.apache.cassandra.utils.UUIDSerializer; //导入依赖的package包/类
public long serializedSize(PrepareResponse response, int version)
{
long size = TypeSizes.sizeof(response.promised)
+ Commit.serializer.serializedSize(response.inProgressCommit, version);
if (version < MessagingService.VERSION_30)
{
size += UUIDSerializer.serializer.serializedSize(response.mostRecentCommit.ballot, version);
size += PartitionUpdate.serializer.serializedSize(response.mostRecentCommit.update, version);
}
else
{
size += Commit.serializer.serializedSize(response.mostRecentCommit, version);
}
return size;
}
示例7: serialize
import org.apache.cassandra.utils.UUIDSerializer; //导入依赖的package包/类
public void serialize(RepairJobDesc desc, DataOutputPlus out, int version) throws IOException
{
if (version >= MessagingService.VERSION_21)
{
out.writeBoolean(desc.parentSessionId != null);
if (desc.parentSessionId != null)
UUIDSerializer.serializer.serialize(desc.parentSessionId, out, version);
}
UUIDSerializer.serializer.serialize(desc.sessionId, out, version);
out.writeUTF(desc.keyspace);
out.writeUTF(desc.columnFamily);
MessagingService.validatePartitioner(desc.ranges);
out.writeInt(desc.ranges.size());
for (Range<Token> rt : desc.ranges)
AbstractBounds.tokenSerializer.serialize(rt, out, version);
}
示例8: deserialize
import org.apache.cassandra.utils.UUIDSerializer; //导入依赖的package包/类
public RepairJobDesc deserialize(DataInputPlus in, int version) throws IOException
{
UUID parentSessionId = null;
if (version >= MessagingService.VERSION_21)
{
if (in.readBoolean())
parentSessionId = UUIDSerializer.serializer.deserialize(in, version);
}
UUID sessionId = UUIDSerializer.serializer.deserialize(in, version);
String keyspace = in.readUTF();
String columnFamily = in.readUTF();
int nRanges = in.readInt();
Collection<Range<Token>> ranges = new ArrayList<>();
Range<Token> range;
for (int i = 0; i < nRanges; i++)
{
range = (Range<Token>) AbstractBounds.tokenSerializer.deserialize(in,
MessagingService.globalPartitioner(), version);
ranges.add(range);
}
return new RepairJobDesc(parentSessionId, sessionId, keyspace, columnFamily, ranges);
}
示例9: serializedSize
import org.apache.cassandra.utils.UUIDSerializer; //导入依赖的package包/类
public long serializedSize(RepairJobDesc desc, int version)
{
int size = 0;
if (version >= MessagingService.VERSION_21)
{
size += TypeSizes.sizeof(desc.parentSessionId != null);
if (desc.parentSessionId != null)
size += UUIDSerializer.serializer.serializedSize(desc.parentSessionId, version);
}
size += UUIDSerializer.serializer.serializedSize(desc.sessionId, version);
size += TypeSizes.sizeof(desc.keyspace);
size += TypeSizes.sizeof(desc.columnFamily);
size += TypeSizes.sizeof(desc.ranges.size());
for (Range<Token> rt : desc.ranges)
{
size += AbstractBounds.tokenSerializer.serializedSize(rt, version);
}
return size;
}
示例10: serialize
import org.apache.cassandra.utils.UUIDSerializer; //导入依赖的package包/类
public void serialize(PrepareMessage message, DataOutputPlus out, int version) throws IOException
{
out.writeInt(message.cfIds.size());
for (UUID cfId : message.cfIds)
UUIDSerializer.serializer.serialize(cfId, out, version);
UUIDSerializer.serializer.serialize(message.parentRepairSession, out, version);
out.writeInt(message.ranges.size());
for (Range<Token> r : message.ranges)
{
MessagingService.validatePartitioner(r);
Range.tokenSerializer.serialize(r, out, version);
}
out.writeBoolean(message.isIncremental);
out.writeLong(message.timestamp);
out.writeBoolean(message.isGlobal);
}
示例11: deserialize
import org.apache.cassandra.utils.UUIDSerializer; //导入依赖的package包/类
public PrepareMessage deserialize(DataInputPlus in, int version) throws IOException
{
int cfIdCount = in.readInt();
List<UUID> cfIds = new ArrayList<>(cfIdCount);
for (int i = 0; i < cfIdCount; i++)
cfIds.add(UUIDSerializer.serializer.deserialize(in, version));
UUID parentRepairSession = UUIDSerializer.serializer.deserialize(in, version);
int rangeCount = in.readInt();
List<Range<Token>> ranges = new ArrayList<>(rangeCount);
for (int i = 0; i < rangeCount; i++)
ranges.add((Range<Token>) Range.tokenSerializer.deserialize(in, MessagingService.globalPartitioner(), version));
boolean isIncremental = in.readBoolean();
long timestamp = in.readLong();
boolean isGlobal = in.readBoolean();
return new PrepareMessage(parentRepairSession, cfIds, ranges, isIncremental, timestamp, isGlobal);
}
示例12: deserialize
import org.apache.cassandra.utils.UUIDSerializer; //导入依赖的package包/类
public FileMessageHeader deserialize(DataInputPlus in, int version) throws IOException
{
UUID cfId = UUIDSerializer.serializer.deserialize(in, MessagingService.current_version);
int sequenceNumber = in.readInt();
Version sstableVersion = DatabaseDescriptor.getSSTableFormat().info.getVersion(in.readUTF());
SSTableFormat.Type format = SSTableFormat.Type.LEGACY;
if (version >= StreamMessage.VERSION_22)
format = SSTableFormat.Type.validate(in.readUTF());
long estimatedKeys = in.readLong();
int count = in.readInt();
List<Pair<Long, Long>> sections = new ArrayList<>(count);
for (int k = 0; k < count; k++)
sections.add(Pair.create(in.readLong(), in.readLong()));
CompressionInfo compressionInfo = CompressionInfo.serializer.deserialize(in, MessagingService.current_version);
long repairedAt = in.readLong();
int sstableLevel = in.readInt();
SerializationHeader.Component header = version >= StreamMessage.VERSION_30 && sstableVersion.storeRows()
? SerializationHeader.serializer.deserialize(sstableVersion, in)
: null;
return new FileMessageHeader(cfId, sequenceNumber, sstableVersion, format, estimatedKeys, sections, compressionInfo, repairedAt, sstableLevel, header);
}
示例13: serializedSize
import org.apache.cassandra.utils.UUIDSerializer; //导入依赖的package包/类
public long serializedSize(FileMessageHeader header, int version)
{
long size = UUIDSerializer.serializer.serializedSize(header.cfId, version);
size += TypeSizes.sizeof(header.sequenceNumber);
size += TypeSizes.sizeof(header.version.toString());
if (version >= StreamMessage.VERSION_22)
size += TypeSizes.sizeof(header.format.name);
size += TypeSizes.sizeof(header.estimatedKeys);
size += TypeSizes.sizeof(header.sections.size());
for (Pair<Long, Long> section : header.sections)
{
size += TypeSizes.sizeof(section.left);
size += TypeSizes.sizeof(section.right);
}
size += CompressionInfo.serializer.serializedSize(header.compressionInfo, version);
size += TypeSizes.sizeof(header.sstableLevel);
if (version >= StreamMessage.VERSION_30)
size += SerializationHeader.serializer.serializedSize(header.version, header.header);
return size;
}
示例14: serialize
import org.apache.cassandra.utils.UUIDSerializer; //导入依赖的package包/类
public void serialize(StreamRequest srm, DataOutput dos, int version) throws IOException
{
UUIDSerializer.serializer.serialize(srm.sessionId, dos, MessagingService.current_version);
CompactEndpointSerializationHelper.serialize(srm.target, dos);
if (srm.file != null)
{
dos.writeBoolean(true);
PendingFile.serializer.serialize(srm.file, dos, version);
}
else
{
dos.writeBoolean(false);
dos.writeUTF(srm.table);
dos.writeInt(srm.ranges.size());
for (Range<Token> range : srm.ranges)
AbstractBounds.serializer.serialize(range, dos, version);
dos.writeUTF(srm.type.name());
dos.writeInt(Iterables.size(srm.columnFamilies));
for (ColumnFamilyStore cfs : srm.columnFamilies)
ColumnFamily.serializer.serializeCfId(cfs.metadata.cfId, dos, version);
}
}
示例15: deserialize
import org.apache.cassandra.utils.UUIDSerializer; //导入依赖的package包/类
public CFMetaData deserialize(DataInputPlus in, int version) throws IOException
{
UUID cfId = UUIDSerializer.serializer.deserialize(in, version);
CFMetaData metadata = Schema.instance.getCFMetaData(cfId);
if (metadata == null)
{
String message = String.format("Couldn't find table for cfId %s. If a table was just " +
"created, this is likely due to the schema not being fully propagated. Please wait for schema " +
"agreement on table creation.", cfId);
throw new UnknownColumnFamilyException(message, cfId);
}
return metadata;
}