syntax = "proto3";

package yandex.cloud.mdb.mongodb.v1.config;

import "google/protobuf/wrappers.proto";
import "yandex/cloud/validation.proto";

option go_package = "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/mongodb/v1/config;mongodb";
option java_package = "yandex.cloud.api.mdb.mongodb.v1.config";

// Configuration of a mongod daemon. Supported options are a limited subset of all
// options described in [MongoDB documentation](https://docs.mongodb.com/v4.2/reference/configuration-options/).
message MongodConfig4_2 {
  message Storage {
    // Configuration of WiredTiger storage engine.
    message WiredTiger {
      message EngineConfig {
        // The maximum size of the internal cache that WiredTiger will use for all data.
        google.protobuf.DoubleValue cache_size_gb = 1;
      }

      message CollectionConfig {
        enum Compressor {
          COMPRESSOR_UNSPECIFIED = 0;

          // No compression.
          NONE = 1;

          // The [Snappy](https://docs.mongodb.com/v4.2/reference/glossary/#term-snappy) compression.
          SNAPPY = 2;

          // The [zlib](https://docs.mongodb.com/v4.2/reference/glossary/#term-zlib) compression.
          ZLIB = 3;
        }

        // Default type of compression to use for collection data.
        Compressor block_compressor = 1;
      }

      // Engine configuration for WiredTiger.
      EngineConfig engine_config = 1;

      // Collection configuration for WiredTiger.
      CollectionConfig collection_config = 2;
    }

    message Journal {
      // Commit interval between journal operations, in milliseconds.
      // Default: 100.
      google.protobuf.Int64Value commit_interval = 1 [(value) = "1-500"];
    }

    // Configuration of the WiredTiger storage engine.
    WiredTiger wired_tiger = 1;

    // Configuration of the MongoDB [journal](https://docs.mongodb.com/v4.2/reference/glossary/#term-journal).
    Journal journal = 2;
  }

  message OperationProfiling {
    enum Mode {
      MODE_UNSPECIFIED = 0;

      // The profiler is off and does not collect any data.
      OFF = 1;

      // The profiler collects data for operations that take longer than the value of [slow_op_threshold].
      SLOW_OP = 2;

      // The profiler collects data for all operations.
      ALL = 3;
    }

    // Mode which specifies operations that should be profiled.
    Mode mode = 1;

    // The slow operation time threshold, in milliseconds. Operations that run
    // for longer than this threshold are considered slow, and are processed by the profiler
    // running in the SLOW_OP mode.
    google.protobuf.Int64Value slow_op_threshold = 2 [(value) = ">0"];
  }

  message Network {
    // The maximum number of simultaneous connections that mongod will accept.
    google.protobuf.Int64Value max_incoming_connections = 1 [(value) = "10-16384"];
  }

  // `storage` section of mongod configuration.
  Storage storage = 1;

  // `operationProfiling` section of mongod configuration.
  OperationProfiling operation_profiling = 2;

  // `net` section of mongod configuration.
  Network net = 3;
}

message MongoCfgConfig4_2 {
  message Storage {
    // Configuration of WiredTiger storage engine.
    message WiredTiger {
      message EngineConfig {
        // The maximum size of the internal cache that WiredTiger will use for all data.
        google.protobuf.DoubleValue cache_size_gb = 1;
      }

      // Engine configuration for WiredTiger.
      EngineConfig engine_config = 1;
    }

    // Configuration of the WiredTiger storage engine.
    WiredTiger wired_tiger = 1;
  }

  message OperationProfiling {
    enum Mode {
      MODE_UNSPECIFIED = 0;

      // The profiler is off and does not collect any data.
      OFF = 1;

      // The profiler collects data for operations that take longer than the value of [slow_op_threshold].
      SLOW_OP = 2;

      // The profiler collects data for all operations.
      ALL = 3;
    }

    // Mode which specifies operations that should be profiled.
    Mode mode = 1;

    // The slow operation time threshold, in milliseconds. Operations that run
    // for longer than this threshold are considered slow, and are processed by the profiler
    // running in the SLOW_OP mode. For details see [MongoDB documentation](https://docs.mongodb.com/v4.2/reference/configuration-options/#operationProfiling.slowOpThresholdMs).
    google.protobuf.Int64Value slow_op_threshold = 2  [(value) = ">0"];
  }

  message Network {
    // The maximum number of simultaneous connections that mongocfg will accept.
    google.protobuf.Int64Value max_incoming_connections = 1 [(value) = "10-16384"];
  }

  // `storage` section of mongocfg configuration.
  Storage storage = 1;

  // `operationProfiling` section of mongocfg configuration.
  OperationProfiling operation_profiling = 2;

  // `net` section of mongocfg configuration.
  Network net = 3;

}

message MongosConfig4_2 {
  message Network {
    // The maximum number of simultaneous connections that mongos will accept.
    google.protobuf.Int64Value max_incoming_connections = 1 [(value) = "10-16384"];
  }

  // Network settings for mongos.
  Network net = 1;
}

message MongodConfigSet4_2 {
  // Effective mongod settings for a MongoDB 4.2 cluster (a combination of settings defined
  // in [user_config] and [default_config]).
  MongodConfig4_2 effective_config = 1;

  // User-defined mongod settings for a MongoDB 4.2 cluster.
  MongodConfig4_2 user_config = 2;

  // Default mongod configuration for a MongoDB 4.2 cluster.
  MongodConfig4_2 default_config = 3;
}

message MongoCfgConfigSet4_2 {
  // Effective mongocfg settings for a MongoDB 4.2 cluster (a combination of settings defined
  // in [user_config] and [default_config]).
  MongoCfgConfig4_2 effective_config = 1;

  // User-defined mongocfg settings for a MongoDB 4.2 cluster.
  MongoCfgConfig4_2 user_config = 2;

  // Default mongocfg configuration for a MongoDB 4.2 cluster.
  MongoCfgConfig4_2 default_config = 3;
}

message MongosConfigSet4_2 {
  // Effective mongos settings for a MongoDB 4.2 cluster (a combination of settings defined
  // in [user_config] and [default_config]).
  MongosConfig4_2 effective_config = 1;

  // User-defined mongos settings for a MongoDB 4.2 cluster.
  MongosConfig4_2 user_config = 2;

  // Default mongos configuration for a MongoDB 4.2 cluster.
  MongosConfig4_2 default_config = 3;
}
