當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。