github.com/mdaxf/iac@v0.0.0-20240519030858-58a061660378/vendor_skip/go.mongodb.org/mongo-driver/mongo/description/topology_kind.go (about)

     1  // Copyright (C) MongoDB, Inc. 2017-present.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License"); you may
     4  // not use this file except in compliance with the License. You may obtain
     5  // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
     6  
     7  package description
     8  
     9  // TopologyKind represents a specific topology configuration.
    10  type TopologyKind uint32
    11  
    12  // These constants are the available topology configurations.
    13  const (
    14  	Single                TopologyKind = 1
    15  	ReplicaSet            TopologyKind = 2
    16  	ReplicaSetNoPrimary   TopologyKind = 4 + ReplicaSet
    17  	ReplicaSetWithPrimary TopologyKind = 8 + ReplicaSet
    18  	Sharded               TopologyKind = 256
    19  	LoadBalanced          TopologyKind = 512
    20  )
    21  
    22  // String implements the fmt.Stringer interface.
    23  func (kind TopologyKind) String() string {
    24  	switch kind {
    25  	case Single:
    26  		return "Single"
    27  	case ReplicaSet:
    28  		return "ReplicaSet"
    29  	case ReplicaSetNoPrimary:
    30  		return "ReplicaSetNoPrimary"
    31  	case ReplicaSetWithPrimary:
    32  		return "ReplicaSetWithPrimary"
    33  	case Sharded:
    34  		return "Sharded"
    35  	case LoadBalanced:
    36  		return "LoadBalanced"
    37  	}
    38  
    39  	return "Unknown"
    40  }