syntax = "proto3";
package logservicepb;

option go_package = "github.com/pingcap/ticdc/logservicepb";

import "heartbeatpb/heartbeat.proto";

message SubscriptionState {
    uint64 SubID = 1;
    heartbeatpb.TableSpan Span = 2;
    uint64 CheckpointTs = 3;
    uint64 ResolvedTs = 4;
}

// TableState stores all subscription states for the same table
message TableState {
    repeated SubscriptionState Subscriptions = 1;
}

// EventStoreState stores a single node's event store state
message EventStoreState {
    // tableID -> TableState
    map<int64, TableState> TableStates = 1; 
}

message ChangefeedStateEntry {
    heartbeatpb.ChangefeedID ChangefeedID = 1;
    uint64 ResolvedTs = 2;
}

message ChangefeedStates {
    // A list of changefeed states.
    repeated ChangefeedStateEntry States = 1;
}

message ReusableEventServiceRequest {
    heartbeatpb.DispatcherID ID = 1;
    heartbeatpb.TableSpan Span = 2;
    uint64 StartTs = 3;
}

message ReusableEventServiceResponse {
    heartbeatpb.DispatcherID ID = 1;
    repeated string Nodes = 2;
}
