// Copyright the Hyperledger Fabric contributors. All rights reserved.
//
// SPDX-License-Identifier: Apache-2.0

syntax = "proto3";

option go_package = "github.com/hyperledger/fabric-protos-go/orderer";
option java_package = "org.hyperledger.fabric.protos.orderer";

package orderer;

// The orderer config is specified by the following convention:
//   For a configuration item with key "Key"
//   the encoded value is a a proto message of type "Key"
//   For example, for the configuration item of name "ConsensusType"
//   the encoded value is the proto message "ConsensusType"

message ConsensusType {
    // The consensus type: "solo" or "etcdraft".
    string type = 1;
    // Opaque metadata, dependent on the consensus type.
    bytes metadata = 2;

    // State defines the orderer mode of operation, typically for consensus-type migration.
    // NORMAL is during normal operation, when consensus-type migration is not, and can not, take place.
    // MAINTENANCE is when the consensus-type can be changed.
    enum State {
        STATE_NORMAL = 0;
        STATE_MAINTENANCE = 1;
    }
    // The state signals the ordering service to go into maintenance mode, typically for consensus-type migration.
    State state = 3;
}

message BatchSize {
    // Simply specified as number of messages for now, in the future
    // we may want to allow this to be specified by size in bytes
    uint32 max_message_count = 1;
    // The byte count of the serialized messages in a batch cannot
    // exceed this value.
    uint32 absolute_max_bytes = 2;
    // The byte count of the serialized messages in a batch should not
    // exceed this value.
    uint32 preferred_max_bytes = 3;
}

message BatchTimeout {
    // Any duration string parseable by ParseDuration():
    // https://golang.org/pkg/time/#ParseDuration
    string timeout = 1;
}

// Carries a list of bootstrap brokers, i.e. this is not the exclusive set of
// brokers an ordering service
message KafkaBrokers {
    option deprecated = true;
    // Each broker here should be identified using the (IP|host):port notation,
    // e.g. 127.0.0.1:7050, or localhost:7050 are valid entries
    repeated string brokers = 1;
}

// ChannelRestrictions is the mssage which conveys restrictions on channel creation for an orderer
message ChannelRestrictions {
    uint64 max_count = 1; // The max count of channels to allow to be created, a value of 0 indicates no limit
}
