blob: 69f817739ade35029016c3a21b10a765e4655fcd [file] [log] [blame]
Don Newton379ae252019-04-01 12:17:06 -04001// 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
7package description
8
9// TopologyKind represents a specific topology configuration.
10type TopologyKind uint32
11
12// These constants are the available topology configurations.
13const (
14 Single TopologyKind = 1
15 ReplicaSet TopologyKind = 2
16 ReplicaSetNoPrimary TopologyKind = 4 + ReplicaSet
17 ReplicaSetWithPrimary TopologyKind = 8 + ReplicaSet
18 Sharded TopologyKind = 256
19)
20
21// String implements the fmt.Stringer interface.
22func (kind TopologyKind) String() string {
23 switch kind {
24 case Single:
25 return "Single"
26 case ReplicaSet:
27 return "ReplicaSet"
28 case ReplicaSetNoPrimary:
29 return "ReplicaSetNoPrimary"
30 case ReplicaSetWithPrimary:
31 return "ReplicaSetWithPrimary"
32 case Sharded:
33 return "Sharded"
34 }
35
36 return "Unknown"
37}