本文整理汇总了Java中org.apache.cassandra.io.IVersionedSerializer类的典型用法代码示例。如果您正苦于以下问题:Java IVersionedSerializer类的具体用法?Java IVersionedSerializer怎么用?Java IVersionedSerializer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IVersionedSerializer类属于org.apache.cassandra.io包,在下文中一共展示了IVersionedSerializer类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: serialize
import org.apache.cassandra.io.IVersionedSerializer; //导入依赖的package包/类
public static <T> byte[] serialize(T object, IVersionedSerializer<T> serializer, int version)
{
int size = (int) serializer.serializedSize(object, version);
try (DataOutputBuffer buffer = new DataOutputBufferFixed(size))
{
serializer.serialize(object, buffer, version);
assert buffer.getLength() == size && buffer.getData().length == size
: String.format("Final buffer length %s to accommodate data size of %s (predicted %s) for %s",
buffer.getData().length, buffer.getLength(), size, object);
return buffer.getData();
}
catch (IOException e)
{
// We're doing in-memory serialization...
throw new AssertionError(e);
}
}
示例2: serialize
import org.apache.cassandra.io.IVersionedSerializer; //导入依赖的package包/类
public static <T> byte[] serialize(T object, IVersionedSerializer<T> serializer, int version)
{
try
{
int size = (int) serializer.serializedSize(object, version);
DataOutputBuffer buffer = new DataOutputBuffer(size);
serializer.serialize(object, buffer, version);
assert buffer.getLength() == size && buffer.getData().length == size
: String.format("Final buffer length %s to accommodate data size of %s (predicted %s) for %s",
buffer.getData().length, buffer.getLength(), size, object);
return buffer.getData();
}
catch (IOException e)
{
// We're doing in-memory serialization...
throw new AssertionError(e);
}
}
示例3: MessageOut
import org.apache.cassandra.io.IVersionedSerializer; //导入依赖的package包/类
public MessageOut(MessagingService.Verb verb, T payload, IVersionedSerializer<T> serializer)
{
this(verb,
payload,
serializer,
isTracing() ? ImmutableMap.of(TRACE_HEADER, UUIDGen.decompose(Tracing.instance.getSessionId()))
: Collections.<String, byte[]>emptyMap());
}
示例4: WriteCallbackInfo
import org.apache.cassandra.io.IVersionedSerializer; //导入依赖的package包/类
public WriteCallbackInfo(InetAddress target,
IAsyncCallback callback,
MessageOut message,
IVersionedSerializer<?> serializer,
ConsistencyLevel consistencyLevel,
boolean allowHints)
{
super(target, callback, serializer);
assert message != null;
this.sentMessage = message;
this.consistencyLevel = consistencyLevel;
this.allowHints = allowHints;
}
示例5: CallbackInfo
import org.apache.cassandra.io.IVersionedSerializer; //导入依赖的package包/类
/**
* Create CallbackInfo without sent message
*
* @param target target to send message
* @param callback
* @param serializer serializer to deserialize response message
*/
public CallbackInfo(InetAddress target, IAsyncCallback callback, IVersionedSerializer<?> serializer, boolean failureCallback)
{
this.target = target;
this.callback = callback;
this.serializer = serializer;
this.failureCallback = failureCallback;
}
示例6: CallbackInfo
import org.apache.cassandra.io.IVersionedSerializer; //导入依赖的package包/类
public CallbackInfo(InetAddress target, IAsyncCallback callback, MessageOut<?> sentMessage, IVersionedSerializer<?> serializer)
{
this.target = target;
this.callback = callback;
this.sentMessage = sentMessage;
this.serializer = serializer;
}
示例7: delegate
import org.apache.cassandra.io.IVersionedSerializer; //导入依赖的package包/类
@Override
protected IVersionedSerializer<ReadResponse> delegate(int version)
{
return version < MessagingService.VERSION_30
? legacyRangeSliceReplySerializer
: serializer;
}
示例8: MessageOut
import org.apache.cassandra.io.IVersionedSerializer; //导入依赖的package包/类
public MessageOut(MessagingService.Verb verb, T payload, IVersionedSerializer<T> serializer)
{
this(verb,
payload,
serializer,
isTracing()
? ImmutableMap.of(TRACE_HEADER, UUIDGen.decompose(Tracing.instance.getSessionId()),
TRACE_TYPE, new byte[] { Tracing.TraceType.serialize(Tracing.instance.getTraceType()) })
: Collections.<String, byte[]>emptyMap());
}
示例9: WriteCallbackInfo
import org.apache.cassandra.io.IVersionedSerializer; //导入依赖的package包/类
public WriteCallbackInfo(InetAddress target,
IAsyncCallback callback,
MessageOut message,
IVersionedSerializer<?> serializer,
ConsistencyLevel consistencyLevel,
boolean allowHints)
{
super(target, callback, serializer, true);
assert message != null;
this.mutation = shouldHint(allowHints, message, consistencyLevel);
//Local writes shouldn't go through messaging service (https://issues.apache.org/jira/browse/CASSANDRA-10477)
assert (!target.equals(FBUtilities.getBroadcastAddress()));
}
示例10: serializeAndDeserializeReadMessage
import org.apache.cassandra.io.IVersionedSerializer; //导入依赖的package包/类
private ReadCommand serializeAndDeserializeReadMessage(ReadCommand rm) throws IOException
{
IVersionedSerializer<ReadCommand> rms = ReadCommand.serializer;
DataOutputBuffer out = new DataOutputBuffer();
rms.serialize(rm, out, MessagingService.current_version);
DataInputPlus dis = new DataInputBuffer(out.getData());
return rms.deserialize(dis, MessagingService.current_version);
}
示例11: serialize
import org.apache.cassandra.io.IVersionedSerializer; //导入依赖的package包/类
public static <T> byte[] serialize(T object, IVersionedSerializer<T> serializer, int version) throws IOException
{
int size = (int) serializer.serializedSize(object, version);
DataOutputBuffer buffer = new DataOutputBuffer(size);
serializer.serialize(object, buffer, version);
assert buffer.getLength() == size && buffer.getData().length == size
: String.format("Final buffer length %s to accommodate data size of %s (predicted %s) for %s",
buffer.getData().length, buffer.getLength(), size, object);
return buffer.getData();
}
示例12: MessageOut
import org.apache.cassandra.io.IVersionedSerializer; //导入依赖的package包/类
public MessageOut(MessagingService.Verb verb, T payload, IVersionedSerializer<T> serializer)
{
this(verb,
payload,
serializer,
isTracing() ? ImmutableMap.of(TRACE_HEADER, UUIDGen.decompose(Tracing.instance().getSessionId()))
: Collections.<String, byte[]>emptyMap());
}
示例13: CallbackInfo
import org.apache.cassandra.io.IVersionedSerializer; //导入依赖的package包/类
public CallbackInfo(InetAddress target, IMessageCallback callback, MessageOut<?> sentMessage, IVersionedSerializer<?> serializer)
{
this.target = target;
this.callback = callback;
this.sentMessage = sentMessage;
this.serializer = serializer;
}
示例14: WriteCallbackInfo
import org.apache.cassandra.io.IVersionedSerializer; //导入依赖的package包/类
public WriteCallbackInfo(InetAddress target, IAsyncCallback callback, MessageOut message, IVersionedSerializer<?> serializer, ConsistencyLevel consistencyLevel)
{
super(target, callback, serializer);
assert message != null;
this.sentMessage = message;
this.consistencyLevel = consistencyLevel;
}