本文整理匯總了Golang中github.com/juju/juju/mongo.OplogTailer.Out方法的典型用法代碼示例。如果您正苦於以下問題:Golang OplogTailer.Out方法的具體用法?Golang OplogTailer.Out怎麽用?Golang OplogTailer.Out使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/juju/juju/mongo.OplogTailer
的用法示例。
在下文中一共展示了OplogTailer.Out方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: assertNoOplog
func (s *oplogSuite) assertNoOplog(c *gc.C, tailer *mongo.OplogTailer) {
select {
case _, ok := <-tailer.Out():
if !ok {
c.Fatalf("tailer unexpectedly died: %v", tailer.Err())
}
c.Fatal("unexpected oplog activity reported")
case <-time.After(coretesting.ShortWait):
// Success
}
}
示例2: getNextOplog
func (s *oplogSuite) getNextOplog(c *gc.C, tailer *mongo.OplogTailer) *mongo.OplogDoc {
select {
case doc, ok := <-tailer.Out():
if !ok {
c.Fatalf("tailer unexpectedly died: %v", tailer.Err())
}
return doc
case <-time.After(coretesting.LongWait):
c.Fatal("timed out waiting for oplog doc")
}
return nil
}
示例3: assertStopped
func (s *oplogSuite) assertStopped(c *gc.C, tailer *mongo.OplogTailer) {
// Output should close.
select {
case _, ok := <-tailer.Out():
c.Assert(ok, jc.IsFalse)
case <-time.After(coretesting.LongWait):
c.Fatal("tailer output should have closed")
}
// OplogTailer should die.
select {
case <-tailer.Dying():
// Success.
case <-time.After(coretesting.LongWait):
c.Fatal("tailer should have died")
}
}