// Copyright 2023 Dolthub, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package dolt.services.replicationapi.v1alpha1;

option go_package = "github.com/dolthub/dolt/go/gen/proto/dolt/services/replicationapi/v1alpha1;replicationapi";

service ReplicationService {
  // Users and grants in Dolt are stored in in a
  // `github.com/dolthub/go-mysql-server/sql/mysql_db.*MySQLDb` instance. This
  // method is called by a primary on a standby instance in order to set its
  // in-effect users and grants. Its primary payload is the serialized contents
  // of the `*MySQLDb` instance at the primary, such that it can be applied
  // with OverwriteUsersAndGrantData.
  rpc UpdateUsersAndGrants(UpdateUsersAndGrantsRequest) returns (UpdateUsersAndGrantsResponse);

  rpc UpdateBranchControl(UpdateBranchControlRequest) returns (UpdateBranchControlResponse);

  rpc DropDatabase(DropDatabaseRequest) returns (DropDatabaseResponse);
}

message UpdateUsersAndGrantsRequest {
  // The contents of the *MySQLDb instance, as seen by a Persister
  // implementation.
  bytes serialized_contents = 1;
}

message UpdateUsersAndGrantsResponse {
}

message UpdateBranchControlRequest {
  // The serialized contents of the branch_control.Controller.
  bytes serialized_contents = 1;
}

message UpdateBranchControlResponse {
}

message DropDatabaseRequest {
  // The name of the database to be dropped.
  string name = 1;
}

message DropDatabaseResponse {
}
