本文整理匯總了Golang中github.com/BurntSushi/cablastp.DB類的典型用法代碼示例。如果您正苦於以下問題:Golang DB類的具體用法?Golang DB怎麽用?Golang DB使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了DB類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: cleanup
func cleanup(db *cablastp.DB) {
if len(flagCpuProfile) > 0 {
pprof.StopCPUProfile()
}
if len(flagMemProfile) > 0 {
writeMemProfile(fmt.Sprintf("%s.last", flagMemProfile))
}
db.ReadClose()
}
示例2: cleanup
// When the program ends (either by SIGTERM or when all of the input sequences
// are compressed), 'cleanup' is executed. It writes all CPU/memory profiles
// if they're enabled, waits for the compression workers to finish, saves
// the database to disk and closes all file handles.
func cleanup(db *cablastp.DB, pool *compressPool) {
if len(flagCpuProfile) > 0 {
pprof.StopCPUProfile()
}
if len(flagMemProfile) > 0 {
writeMemProfile(fmt.Sprintf("%s.last", flagMemProfile))
}
if len(flagMemStats) > 0 {
writeMemStats(fmt.Sprintf("%s.last", flagMemStats))
}
pool.done()
if err := db.Save(); err != nil {
fatalf("Could not save database: %s\n", err)
}
db.WriteClose()
}