package com.a.eye.skywalking.messages;

import com.a.eye.skywalking.trace.TraceSegment;

/**
 * All messages, which need to send between Akka actors, should implement this interface.
 * The whole {@link TraceSegment} supports this.
 *
 * T should be a protobuf Object, which is generated by protoc.
 * {@see /sky-walking/skywalking-commons/skywalking-trace/src/main/proto/trace.proto}
 *
 * {@see https://github.com/google/protobuf/tree/master/java}
 *
 * Created by wusheng on 2017/2/22.
 */
public interface ISerializable<T> {
    /**
     * Serialize this object to T
     * @return
     */
    T serialize();

    /**
     * Initialize this object by the given message.
     *
     * @param message to init object.
     */
    void deserialize(T message);
}
