當前位置: 首頁>>代碼示例>>Golang>>正文


Golang inst.ReadTopologyInstance函數代碼示例

本文整理匯總了Golang中github.com/outbrain/orchestrator/go/inst.ReadTopologyInstance函數的典型用法代碼示例。如果您正苦於以下問題:Golang ReadTopologyInstance函數的具體用法?Golang ReadTopologyInstance怎麽用?Golang ReadTopologyInstance使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了ReadTopologyInstance函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: TestReadTopologySlave

func (s *TestSuite) TestReadTopologySlave(c *C) {
	key := slave3Key
	i, _ := inst.ReadTopologyInstance(&key)
	c.Assert(i.Key.Hostname, Equals, key.Hostname)
	c.Assert(i.IsSlave(), Equals, true)
	c.Assert(len(i.SlaveHosts), Equals, 0)
}
開發者ID:rlowe,項目名稱:orchestrator,代碼行數:7,代碼來源:instance_dao_test.go

示例2: TestReadTopologyAndInstanceSlave

func (s *TestSuite) TestReadTopologyAndInstanceSlave(c *C) {
	i, _ := inst.ReadTopologyInstance(&slave1Key)
	iRead, found, _ := inst.ReadInstance(&slave1Key)
	c.Assert(found, Equals, true)
	c.Assert(iRead.Key.Hostname, Equals, i.Key.Hostname)
	c.Assert(iRead.Version, Equals, i.Version)
}
開發者ID:rlowe,項目名稱:orchestrator,代碼行數:7,代碼來源:instance_dao_test.go

示例3: TestBeginMaintenance

func (s *TestSuite) TestBeginMaintenance(c *C) {
	clearTestMaintenance()
	_, _ = inst.ReadTopologyInstance(&masterKey)
	_, err := inst.BeginMaintenance(&masterKey, "unittest", "TestBeginMaintenance")

	c.Assert(err, IsNil)
}
開發者ID:rlowe,項目名稱:orchestrator,代碼行數:7,代碼來源:instance_dao_test.go

示例4: TestMakeCoMasterAndBack

func (s *TestSuite) TestMakeCoMasterAndBack(c *C) {
	clearTestMaintenance()

	slave1, err := inst.MakeCoMaster(&slave1Key)
	c.Assert(err, IsNil)

	// Now master & slave1 expected to be co-masters. Check!
	master, _ := inst.ReadTopologyInstance(&masterKey)
	c.Assert(master.IsSlaveOf(slave1), Equals, true)
	c.Assert(slave1.IsSlaveOf(master), Equals, true)

	// reset - restore to original state
	master, err = inst.ResetSlaveOperation(&masterKey)
	slave1, _ = inst.ReadTopologyInstance(&slave1Key)
	c.Assert(err, IsNil)
	c.Assert(master.MasterKey.Hostname, Equals, "_")
}
開發者ID:rlowe,項目名稱:orchestrator,代碼行數:17,代碼來源:instance_dao_test.go

示例5: TestForgetMaster

func (s *TestSuite) TestForgetMaster(c *C) {
	_, _ = inst.ReadTopologyInstance(&masterKey)
	_, found, _ := inst.ReadInstance(&masterKey)
	c.Assert(found, Equals, true)
	inst.ForgetInstance(&masterKey)
	_, found, _ = inst.ReadInstance(&masterKey)
	c.Assert(found, Equals, false)
}
開發者ID:rlowe,項目名稱:orchestrator,代碼行數:8,代碼來源:instance_dao_test.go

示例6: TestReadTopologyAndInstanceMaster

func (s *TestSuite) TestReadTopologyAndInstanceMaster(c *C) {
	i, _ := inst.ReadTopologyInstance(&masterKey)
	iRead, found, _ := inst.ReadInstance(&masterKey)
	c.Assert(found, Equals, true)
	c.Assert(iRead.Key.Hostname, Equals, i.Key.Hostname)
	c.Assert(iRead.Version, Equals, i.Version)
	c.Assert(len(iRead.SlaveHosts), Equals, len(i.SlaveHosts))
}
開發者ID:rlowe,項目名稱:orchestrator,代碼行數:8,代碼來源:instance_dao_test.go

示例7: TestGetMasterOfASlave

func (s *TestSuite) TestGetMasterOfASlave(c *C) {
	i, err := inst.ReadTopologyInstance(&slave1Key)
	c.Assert(err, IsNil)
	master, err := inst.GetInstanceMaster(i)
	c.Assert(err, IsNil)
	c.Assert(master.IsSlave(), Equals, false)
	c.Assert(master.Key.Port, Equals, 22987)
}
開發者ID:rlowe,項目名稱:orchestrator,代碼行數:8,代碼來源:instance_dao_test.go

示例8: TestReadTopologyUnexisting

func (s *TestSuite) TestReadTopologyUnexisting(c *C) {
	key := inst.InstanceKey{
		Hostname: "127.0.0.1",
		Port:     22999,
	}
	_, err := inst.ReadTopologyInstance(&key)

	c.Assert(err, Not(IsNil))
}
開發者ID:rlowe,項目名稱:orchestrator,代碼行數:9,代碼來源:instance_dao_test.go

示例9: emergentlyReadTopologyInstance

