本文整理匯總了Golang中github.com/influxdb/influxdb/datastore/storage.Engine.Del方法的典型用法代碼示例。如果您正苦於以下問題:Golang Engine.Del方法的具體用法?Golang Engine.Del怎麽用?Golang Engine.Del使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/influxdb/influxdb/datastore/storage.Engine
的用法示例。
在下文中一共展示了Engine.Del方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: queryAndDelete
func queryAndDelete(db storage.Engine, points, series int) {
// query the database
startCount := points / series / 4
endCount := points * 3 / series / 4
total := 0
var d time.Duration
for series -= 1; series >= 0; series-- {
count := 0
var delStart []byte
var delEnd []byte
query(db, int64(series), func(itr storage.Iterator) {
count++
if count == startCount {
delStart = itr.Key()
}
if count == endCount-1 {
delEnd = itr.Key()
total += endCount - startCount
}
})
start := time.Now()
err := db.Del(delStart, delEnd)
if err != nil {
panic(err)
}
d += time.Now().Sub(start)
}
fmt.Printf("Took %s to delete %d points\n", d, total)
start := time.Now()
db.Compact()
fmt.Printf("Took %s to compact\n", time.Now().Sub(start))
}