syntax = "proto3";

package gitaly;

import "google/protobuf/descriptor.proto";

option go_package = "gitlab.com/gitlab-org/gitaly/v16/proto/go/gitalypb";

// OperationMsg ...
message OperationMsg {
  // Operation ...
  enum Operation {
    // UNKNOWN ...
    UNKNOWN = 0; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH
    // MUTATOR ...
    MUTATOR = 1; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX
    // ACCESSOR ...
    ACCESSOR = 2; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX
    // MAINTENANCE ...
    MAINTENANCE = 3; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX
  }

  // Scope ...
  enum Scope {
    // REPOSITORY ...
    REPOSITORY = 0; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH
    // STORAGE ...
    STORAGE = 2; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX

    reserved 1;
    reserved "SERVER";
  }

  // op ...
  Operation op = 1;

  // scope_level indicates what level an RPC interacts with a server:
  //   - REPOSITORY: scoped to only a single repo
  //   - SERVER: affects the entire server and potentially all repos
  //   - STORAGE: scoped to a specific storage location and all repos within
  Scope scope_level = 2;
}

extend google.protobuf.ServiceOptions {
  // intercepted indicates whether the proxy intercepts and handles the call
  // instead of proxying. Intercepted services do not require scope or operation
  // annotations.
  bool intercepted = 82302;
}

extend google.protobuf.MethodOptions {
  // op_type ...
  OperationMsg op_type = 82303; // Random high number..
}

extend google.protobuf.FieldOptions {
  // storage is used to mark field containing name of affected storage.
  bool storage = 91233; // Random high number..

  // repository annotation is used mark field used as repository
  // when parent message is marked as target or additional repository
  // If this operation modifies a repository, this annotations
  // will specify the location of the Repository field within
  // the request message.
  bool repository = 91234;
  // target_repository is used to mark target repository.
  bool target_repository = 91235;
  // additional_repository is used to mark additional repository.
  bool additional_repository = 91236;
}
