0
0
mirror of https://github.com/tursodatabase/libsql.git synced 2024-12-15 07:29:41 +00:00
libsql/libsql-replication/proto/replication_log.proto
2024-09-04 10:58:04 +02:00

52 lines
1.5 KiB
Protocol Buffer

syntax = "proto3";
package wal_log;
import "metadata.proto";
message LogOffset {
uint64 next_offset = 1;
enum WalFlavor {
Sqlite = 0;
Libsql = 1;
}
// the type of wal frames that the client is expecting
optional WalFlavor wal_flavor = 2;
}
message HelloRequest {
optional uint64 handshake_version = 1;
}
message HelloResponse {
/// Uuid of the current generation
string generation_id = 1;
/// First frame_no in the current generation
uint64 generation_start_index = 2;
/// id of the replicated log
string log_id = 3;
/// string-encoded Uuid v4 token for the current session, changes on each restart, and must be passed in subsequent requests header.string
/// If the header session token fails to match the current session token, a NO_HELLO error is returned
bytes session_token = 4;
optional uint64 current_replication_index = 5;
metadata.DatabaseConfig config = 6;
}
message Frame {
bytes data = 1;
// if this frames is a commit frame, then this can be set
// to the time when the transaction was commited
optional int64 timestamp = 2;
optional uint64 durable_frame_no = 3;
}
message Frames {
repeated Frame frames = 1;
}
service ReplicationLog {
rpc Hello(HelloRequest) returns (HelloResponse) {}
rpc LogEntries(LogOffset) returns (stream Frame) {}
rpc BatchLogEntries(LogOffset) returns (Frames) {}
rpc Snapshot(LogOffset) returns (stream Frame) {}
}