{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Parameters to instantiate a NEO cluster. See https://lab.nexedi.com/nexedi/neoppod/blob/master/neo.conf for more information.",
  "additionalProperties": false,
  "require": [
    "cluster"
  ],
  "properties": {
    "cluster": {
      "description": "Cluster unique identifier. Your last line of defense against mixing up NEO clusters and corrupting your data. Choose a unique value for each of your cluster.",
      "type": "string"
    },
    "partitions": {
      "description": "Number of partitions. You cannot change this value once you created a cluster.",
      "default": 12,
      "type": "integer"
    },
    "replicas": {
      "description": "Number of replicates.",
      "default": 0,
      "type": "integer"
    },
    "upstream-cluster": {
      "description": "Identifier of the cluster to backup.",
      "type": "string"
    },
    "upstream-masters": {
      "description": "Master nodes in the cluster to backup.",
      "type": "string"
    },
    "sla-dict": {
      "description": "[NEO SR only] Where to request instances. Each key is a query string for criterions (e.g. \"computer_guid=foo\"), and each value is a list of partition references ('node-0', 'node-1', ...). The prefix 'node-' is mandatory and the number must start from 0. The total number of nodes here must be equal to the length of node-list.",
      "additionalProperties": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "uniqueItems": true
      },
      "type": "object"
    },
    "ssl": {
      "description": "Enable SSL. All nodes look for 3 files in ~/etc: ca.crt, neo.crt, neo.key. Waiting that SlapOS provides a way to manage certificates, the user must deploy them manually, or use the temporary _ca/_cert/_key parameters.",
      "default": true,
      "type": "boolean"
    },
    "_ca": {
      "type": "string"
    },
    "_cert": {
      "type": "string"
    },
    "_key": {
      "type": "string"
    },
    "node-list": {
      "description": "List of dictionaries containing parameters for each node.",
      "items": {
        "description": "Dictionary containing parameters required to configure individual nodes.",
        "default": {},
        "properties": {
          "admin": {
            "description": "Port of admin node. 0 to disable.",
            "default": 2050,
            "type": "integer"
          },
          "master": {
            "description": "Port of master node. 0 to disable.",
            "default": 2051,
            "type": "integer"
          },
          "storage-count": {
            "description": "Number of storage nodes to deploy. One master and one admin node is deployed with each storage.",
            "default": 1,
            "type": "integer"
          },
          "data-deduplication": {
            "description": "Set the --dedup option for storage nodes.",
            "default": false,
            "type": "boolean"
          },
          "disable-drop-partitions": {
            "description": "Set the --disable-drop-partitions option for storage nodes.",
            "default": false,
            "type": "boolean"
          },
          "storage-type": {
            "description": "Storage type. Defaults to MySQL if available, else SQLite.",
            "enum": [
              "MySQL",
              "SQLite"
            ],
            "type": "string"
          },
          "mysql": {
            "description": "Dictionary containing parameters for MySQL.",
            "default": {},
            "properties": {
              "relaxed-writes": {
                "description": "When enabled, sets innodb_flush_log_at_trx_commit = 0, innodb_flush_method = nosync, innodb_doublewrite = 0 and sync_frm = 0 - RTFM, those options are dangerous",
                "default": false,
                "type": "boolean"
              }
            },
            "additionalProperties": {
              "description": "To configure important parameters like innodb_buffer_pool_size, tokudb_cache_size, etc.",
              "type": "string"
            },
            "type": "object"
          },
          "engine": {
            "description": "Configures storage engine, currently only InnoDB and TokuDB are supported. Defaults to NEO's default.",
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    }
  },
  "type": "object"
}
