80 lines
2.9 KiB
Protocol Buffer
80 lines
2.9 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package state.v1;
|
|
|
|
import "google/protobuf/timestamp.proto";
|
|
|
|
service CaptureService {
|
|
// Capture refusals: events the network rules refused at the receiver,
|
|
// counted per source. Administrative.
|
|
rpc RecordCaptureRefusal(RecordCaptureRefusalRequest) returns (RecordCaptureRefusalResponse);
|
|
rpc ListCaptureRefusals(ListCaptureRefusalsRequest) returns (ListCaptureRefusalsResponse);
|
|
rpc InsertCapture(InsertCaptureRequest) returns (InsertCaptureResponse);
|
|
// StreamCaptures returns one capture per message: a batch of large capture
|
|
// bodies can exceed gRPC's 4MiB unary message cap
|
|
// (docs/prds/state-store-contract.md).
|
|
rpc StreamCaptures(StreamCapturesRequest) returns (stream StreamCapturesResponse);
|
|
rpc StreamUndispatchedCaptures(StreamUndispatchedCapturesRequest) returns (stream StreamUndispatchedCapturesResponse);
|
|
}
|
|
|
|
// CapturedEvent mirrors storecontract.CapturedEvent.
|
|
message CapturedEvent {
|
|
string id = 1;
|
|
google.protobuf.Timestamp received_at = 2;
|
|
string source = 3;
|
|
string remote_addr = 4;
|
|
string content_type = 5;
|
|
string headers = 6;
|
|
string body = 7;
|
|
bool authenticated = 8;
|
|
// event_type is the ID of the event type the capture was identified as on
|
|
// arrival; empty is unidentified.
|
|
string event_type = 9;
|
|
// unsigned marks an event taken on an approved unsigned source.
|
|
bool unsigned = 10;
|
|
// delivery names the sender's delivery; a retry of one delivery shares it.
|
|
// Intake sets it from the source's delivery header; empty takes the
|
|
// capture ID.
|
|
string delivery = 11;
|
|
// org_id names the organisation of a schedule-fired capture. Other
|
|
// captures take the org of their source and ignore it.
|
|
string org_id = 12;
|
|
}
|
|
message RecordCaptureRefusalRequest {
|
|
string source = 1;
|
|
string addr = 2;
|
|
google.protobuf.Timestamp refused_at = 3;
|
|
}
|
|
message RecordCaptureRefusalResponse {}
|
|
message ListCaptureRefusalsRequest { google.protobuf.Timestamp since = 1; }
|
|
message CaptureRefusals {
|
|
string source = 1;
|
|
int64 refused = 2;
|
|
int64 accepted = 3;
|
|
repeated string addrs = 4;
|
|
}
|
|
message ListCaptureRefusalsResponse { repeated CaptureRefusals sources = 1; }
|
|
message InsertCaptureRequest {
|
|
CapturedEvent capture = 1;
|
|
int64 retention_seconds = 2;
|
|
int64 max_events = 3;
|
|
}
|
|
message InsertCaptureResponse { string id = 1; }
|
|
message StreamCapturesRequest {
|
|
int64 limit = 1;
|
|
// workspace_id narrows the list to one workspace; empty lists every one.
|
|
string workspace_id = 2;
|
|
}
|
|
// Streamed one capture per message; see StreamCaptures above.
|
|
message StreamCapturesResponse { CapturedEvent capture = 1; }
|
|
message StreamUndispatchedCapturesRequest {
|
|
reserved 1;
|
|
reserved "sources";
|
|
// Bindings are the ids of the armed bindings, on enabled workflows, the
|
|
// captures are listed for.
|
|
repeated string bindings = 3;
|
|
int64 limit = 2;
|
|
}
|
|
// Streamed one capture per message; see StreamUndispatchedCaptures above.
|
|
message StreamUndispatchedCapturesResponse { CapturedEvent capture = 1; }
|