本文整理匯總了Golang中github.com/Symantec/scotty/store.Store.SetExpanding方法的典型用法代碼示例。如果您正苦於以下問題:Golang Store.SetExpanding方法的具體用法?Golang Store.SetExpanding怎麽用?Golang Store.SetExpanding使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/Symantec/scotty/store.Store
的用法示例。
在下文中一共展示了Store.SetExpanding方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: createApplicationStats
func createApplicationStats(
appList *datastructs.ApplicationList,
logger *log.Logger,
tagvAdder suggest.Adder,
maybeNilMemoryManager *memoryManagerType) *datastructs.ApplicationStatuses {
var astore *store.Store
fmt.Println("Initialization started.")
if maybeNilMemoryManager != nil {
memoryManager := maybeNilMemoryManager
astore = store.NewStoreBytesPerPage(
*fBytesPerPage,
1,
*fThreshhold,
*fDegree)
astore.SetExpanding(true)
memoryManager.SetMemory(astore)
if err := memoryManager.RegisterMetrics(); err != nil {
log.Fatal(err)
}
} else {
astore = store.NewStoreBytesPerPage(
*fBytesPerPage, *fPageCount, *fThreshhold, *fDegree)
}
dirSpec, err := tricorder.RegisterDirectory("/store")
if err != nil {
log.Fatal(err)
}
if err := astore.RegisterMetrics(dirSpec); err != nil {
log.Fatal(err)
}
stats := datastructs.NewApplicationStatuses(appList, astore)
mdbChannel := mdbd.StartMdbDaemon(*fMdbFile, logger)
machines := <-mdbChannel
theHostNames := hostNames(machines.Machines)
for _, aName := range theHostNames {
tagvAdder.Add(aName)
}
stats.MarkHostsActiveExclusively(
duration.TimeToFloat(time.Now()), theHostNames)
fmt.Println("Initialization complete.")
// Endpoint refresher goroutine
go func() {
for {
machines := <-mdbChannel
stats.MarkHostsActiveExclusively(
duration.TimeToFloat(time.Now()),
hostNames(machines.Machines))
}
}()
return stats
}