1
0
voyager-api/ScrapperAPI/Protos/agent.proto

67 lines
1.3 KiB
Protocol Buffer

syntax = "proto3";
option csharp_namespace = "ScrapperAPI.AgentGrpc";
package voyager.agent;
message RegisterAgentRequest {
string agent_id = 1;
string display_name = 2;
}
message RegisterAgentResponse {
bool ok = 1;
}
message HeartbeatRequest {
string agent_id = 1;
}
message HeartbeatResponse {
bool ok = 1;
}
message LeaseWorkRequest {
int32 session_id = 1;
string agent_id = 2;
int32 capacity = 3;
}
message LeaseWorkResponse {
repeated WorkItem items = 1;
int64 server_time_utc_ms = 2;
}
message WorkItem {
int32 queue_id = 1;
int32 session_id = 2;
string url = 3;
int64 lease_expires_utc_ms = 4;
}
message SubmitResultRequest {
int32 queue_id = 1;
string agent_id = 2;
bool success = 3;
string error = 4;
// Content: either plain text (content_text) or compressed bytes (content_bytes).
string content_text = 5;
bytes content_bytes = 6;
string content_encoding = 7; // e.g. "gzip"
int32 original_length = 8;
int32 compressed_length = 9;
}
message SubmitResultResponse {
bool ok = 1;
string message = 2;
}
service AgentService {
rpc RegisterAgent(RegisterAgentRequest) returns (RegisterAgentResponse);
rpc Heartbeat(HeartbeatRequest) returns (HeartbeatResponse);
rpc LeaseWork(LeaseWorkRequest) returns (LeaseWorkResponse);
rpc SubmitResult(SubmitResultRequest) returns (SubmitResultResponse);
}