本文整理汇总了Golang中github.com/couchbase/indexing/secondary/manager.IndexManager类的典型用法代码示例。如果您正苦于以下问题:Golang IndexManager类的具体用法?Golang IndexManager怎么用?Golang IndexManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IndexManager类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: runTimerTestReceiver
// run test
func runTimerTestReceiver(mgr *manager.IndexManager, ch chan *common.TsVbuuid, donech chan bool) {
logging.Infof("Run Timer Test Receiver")
defer close(donech)
// wait for the sync message to arrive
ticker := time.NewTicker(time.Duration(60) * time.Second)
for {
select {
case ts := <-ch:
if ts.Seqnos[10] == 406 {
// wait to avoid race condition -- this is timing dependent.
time.Sleep(time.Duration(2000) * time.Millisecond)
seqno, ok := mgr.GetStabilityTimestampForVb(common.MAINT_STREAM, "Default", uint16(10))
if !ok || seqno != ts.Seqnos[10] {
util.TT.Fatal("runTimerTestReceiver(): timestamp seqno does not match with repo. %d != %d",
ts.Seqnos[10], seqno)
} else {
logging.Infof("****** runTimerTestReceiver() receive correct stability timestamp")
return
}
}
case <-ticker.C:
logging.Infof("****** runTimerTestReceiver() : timeout")
util.TT.Fatal("runTimerTestReceiver(): Timeout waiting to receive timestamp to arrive")
}
}
logging.Infof("runTimerTestReceiver() done")
}
开发者ID:jchris,项目名称:indexing,代码行数:33,代码来源:stream_timer_test.go
示例2: cleanup
// clean up
func cleanup(mgr *manager.IndexManager, t *testing.T) {
err := mgr.HandleDeleteIndexDDL(common.IndexDefnId(200))
if err != nil {
logging.Infof("Error deleting index %s:%s, err=%s", "Default", "coordinator_test", err)
}
time.Sleep(time.Duration(1000) * time.Millisecond)
}
开发者ID:jchris,项目名称:indexing,代码行数:9,代码来源:coordinator_test.go
示例3: deleteIndexForDeleteTest
func deleteIndexForDeleteTest(mgr *manager.IndexManager) {
//
// Delete a new index definition : 401 (Default)
//
logging.Infof("Run Delete Test : Delete Index Defn 401")
if err := mgr.HandleDeleteIndexDDL(common.IndexDefnId(401)); err != nil {
util.TT.Fatal(err)
}
}
开发者ID:jchris,项目名称:indexing,代码行数:10,代码来源:stream_delete_test.go
示例4: runIterator
func runIterator(mgr *manager.IndexManager, t *testing.T, expectedCount int) {
metaIter, err := mgr.NewIndexDefnIterator()
if err != nil {
t.Fatal(err)
}
count := 0
for key, _, err := metaIter.Next(); err == nil; key, _, err = metaIter.Next() {
logging.Infof("key during iteration %s", key)
count++
}
if expectedCount != -1 && expectedCount != count {
t.Fatal("ExpectedCount does not match with number of index defn in repository")
}
}
开发者ID:jchris,项目名称:indexing,代码行数:17,代码来源:manager_test.go
示例5: 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)
}
}
开发者ID:jchris,项目名称:indexing,代码行数:33,代码来源:stream_timer_test.go
示例6: 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)
}
}
开发者ID:jchris,项目名称:indexing,代码行数:46,代码来源:manager_test.go
示例7: cleanSingleIndex_managerTest
func cleanSingleIndex_managerTest(mgr *manager.IndexManager, t *testing.T, id common.IndexDefnId) {
_, err := mgr.GetIndexDefnById(id)
if err != nil {
logging.Infof("cleanupTest() : cannot find index defn %d. No cleanup ...", id)
} else {
logging.Infof("cleanupTest.cleanupTest() : found index defn %d. Cleaning up ...", id)
mgr.HandleDeleteIndexDDL(id)
_, err := mgr.GetIndexDefnById(id)
if err == nil {
logging.Infof("cleanupTest() : cannot cleanup index defn %d. ...", id)
}
}
}
开发者ID:jchris,项目名称:indexing,代码行数:16,代码来源:manager_test.go
示例8: cleanupRequestHandlerTest
// clean up
func cleanupRequestHandlerTest(mgr *manager.IndexManager, t *testing.T) {
_, err := mgr.GetIndexDefnById(common.IndexDefnId(500))
if err != nil {
logging.Infof("RequestHandlerTest.cleanupRequestHandlerTest() : cannot find index defn request_handler_test. No cleanup ...")
} else {
logging.Infof("RequestHandlerTest.cleanupRequestHandlerTest() : found index defn request_handler_test. Cleaning up ...")
err = mgr.HandleDeleteIndexDDL(common.IndexDefnId(500))
if err != nil {
t.Fatal(err)
}
time.Sleep(time.Duration(1000) * time.Millisecond)
// double check if we have really cleaned up
_, err := mgr.GetIndexDefnById(common.IndexDefnId(500))
if err == nil {
t.Fatal("RequestHandlerTest.cleanupRequestHandlerTest(): Cannot clean up index defn request_handler_test")
}
}
}
开发者ID:jchris,项目名称:indexing,代码行数:22,代码来源:request_handler_test.go
示例9: 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)
}
}
开发者ID:jchris,项目名称:indexing,代码行数:40,代码来源:metadata_provider_test.go
示例10: cleanupStreamMgrTimerTest
// clean up
func cleanupStreamMgrTimerTest(mgr *manager.IndexManager) {
_, err := mgr.GetIndexDefnById(common.IndexDefnId(406))
if err != nil {
logging.Infof("StreamMgrTest.cleanupStreamMgrTimerTest() : cannot find index defn stream_mgr_timer_test. No cleanup ...")
} else {
logging.Infof("StreamMgrTest.cleanupStreamMgrTimerTest() : found index defn stream_mgr_timer_test. Cleaning up ...")
err = mgr.HandleDeleteIndexDDL(common.IndexDefnId(406))
if err != nil {
util.TT.Fatal(err)
}
time.Sleep(time.Duration(1000) * time.Millisecond)
// double check if we have really cleaned up
_, err := mgr.GetIndexDefnById(common.IndexDefnId(406))
if err == nil {
util.TT.Fatal("StreamMgrTest.cleanupStreamMgrTimerTest(): Cannot clean up index defn stream_mgr_timer_test")
}
}
time.Sleep(time.Duration(1000) * time.Millisecond)
}
开发者ID:jchris,项目名称:indexing,代码行数:24,代码来源:stream_timer_test.go
注:本文中的github.com/couchbase/indexing/secondary/manager.IndexManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论