当前位置: 首页>>代码示例>>Golang>>正文


Golang inst.Instance类代码示例

本文整理汇总了Golang中github.com/outbrain/orchestrator/go/inst.Instance的典型用法代码示例。如果您正苦于以下问题:Golang Instance类的具体用法?Golang Instance怎么用?Golang Instance使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Instance类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: isGeneralyValidAsCandidateSiblingOfIntermediateMaster

func isGeneralyValidAsCandidateSiblingOfIntermediateMaster(sibling *inst.Instance) bool {
	if !sibling.LogBinEnabled {
		return false
	}
	if !sibling.LogSlaveUpdatesEnabled {
		return false
	}
	if !sibling.SlaveRunning() {
		return false
	}
	if !sibling.IsLastCheckValid {
		return false
	}
	return true
}
开发者ID:openark,项目名称:orchestrator,代码行数:15,代码来源:topology_recovery.go

示例2: TestIsSmallerMajorVersion

func (s *TestSuite) TestIsSmallerMajorVersion(c *C) {
	i55 := inst.Instance{Version: "5.5"}
	i5517 := inst.Instance{Version: "5.5.17"}
	i56 := inst.Instance{Version: "5.6"}

	c.Assert(i55.IsSmallerMajorVersion(&i5517), Not(Equals), true)
	c.Assert(i56.IsSmallerMajorVersion(&i5517), Not(Equals), true)
	c.Assert(i55.IsSmallerMajorVersion(&i56), Equals, true)
}
开发者ID:ruo91,项目名称:orchestrator,代码行数:9,代码来源:instance_test.go

示例3: isValidAsCandidateSiblingOfIntermediateMaster

func isValidAsCandidateSiblingOfIntermediateMaster(intermediateMasterInstance *inst.Instance, sibling *inst.Instance) bool {
	if sibling.Key.Equals(&intermediateMasterInstance.Key) {
		// same instance
		return false
	}
	if !isGeneralyValidAsCandidateSiblingOfIntermediateMaster(sibling) {
		return false
	}
	if sibling.HasReplicationFilters != intermediateMasterInstance.HasReplicationFilters {
		return false
	}
	if sibling.IsMaxScale() || intermediateMasterInstance.IsMaxScale() {
		// With MaxScale the failover is different; we don't need this "move to uncle" logic.
		return false
	}
	if sibling.ExecBinlogCoordinates.SmallerThan(&intermediateMasterInstance.ExecBinlogCoordinates) {
		return false
	}
	return true
}
开发者ID:shuhaowu,项目名称:orchestrator,代码行数:20,代码来源:topology_recovery.go

示例4: isValidAsCandidateSiblingOfIntermediateMaster

func isValidAsCandidateSiblingOfIntermediateMaster(intermediateMasterInstance *inst.Instance, sibling *inst.Instance) bool {
	if sibling.Key.Equals(&intermediateMasterInstance.Key) {
		// same instance
		return false
	}
	if !isGeneralyValidAsCandidateSiblingOfIntermediateMaster(sibling) {
		return false
	}
	if sibling.HasReplicationFilters != intermediateMasterInstance.HasReplicationFilters {
		return false
	}
	if sibling.IsBinlogServer() != intermediateMasterInstance.IsBinlogServer() {
		// When both are binlog servers, failover is trivial.
		// When failed IM is binlog server, its sibling is still valid, but we catually prefer to just repoint the slave up -- simplest!
		return false
	}
	if sibling.ExecBinlogCoordinates.SmallerThan(&intermediateMasterInstance.ExecBinlogCoordinates) {
		return false
	}
	return true
}
开发者ID:openark,项目名称:orchestrator,代码行数:21,代码来源:topology_recovery.go

示例5: TestNextGTID

