/**
 * Copyright (C) 2009-2013 Typesafe Inc. <http://www.typesafe.com>
 */

option java_package = "akka.remote";
option optimize_for = SPEED;

/******************************************
  Compile with:
  cd ./akka-remote/src/main/protocol
  protoc RemoteProtocol.proto --java_out ../java
  cd ../../../..
  ./scripts/fix-protobuf.sh
*******************************************/

message AkkaRemoteProtocol {
  optional bytes payload = 1;
  optional RemoteControlProtocol instruction = 2;
}

/**
 * Defines a remote message.
 */
message RemoteMessageProtocol {
  required ActorRefProtocol recipient = 1;
  required MessageProtocol message = 2;
  optional ActorRefProtocol sender = 4;
  repeated MetadataEntryProtocol metadata = 5;
}

/**
 * Defines some control messages for the remoting
 */
message RemoteControlProtocol {
  required CommandType commandType = 1;
  optional string cookie = 2;
  optional AddressProtocol origin = 3;
}

/**
 * Defines the type of the RemoteControlProtocol command type
 */
enum CommandType {
  CONNECT = 1;
  SHUTDOWN = 2;
  HEARTBEAT = 3;
}

/**
 * Defines a remote ActorRef that "remembers" and uses its original Actor instance
 * on the original node.
 */
message ActorRefProtocol {
  required string path = 1;
}

/**
 * Defines a message.
 */
message MessageProtocol {
  required bytes message = 1;
  required int32 serializerId = 2;
  optional bytes messageManifest = 3;
}

/**
 * Defines a meta data entry.
 */
message MetadataEntryProtocol {
  required string key = 1;
  required bytes value = 2;
}

/**
 * Defines a remote address.
 */
message AddressProtocol {
  required string system = 1;
  required string hostname = 2;
  required uint32 port = 3;
  optional string protocol = 4;
}

/**
 * Defines akka.remote.DaemonMsgCreate
 */
message DaemonMsgCreateProtocol {
  required PropsProtocol props = 1;
  required DeployProtocol deploy = 2;
  required string path = 3;
  required ActorRefProtocol supervisor = 4;
}

/**
 * Serialization of akka.actor.Props
 */
message PropsProtocol {
  required string dispatcher = 1;
  required DeployProtocol deploy = 2;
  optional string fromClassCreator = 3;
  optional bytes creator = 4;
  optional bytes routerConfig = 5;
}

/**
 * Serialization of akka.actor.Deploy
 */
message DeployProtocol {
  required string path = 1;
  optional bytes config = 2;
  optional bytes routerConfig = 3;
  optional bytes scope = 4;
}
