Documentation
¶
Index ¶
- Constants
- func IsIntegrityConstraintViolation(err error) bool
- func NullInt() sql.NullInt64
- func NullIntToPtr(nullint sql.NullInt64) *int64
- func NullIntValue(value int64) sql.NullInt64
- func PtrToNullInt(value *int64) sql.NullInt64
- type ConnectionStatus
- type DB
- type DesiredReplicaSetConstraintStatus
- type MSPError
- type MamidMetadata
- type Mongod
- type MongodExecutionState
- type MongodKeyfile
- type MongodMatchStatus
- type MongodState
- type MongodbCredential
- type ObservedReplicaSetConstraintStatus
- type PortNumber
- type Problem
- type ProblemType
- type ReplicaSet
- type ReplicaSetInitiationStatus
- type RiskGroup
- type ShardingRole
- type Slave
- type SlaveState
- type StatusMessage
Constants ¶
View Source
const SCHEMA_VERSION string = "0.0.1"
Variables ¶
This section is empty.
Functions ¶
func NullIntToPtr ¶
func NullIntValue ¶
func PtrToNullInt ¶
Types ¶
type ConnectionStatus ¶
type DB ¶
type DB struct {
Driver string
// contains filtered or unexported fields
}
func InitializeDB ¶
func InitializeTestDB ¶
func (*DB) CloseAndDrop ¶
func (db *DB) CloseAndDrop()
type DesiredReplicaSetConstraintStatus ¶
type DesiredReplicaSetConstraintStatus struct {
Unsatisfied bool
ReplicaSet ReplicaSet
ConfiguredVolatileCount uint
ConfiguredPersistentCount uint
}
type MSPError ¶
type MSPError struct {
ID int64 `gorm:"primary_key"`
Identifier string
Description string
LongDescription string
}
msp.Error duplicated for decoupling protocol & internal representation
type MamidMetadata ¶
type MamidMetadata struct {
Key, Value string
}
type Mongod ¶
type Mongod struct {
// TODO missing UNIQUE constraint
ID int64 `gorm:"primary_key"`
Port PortNumber
ReplSetName string
ObservationError MSPError
ObservationErrorID sql.NullInt64 `sql:"type:integer NULL REFERENCES msp_errors(id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED"` // TODO not cleaned up on Mongod deletion right now
LastEstablishStateError MSPError
LastEstablishStateErrorID sql.NullInt64 `sql:"type:integer NULL REFERENCES msp_errors(id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED"` // TODO not cleaned up on Mongod deletion right now
ParentSlave *Slave
ParentSlaveID int64 `sql:"type:integer REFERENCES slaves(id) DEFERRABLE INITIALLY DEFERRED"`
ReplicaSet *ReplicaSet
ReplicaSetID sql.NullInt64 `sql:"type:integer NULL REFERENCES replica_sets(id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED"`
DesiredState MongodState
DesiredStateID int64 `sql:"type:integer NOT NULL REFERENCES mongod_states(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED"` // NOTE: we cascade on delete because Monogd cannot be without DesiredState
ObservedState MongodState
ObservedStateID sql.NullInt64 `sql:"type:integer NULL REFERENCES mongod_states(id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED"`
}
type MongodExecutionState ¶
type MongodExecutionState uint
const ( MongodExecutionStateForceDestroyed MongodExecutionState = iota MongodExecutionStateDestroyed MongodExecutionStateNotRunning MongodExecutionStateUninitiated MongodExecutionStateRecovering // invalid for a desired MongodState MongodExecutionStateRunning )
type MongodKeyfile ¶
type MongodMatchStatus ¶
type MongodState ¶
type MongodState struct {
ID int64 `gorm:"primary_key"`
ParentMongod *Mongod
ParentMongodID int64 `sql:"type:integer NOT NULL REFERENCES mongods(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED"`
ShardingRole ShardingRole
ExecutionState MongodExecutionState
}
type MongodbCredential ¶
type PortNumber ¶
type PortNumber uint16
const ( PortNumberMin PortNumber = 1 PortNumberMax = 65535 )
type Problem ¶
type Problem struct {
ID int64 `gorm:"primary_key"`
Description string
LongDescription string
ProblemType ProblemType
FirstOccurred time.Time
LastUpdated time.Time
Slave *Slave
SlaveID sql.NullInt64 `sql:"type:integer NULL REFERENCES slaves(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED"`
ReplicaSet *ReplicaSet
ReplicaSetID sql.NullInt64 `sql:"type:integer NULL REFERENCES replica_sets(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED"`
Mongod *Mongod
MongodID sql.NullInt64 `sql:"type:integer NULL REFERENCES mongods(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED"`
}
type ProblemType ¶
type ProblemType uint
const ( ProblemTypeConnection ProblemType = iota ProblemTypeMismatch ProblemTypeDesiredReplicaSetConstraint ProblemTypeObservedReplicaSetConstraint )
type ReplicaSet ¶
type ReplicaSetInitiationStatus ¶
type ReplicaSetInitiationStatus struct {
Initiated bool
ReplicaSet ReplicaSet
}
type ShardingRole ¶
type ShardingRole string
const ( ShardingRoleNone ShardingRole = "none" ShardingRoleShardServer ShardingRole = "shardsvr" ShardingRoleConfigServer ShardingRole = "configsvr" )
type Slave ¶
type Slave struct {
ID int64 `gorm:"primary_key"`
Hostname string `gorm:"unique_index"`
Port PortNumber
MongodPortRangeBegin PortNumber
MongodPortRangeEnd PortNumber
PersistentStorage bool
Mongods []*Mongod `gorm:"ForeignKey:ParentSlaveID"`
ConfiguredState SlaveState
Problems []*Problem
// Foreign keys
RiskGroupID sql.NullInt64 `sql:"type:integer NULL REFERENCES risk_groups(id) DEFERRABLE INITIALLY DEFERRED"`
ObservationError *MSPError // error in observation that is not tied to a specific Mongod
ObservationErrorID sql.NullInt64 `sql:"type:integer NULL REFERENCES msp_errors(id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED"` // TODO not cleaned up on slave deletion right now
}
type SlaveState ¶
type SlaveState uint
const ( SlaveStateActive SlaveState = iota SlaveStateMaintenance SlaveStateDisabled )
type StatusMessage ¶
type StatusMessage interface {
}
Click to show internal directories.
Click to hide internal directories.