syntax = "proto3"; package state.v1; import "google/protobuf/timestamp.proto"; import "state/v1/types.proto"; service DispatchService { rpc ListDispatches(ListDispatchesRequest) returns (ListDispatchesResponse); rpc RecordDispatch(RecordDispatchRequest) returns (RecordDispatchResponse); // Playbook dispatch ledger (eda-playbook-engine.md gap 2): one durable // at-most-once record per (playbook, version, event, action) for the // side-effecting positions. Administrative, like RecordDispatch: a // task-scoped grant cannot reach either (see TaskGrants). rpc RecordPlaybookDispatch(RecordPlaybookDispatchRequest) returns (RecordPlaybookDispatchResponse); rpc DeletePlaybookDispatches(DeletePlaybookDispatchesRequest) returns (DeletePlaybookDispatchesResponse); // BindingTaskCreator: claims the binding's dispatch of a capture and // enqueues its task in one transaction, so a failure leaves neither and a // replayed delivery is refused with AlreadyExists. rpc EnqueueBindingTask(EnqueueBindingTaskRequest) returns (EnqueueBindingTaskResponse); } message RecordDispatchRequest { string binding_id = 1; int64 binding_version = 2; string capture_id = 3; // task_id addresses the tasks table. int64 task_id = 4; // reason is empty for a dispatch and names why an evaluated capture // started no task. string reason = 5; } message RecordDispatchResponse {} // ListDispatchesRequest filters the binding dispatch ledger; empty fields // match any row. message ListDispatchesRequest { string binding_id = 1; string capture_id = 2; int64 task_id = 3; int32 limit = 4; } message Dispatch { string binding_id = 1; int64 binding_version = 2; string capture_id = 3; int64 task_id = 4; string reason = 5; google.protobuf.Timestamp dispatched_at = 6; } message ListDispatchesResponse { repeated Dispatch dispatches = 1; } message RecordPlaybookDispatchRequest { string playbook_id = 1; string playbook_version = 2; string event_id = 3; string action_id = 4; } message RecordPlaybookDispatchResponse {} message DeletePlaybookDispatchesRequest { string playbook_id = 1; } message DeletePlaybookDispatchesResponse {} message EnqueueBindingTaskRequest { string owner = 1; string repo = 2; string title = 3; string body = 4; string workflow = 5; string identity = 6; string binding_id = 7; int64 binding_version = 8; string inputs_json = 9; string capture_id = 10; } message EnqueueBindingTaskResponse { Task task = 1; }