当前位置: 首页>>代码示例>>Java>>正文


Java IVersionedSerializer类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:19,代码来源:FBUtilities.java

示例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);
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:19,代码来源:FBUtilities.java

示例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());
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:9,代码来源:MessageOut.java

示例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;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:14,代码来源:WriteCallbackInfo.java

示例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;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:15,代码来源:CallbackInfo.java

示例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;
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:8,代码来源:CallbackInfo.java

示例7: delegate

import org.apache.cassandra.io.IVersionedSerializer; //导入依赖的package包/类
@Override
protected IVersionedSerializer<ReadResponse> delegate(int version)
{
    return version < MessagingService.VERSION_30
            ? legacyRangeSliceReplySerializer
            : serializer;
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:8,代码来源:ReadResponse.java

示例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());
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:11,代码来源:MessageOut.java

示例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()));
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:14,代码来源:WriteCallbackInfo.java

示例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);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:11,代码来源:ReadMessageTest.java

示例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();
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:11,代码来源:FBUtilities.java

示例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());
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:9,代码来源:MessageOut.java

示例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;
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:8,代码来源:CallbackInfo.java

示例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;
}
 
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:8,代码来源:WriteCallbackInfo.java


注:本文中的org.apache.cassandra.io.IVersionedSerializer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。