func (s *TestSuite) TestNextGTID(c *C) {
	{
		i := inst.Instance{ExecutedGtidSet: "4f6d62ed-df65-11e3-b395-60672090eb04:1,b9b4712a-df64-11e3-b391-60672090eb04:1-6"}
		nextGTID, err := i.NextGTID()
		c.Assert(err, IsNil)
		c.Assert(nextGTID, Equals, "b9b4712a-df64-11e3-b391-60672090eb04:7")
	}
	{
		i := inst.Instance{ExecutedGtidSet: "b9b4712a-df64-11e3-b391-60672090eb04:1-6"}
		nextGTID, err := i.NextGTID()
		c.Assert(err, IsNil)
		c.Assert(nextGTID, Equals, "b9b4712a-df64-11e3-b391-60672090eb04:7")
	}
	{
		i := inst.Instance{ExecutedGtidSet: "b9b4712a-df64-11e3-b391-60672090eb04:6"}
		nextGTID, err := i.NextGTID()
		c.Assert(err, IsNil)
		c.Assert(nextGTID, Equals, "b9b4712a-df64-11e3-b391-60672090eb04:7")
	}
}
开发者ID:rlowe,项目名称:orchestrator,代码行数:20,代码来源:instance_test.go

示例6: TestCanReplicateFrom

func (s *TestSuite) TestCanReplicateFrom(c *C) {
	i55 := inst.Instance{Key: key1, Version: "5.5"}
	i56 := inst.Instance{Key: key2, Version: "5.6"}

	var canReplicate bool
	canReplicate, _ = i56.CanReplicateFrom(&i55)
	c.Assert(canReplicate, Equals, false) //binlog not yet enabled

	i55.LogBinEnabled = true
	i55.LogSlaveUpdatesEnabled = true
	i56.LogBinEnabled = true
	i56.LogSlaveUpdatesEnabled = true

	canReplicate, _ = i56.CanReplicateFrom(&i55)
	c.Assert(canReplicate, Equals, false) //serverid not set
	i55.ServerID = 55
	i56.ServerID = 56

	canReplicate, err := i56.CanReplicateFrom(&i55)
	c.Assert(err, IsNil)
	c.Assert(canReplicate, Equals, true)
	canReplicate, _ = i55.CanReplicateFrom(&i56)
	c.Assert(canReplicate, Equals, false)

	iStatement := inst.Instance{Key: key1, Binlog_format: "STATEMENT", ServerID: 1, Version: "5.5", LogBinEnabled: true, LogSlaveUpdatesEnabled: true}
	iRow := inst.Instance{Key: key2, Binlog_format: "ROW", ServerID: 2, Version: "5.5", LogBinEnabled: true, LogSlaveUpdatesEnabled: true}
	canReplicate, err = iRow.CanReplicateFrom(&iStatement)
	c.Assert(err, IsNil)
	c.Assert(canReplicate, Equals, true)
	canReplicate, _ = iStatement.CanReplicateFrom(&iRow)
	c.Assert(canReplicate, Equals, false)
}
开发者ID:ruo91,项目名称:orchestrator,代码行数:32,代码来源:instance_test.go

示例7: TestIsVersion

func (s *TestSuite) TestIsVersion(c *C) {
	i51 := inst.Instance{Version: "5.1.19"}
	i55 := inst.Instance{Version: "5.5.17-debug"}
	i56 := inst.Instance{Version: "5.6.20"}
	i57 := inst.Instance{Version: "5.7.8-log"}

	c.Assert(i51.IsMySQL51(), Equals, true)
	c.Assert(i55.IsMySQL55(), Equals, true)
	c.Assert(i56.IsMySQL56(), Equals, true)
	c.Assert(i55.IsMySQL56(), Equals, false)
	c.Assert(i57.IsMySQL57(), Equals, true)
	c.Assert(i56.IsMySQL57(), Equals, false)
}
开发者ID:rlowe,项目名称:orchestrator,代码行数:13,代码来源:instance_test.go


注:本文中的github.com/outbrain/orchestrator/go/inst.Instance类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。