libsql_replication 0.9.30

Replication protocol for libSQL
Documentation
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) {}
}