// Force a re-read of a topology instance; this is done because we need to substantiate a suspicion that we may have a failover
// scenario. we want to speed up rading the complete picture.
func emergentlyReadTopologyInstance(instanceKey *inst.InstanceKey, analysisCode inst.AnalysisCode) {
	if err := emergencyReadTopologyInstanceMap.Add(instanceKey.DisplayString(), true, 0); err == nil {
		emergencyReadTopologyInstanceMap.Set(instanceKey.DisplayString(), true, 0)
		go inst.ExecuteOnTopology(func() {
			inst.ReadTopologyInstance(instanceKey)
			inst.AuditOperation("emergently-read-topology-instance", instanceKey, string(analysisCode))
		})
	}
}
開發者ID:openark,項目名稱:orchestrator,代碼行數:11,代碼來源:topology_recovery.go

示例10: TestReadTopologyMaster

func (s *TestSuite) TestReadTopologyMaster(c *C) {
	key := masterKey
	i, _ := inst.ReadTopologyInstance(&key)

	c.Assert(i.Key.Hostname, Equals, key.Hostname)
	c.Assert(i.IsSlave(), Equals, false)
	c.Assert(len(i.SlaveHosts), Equals, 3)
	c.Assert(len(i.SlaveHosts.GetInstanceKeys()), Equals, len(i.SlaveHosts))
}
開發者ID:rlowe,項目名稱:orchestrator,代碼行數:9,代碼來源:instance_dao_test.go

示例11: TestFailEndMaintenanceTwice

func (s *TestSuite) TestFailEndMaintenanceTwice(c *C) {
	clearTestMaintenance()
	_, _ = inst.ReadTopologyInstance(&masterKey)
	k, err := inst.BeginMaintenance(&masterKey, "unittest", "TestFailEndMaintenanceTwice")
	c.Assert(err, IsNil)
	err = inst.EndMaintenance(k)
	c.Assert(err, IsNil)
	err = inst.EndMaintenance(k)
	c.Assert(err, Not(IsNil))
}
開發者ID:rlowe,項目名稱:orchestrator,代碼行數:10,代碼來源:instance_dao_test.go

示例12: emergentlyReadTopologyInstance

// Force a re-read of a topology instance; this is done because we need to substantiate a suspicion that we may have a failover
// scenario. we want to speed up reading the complete picture.
func emergentlyReadTopologyInstance(instanceKey *inst.InstanceKey, analysisCode inst.AnalysisCode) {
	if existsInCacheError := emergencyReadTopologyInstanceMap.Add(instanceKey.DisplayString(), true, cache.DefaultExpiration); existsInCacheError != nil {
		// Just recently attempted
		return
	}
	go inst.ExecuteOnTopology(func() {
		inst.ReadTopologyInstance(instanceKey)
		inst.AuditOperation("emergently-read-topology-instance", instanceKey, string(analysisCode))
	})
}
開發者ID:0-T-0,項目名稱:orchestrator,代碼行數:12,代碼來源:topology_recovery.go

示例13: TestFailMoveBelowUponMaintenance

func (s *TestSuite) TestFailMoveBelowUponMaintenance(c *C) {
	clearTestMaintenance()
	_, _ = inst.ReadTopologyInstance(&slave1Key)
	k, err := inst.BeginMaintenance(&slave1Key, "unittest", "TestBeginEndMaintenance")
	c.Assert(err, IsNil)

	_, err = inst.MoveBelow(&slave1Key, &slave2Key)
	c.Assert(err, Not(IsNil))

	err = inst.EndMaintenance(k)
	c.Assert(err, IsNil)
}
開發者ID:rlowe,項目名稱:orchestrator,代碼行數:12,代碼來源:instance_dao_test.go

示例14: TestStopStartSlave

func (s *TestSuite) TestStopStartSlave(c *C) {

	i, _ := inst.ReadTopologyInstance(&slave1Key)
	c.Assert(i.SlaveRunning(), Equals, true)
	i, _ = inst.StopSlaveNicely(&i.Key, 0)

	c.Assert(i.SlaveRunning(), Equals, false)
	c.Assert(i.SQLThreadUpToDate(), Equals, true)

	i, _ = inst.StartSlave(&i.Key)
	c.Assert(i.SlaveRunning(), Equals, true)
}
開發者ID:rlowe,項目名稱:orchestrator,代碼行數:12,代碼來源:instance_dao_test.go

示例15: TestFailMoveBelowUponOtherSlaveStopped

func (s *TestSuite) TestFailMoveBelowUponOtherSlaveStopped(c *C) {
	clearTestMaintenance()

	slave1, _ := inst.ReadTopologyInstance(&slave1Key)
	c.Assert(slave1.SlaveRunning(), Equals, true)
	slave1, _ = inst.StopSlaveNicely(&slave1.Key, 0)
	c.Assert(slave1.SlaveRunning(), Equals, false)

	_, err := inst.MoveBelow(&slave2Key, &slave1Key)
	c.Assert(err, Not(IsNil))

	_, _ = inst.StartSlave(&slave1.Key)
}
開發者ID:rlowe,項目名稱:orchestrator,代碼行數:13,代碼來源:instance_dao_test.go


注:本文中的github.com/outbrain/orchestrator/go/inst.ReadTopologyInstance函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。