dactor 0.3.1

An abstract framework for distributed actors in Rust
Documentation
// dactor system message protobuf schemas.
//
// These define the binary wire format for all system-level messages exchanged
// between nodes. Application messages remain pluggable via MessageSerializer.
//
// ⚠️  WIRE PROTOCOL — field numbers are frozen once released.
// Adding new fields is safe (use the next available number).
// Removing or renumbering existing fields breaks compatibility.

syntax = "proto3";

package dactor.system;

// ---------------------------------------------------------------------------
// Shared types
// ---------------------------------------------------------------------------

message ActorIdProto {
    string node_id = 1;
    uint64 local = 2;
}

// ---------------------------------------------------------------------------
// Spawn
// ---------------------------------------------------------------------------

message SpawnRequestProto {
    string type_name = 1;
    bytes args_bytes = 2;
    string name = 3;
    string request_id = 4;
}

message SpawnResponseProto {
    oneof result {
        SpawnSuccessProto success = 1;
        SpawnFailureProto failure = 2;
    }
}

message SpawnSuccessProto {
    string request_id = 1;
    ActorIdProto actor_id = 2;
}

message SpawnFailureProto {
    string request_id = 1;
    string error = 2;
}

// ---------------------------------------------------------------------------
// Watch / Unwatch
// ---------------------------------------------------------------------------

message WatchRequestProto {
    ActorIdProto target = 1;
    ActorIdProto watcher = 2;
}

message UnwatchRequestProto {
    ActorIdProto target = 1;
    ActorIdProto watcher = 2;
}

message WatchNotificationProto {
    ActorIdProto terminated = 1;
    ActorIdProto watcher = 2;
}

// ---------------------------------------------------------------------------
// Cancel
// ---------------------------------------------------------------------------

message CancelRequestProto {
    ActorIdProto target = 1;
    // Optional: only present when cancelling a specific request.
    // Omitted when cancelling all operations for the target actor.
    optional string request_id = 2;
}

message CancelResponseProto {
    oneof result {
        CancelAcknowledgedProto acknowledged = 1;
        CancelNotFoundProto not_found = 2;
    }
}

message CancelAcknowledgedProto {}

message CancelNotFoundProto {
    string reason = 1;
}

// ---------------------------------------------------------------------------
// Peer management
// ---------------------------------------------------------------------------

message ConnectPeerProto {
    string node_id = 1;
    optional string address = 2;
}

message DisconnectPeerProto {
    string node_id = 1;
}

// ---------------------------------------------------------------------------
// Handshake (version compatibility)
// ---------------------------------------------------------------------------

message HandshakeRequestProto {
    string node_id = 1;
    string wire_version = 2;
    optional string app_version = 3;
    string adapter = 4;
}

enum RejectionReasonProto {
    REJECTION_REASON_INCOMPATIBLE_PROTOCOL = 0;
    REJECTION_REASON_INCOMPATIBLE_ADAPTER = 1;
}

message HandshakeResponseProto {
    oneof result {
        HandshakeAcceptedProto accepted = 1;
        HandshakeRejectedProto rejected = 2;
    }
}

message HandshakeAcceptedProto {
    string node_id = 1;
    string wire_version = 2;
    optional string app_version = 3;
    string adapter = 4;
}

message HandshakeRejectedProto {
    string node_id = 1;
    string wire_version = 2;
    RejectionReasonProto reason = 3;
    string detail = 4;
}

// ---------------------------------------------------------------------------
// WireEnvelope framing
// ---------------------------------------------------------------------------

enum SendModeProto {
    SEND_MODE_TELL = 0;
    SEND_MODE_ASK = 1;
    SEND_MODE_EXPAND = 2;
    SEND_MODE_REDUCE = 3;
    SEND_MODE_TRANSFORM = 4;
}

message WireEnvelopeProto {
    ActorIdProto target = 1;
    string target_name = 2;
    string message_type = 3;
    SendModeProto send_mode = 4;
    map<string, bytes> headers = 5;
    bytes body = 6;
    // Must be RFC 4122 UUID format if present (e.g. "550e8400-e29b-41d4-a716-446655440000").
    optional string request_id = 7;
    optional uint32 version = 8;
}