本文整理汇总了Golang中github.com/couchbase/indexing/secondary/manager.IndexManager.HandleCreateIndexDDL方法的典型用法代码示例。如果您正苦于以下问题:Golang IndexManager.HandleCreateIndexDDL方法的具体用法?Golang IndexManager.HandleCreateIndexDDL怎么用?Golang IndexManager.HandleCreateIndexDDL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/couchbase/indexing/secondary/manager.IndexManager
的用法示例。
在下文中一共展示了IndexManager.HandleCreateIndexDDL方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
}
}
示例2: setupInitialData_managerTest
func setupInitialData_managerTest(mgr *manager.IndexManager, t *testing.T) {
// Add a new index definition : 100
idxDefn := &common.IndexDefn{
DefnId: common.IndexDefnId(100),
Name: "index_manager_test_100",
Using: common.ForestDB,
Bucket: "Default",
IsPrimary: false,
SecExprs: []string{"Testing"},
ExprType: common.N1QL,
PartitionScheme: common.HASH,
PartitionKey: "Testing"}
err := mgr.HandleCreateIndexDDL(idxDefn)
if err != nil {
t.Fatal(err)
}
// Add a new index definition : 101
idxDefn = &common.IndexDefn{
DefnId: common.IndexDefnId(101),
Name: "index_manager_test_101",
Using: common.ForestDB,
Bucket: "Default",
IsPrimary: false,
SecExprs: []string{"Testing"},
ExprType: common.N1QL,
PartitionScheme: common.HASH,
PartitionKey: "Testing"}
err = mgr.HandleCreateIndexDDL(idxDefn)
if err != nil {
t.Fatal(err)
}
err = mgr.UpdateIndexInstance("Default", common.IndexDefnId(101), common.INDEX_STATE_ACTIVE, common.StreamId(0), "")
if err != nil {
util.TT.Fatal(err)
}
err = mgr.UpdateIndexInstance("Default", common.IndexDefnId(102), common.INDEX_STATE_ACTIVE, common.StreamId(0), "")
if err != nil {
util.TT.Fatal(err)
}
}
示例3: setupInitialData
func setupInitialData(mgr *manager.IndexManager, t *testing.T) {
uuid, err := common.NewUUID()
if err != nil {
t.Fatal(err)
}
mgr.SetLocalValue("IndexerId", uuid.Str())
// Add a new index definition : 100
idxDefn := &common.IndexDefn{
DefnId: common.IndexDefnId(100),
Name: "metadata_provider_test_100",
Using: common.ForestDB,
Bucket: "Default",
IsPrimary: false,
SecExprs: []string{"Testing"},
ExprType: common.N1QL,
PartitionScheme: common.HASH,
PartitionKey: "Testing"}
if err := mgr.HandleCreateIndexDDL(idxDefn); err != nil {
t.Fatal(err)
}
// Add a new index definition : 101
idxDefn = &common.IndexDefn{
DefnId: common.IndexDefnId(101),
Name: "metadata_provider_test_101",
Using: common.ForestDB,
Bucket: "Default",
IsPrimary: false,
SecExprs: []string{"Testing"},
ExprType: common.N1QL,
PartitionScheme: common.HASH,
PartitionKey: "Testing"}
if err := mgr.HandleCreateIndexDDL(idxDefn); err != nil {
t.Fatal(err)
}
}