org.apache.cassandra.io.IVersionedSerializer Java Examples
The following examples show how to use
org.apache.cassandra.io.IVersionedSerializer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FBUtilities.java From stratio-cassandra with Apache License 2.0 | 6 votes |
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); } }
Example #2
Source File: CallbackInfo.java From stratio-cassandra with Apache License 2.0 | 5 votes |
/** * 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; }
Example #3
Source File: WriteCallbackInfo.java From stratio-cassandra with Apache License 2.0 | 5 votes |
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; }
Example #4
Source File: MessageOut.java From stratio-cassandra with Apache License 2.0 | 5 votes |
@VisibleForTesting public MessageOut(InetAddress from, MessagingService.Verb verb, T payload, IVersionedSerializer<T> serializer, Map<String, byte[]> parameters) { this.from = from; this.verb = verb; this.payload = payload; this.serializer = serializer; this.parameters = parameters; }
Example #5
Source File: MessageOut.java From stratio-cassandra with Apache License 2.0 | 5 votes |
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()); }
Example #6
Source File: 1185675_ReadResponse_0_t.java From gumtree-spoon-ast-diff with Apache License 2.0 | 4 votes |
public static IVersionedSerializer<ReadResponse> serializer() { return serializer_; }
Example #7
Source File: 1185675_ReadResponse_0_s.java From gumtree-spoon-ast-diff with Apache License 2.0 | 4 votes |
public static IVersionedSerializer<ReadResponse> serializer() { return serializer_; }
Example #8
Source File: AbstractSerializationsTester.java From stratio-cassandra with Apache License 2.0 | 4 votes |
protected <T> void testSerializedSize(T obj, IVersionedSerializer<T> serializer) throws IOException { DataOutputBuffer out = new DataOutputBuffer(); serializer.serialize(obj, out, getVersion()); assert out.getLength() == serializer.serializedSize(obj, getVersion()); }
Example #9
Source File: CallbackInfo.java From stratio-cassandra with Apache License 2.0 | 4 votes |
public CallbackInfo(InetAddress target, IAsyncCallback callback, IVersionedSerializer<?> serializer) { this(target, callback, serializer, false); }
Example #10
Source File: MessageIn.java From stratio-cassandra with Apache License 2.0 | 4 votes |
public static <T2> MessageIn<T2> read(DataInput in, int version, int id) throws IOException { InetAddress from = CompactEndpointSerializationHelper.deserialize(in); MessagingService.Verb verb = MessagingService.Verb.values()[in.readInt()]; int parameterCount = in.readInt(); Map<String, byte[]> parameters; if (parameterCount == 0) { parameters = Collections.emptyMap(); } else { ImmutableMap.Builder<String, byte[]> builder = ImmutableMap.builder(); for (int i = 0; i < parameterCount; i++) { String key = in.readUTF(); byte[] value = new byte[in.readInt()]; in.readFully(value); builder.put(key, value); } parameters = builder.build(); } int payloadSize = in.readInt(); IVersionedSerializer<T2> serializer = (IVersionedSerializer<T2>) MessagingService.verbSerializers.get(verb); if (serializer instanceof MessagingService.CallbackDeterminedSerializer) { CallbackInfo callback = MessagingService.instance().getRegisteredCallback(id); if (callback == null) { // reply for expired callback. we'll have to skip it. FileUtils.skipBytesFully(in, payloadSize); return null; } serializer = (IVersionedSerializer<T2>) callback.serializer; } if (payloadSize == 0 || serializer == null) return create(from, null, parameters, verb, version); T2 payload = serializer.deserialize(in, version); return MessageIn.create(from, payload, parameters, verb, version); }
Example #11
Source File: MessageOut.java From stratio-cassandra with Apache License 2.0 | 4 votes |
private MessageOut(MessagingService.Verb verb, T payload, IVersionedSerializer<T> serializer, Map<String, byte[]> parameters) { this(FBUtilities.getBroadcastAddress(), verb, payload, serializer, parameters); }
Example #12
Source File: AbstractCType.java From stratio-cassandra with Apache License 2.0 | 4 votes |
public IVersionedSerializer<SliceQueryFilter> sliceQueryFilterSerializer() { return sliceQueryFilterSerializer; }
Example #13
Source File: AbstractCType.java From stratio-cassandra with Apache License 2.0 | 4 votes |
public IVersionedSerializer<ColumnSlice> sliceSerializer() { return sliceSerializer; }
Example #14
Source File: AbstractCellNameType.java From stratio-cassandra with Apache License 2.0 | 4 votes |
public IVersionedSerializer<IDiskAtomFilter> diskAtomFilterSerializer() { return diskAtomFilterSerializer; }
Example #15
Source File: AbstractCellNameType.java From stratio-cassandra with Apache License 2.0 | 4 votes |
public IVersionedSerializer<NamesQueryFilter> namesQueryFilterSerializer() { return namesQueryFilterSerializer; }
Example #16
Source File: CellNameType.java From stratio-cassandra with Apache License 2.0 | votes |
public IVersionedSerializer<IDiskAtomFilter> diskAtomFilterSerializer();
Example #17
Source File: CellNameType.java From stratio-cassandra with Apache License 2.0 | votes |
public IVersionedSerializer<NamesQueryFilter> namesQueryFilterSerializer();
Example #18
Source File: CType.java From stratio-cassandra with Apache License 2.0 | votes |
public IVersionedSerializer<SliceQueryFilter> sliceQueryFilterSerializer();
Example #19
Source File: CType.java From stratio-cassandra with Apache License 2.0 | votes |
public IVersionedSerializer<ColumnSlice> sliceSerializer();