本文整理匯總了Golang中github.com/couchbase/indexing/secondary/manager.IndexManager.SetTopologyByBucket方法的典型用法代碼示例。如果您正苦於以下問題:Golang IndexManager.SetTopologyByBucket方法的具體用法?Golang IndexManager.SetTopologyByBucket怎麽用?Golang IndexManager.SetTopologyByBucket使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/couchbase/indexing/secondary/manager.IndexManager
的用法示例。
在下文中一共展示了IndexManager.SetTopologyByBucket方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: changeTopologyForTimerTest
// start up
func changeTopologyForTimerTest(mgr *manager.IndexManager) {
// Add a new index definition : 406
idxDefn := &common.IndexDefn{
DefnId: common.IndexDefnId(406),
Name: "stream_mgr_timer_test",
Using: common.ForestDB,
Bucket: "Default",
IsPrimary: false,
SecExprs: []string{"Testing"},
ExprType: common.N1QL,
PartitionScheme: common.HASH,
PartitionKey: "Testing"}
logging.Infof("Run Timer Test : Create Index Defn 406")
if err := mgr.HandleCreateIndexDDL(idxDefn); err != nil {
util.TT.Fatal(err)
}
// Wait so there is no race condition.
time.Sleep(time.Duration(1000) * time.Millisecond)
// Update the index definition to ready
logging.Infof("Run Timer Test : Update Index Defn 406 to READY")
topology, err := mgr.GetTopologyByBucket("Default")
if err != nil {
util.TT.Fatal(err)
}
topology.ChangeStateForIndexInstByDefn(common.IndexDefnId(406), common.INDEX_STATE_CREATED, common.INDEX_STATE_READY)
if err := mgr.SetTopologyByBucket("Default", topology); err != nil {
util.TT.Fatal(err)
}
}