本文整理汇总了Java中org.apache.cassandra.transport.CBUtil.sizeOfConsistencyLevel方法的典型用法代码示例。如果您正苦于以下问题:Java CBUtil.sizeOfConsistencyLevel方法的具体用法?Java CBUtil.sizeOfConsistencyLevel怎么用?Java CBUtil.sizeOfConsistencyLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.transport.CBUtil
的用法示例。
在下文中一共展示了CBUtil.sizeOfConsistencyLevel方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: encodedSize
import org.apache.cassandra.transport.CBUtil; //导入方法依赖的package包/类
public int encodedSize(QueryOptions options, ProtocolVersion version)
{
int size = 0;
size += CBUtil.sizeOfConsistencyLevel(options.getConsistency());
EnumSet<Flag> flags = gatherFlags(options);
size += (version.isGreaterOrEqualTo(ProtocolVersion.V5) ? 4 : 1);
if (flags.contains(Flag.VALUES))
size += CBUtil.sizeOfValueList(options.getValues());
if (flags.contains(Flag.PAGE_SIZE))
size += 4;
if (flags.contains(Flag.PAGING_STATE))
size += CBUtil.sizeOfValue(options.getPagingState().serializedSize(version));
if (flags.contains(Flag.SERIAL_CONSISTENCY))
size += CBUtil.sizeOfConsistencyLevel(options.getSerialConsistency());
if (flags.contains(Flag.TIMESTAMP))
size += 8;
return size;
}
示例2: encodedSize
import org.apache.cassandra.transport.CBUtil; //导入方法依赖的package包/类
public int encodedSize(QueryOptions options, int version)
{
int size = 0;
size += CBUtil.sizeOfConsistencyLevel(options.getConsistency());
EnumSet<Flag> flags = gatherFlags(options);
size += 1;
if (flags.contains(Flag.VALUES))
size += CBUtil.sizeOfValueList(options.getValues());
if (flags.contains(Flag.PAGE_SIZE))
size += 4;
if (flags.contains(Flag.PAGING_STATE))
size += CBUtil.sizeOfValue(options.getPagingState().serialize());
if (flags.contains(Flag.SERIAL_CONSISTENCY))
size += CBUtil.sizeOfConsistencyLevel(options.getSerialConsistency());
if (flags.contains(Flag.TIMESTAMP))
size += 8;
return size;
}
示例3: encodedSize
import org.apache.cassandra.transport.CBUtil; //导入方法依赖的package包/类
public int encodedSize(QueryOptions options, int version)
{
int size = 0;
size += CBUtil.sizeOfConsistencyLevel(options.getConsistency());
EnumSet<Flag> flags = gatherFlags(options);
size += 1;
if (flags.contains(Flag.VALUES))
size += CBUtil.sizeOfValueList(options.getValues());
if (flags.contains(Flag.PAGE_SIZE))
size += 4;
if (flags.contains(Flag.PAGING_STATE))
size += CBUtil.sizeOfValue(options.getPagingState().serialize());
if (flags.contains(Flag.SERIAL_CONSISTENCY))
size += CBUtil.sizeOfConsistencyLevel(options.getSerialConsistency());
return size;
}
示例4: encodedSize
import org.apache.cassandra.transport.CBUtil; //导入方法依赖的package包/类
public int encodedSize(QueryOptions options, int version)
{
int size = 0;
size += CBUtil.sizeOfConsistencyLevel(options.getConsistency());
EnumSet<Flag> flags = gatherFlags(options);
size += 1;
if (flags.contains(Flag.VALUES))
size += CBUtil.sizeOfValueList(options.getValues());
if (flags.contains(Flag.PAGE_SIZE))
size += 4;
if (flags.contains(Flag.PAGING_STATE))
size += CBUtil.sizeOfValue(options.getPagingState().serializedSize(version));
if (flags.contains(Flag.SERIAL_CONSISTENCY))
size += CBUtil.sizeOfConsistencyLevel(options.getSerialConsistency());
if (flags.contains(Flag.TIMESTAMP))
size += 8;
return size;
}
示例5: encodedSize
import org.apache.cassandra.transport.CBUtil; //导入方法依赖的package包/类
public int encodedSize(ErrorMessage msg, int version)
{
int size = 4 + CBUtil.sizeOfString(msg.error.getMessage());
switch (msg.error.code())
{
case UNAVAILABLE:
UnavailableException ue = (UnavailableException)msg.error;
size += CBUtil.sizeOfConsistencyLevel(ue.consistency) + 8;
break;
case WRITE_TIMEOUT:
case READ_TIMEOUT:
RequestTimeoutException rte = (RequestTimeoutException)msg.error;
boolean isWrite = msg.error.code() == ExceptionCode.WRITE_TIMEOUT;
size += CBUtil.sizeOfConsistencyLevel(rte.consistency) + 8;
size += isWrite ? CBUtil.sizeOfString(((WriteTimeoutException)rte).writeType.toString()) : 1;
break;
case UNPREPARED:
PreparedQueryNotFoundException pqnfe = (PreparedQueryNotFoundException)msg.error;
size += CBUtil.sizeOfBytes(pqnfe.id.bytes);
break;
case ALREADY_EXISTS:
AlreadyExistsException aee = (AlreadyExistsException)msg.error;
size += CBUtil.sizeOfString(aee.ksName);
size += CBUtil.sizeOfString(aee.cfName);
break;
}
return size;
}
示例6: encodedSize
import org.apache.cassandra.transport.CBUtil; //导入方法依赖的package包/类
public int encodedSize(QueryMessage msg, int version)
{
int size = CBUtil.sizeOfLongString(msg.query);
if (version == 1)
{
size += CBUtil.sizeOfConsistencyLevel(msg.options.getConsistency());
}
else
{
size += QueryOptions.codec.encodedSize(msg.options, version);
}
return size;
}