本文整理汇总了Golang中github.com/cloudfoundry/hm9000/store.NewStore函数的典型用法代码示例。如果您正苦于以下问题:Golang NewStore函数的具体用法?Golang NewStore怎么用?Golang NewStore使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewStore函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: makeHandlerAndStore
func makeHandlerAndStore(conf HandlerConf) (http.Handler, store.Store, error) {
config, _ := config.DefaultConfig()
store := store.NewStore(config, conf.StoreAdapter, fakelogger.NewFakeLogger())
handler, err := handlers.New(conf.Logger, store, conf.TimeProvider)
return handler, store, err
}
开发者ID:cgrotz,项目名称:hm9000,代码行数:8,代码来源:bulk_app_state_test.go
示例2: connectToStore
func connectToStore(l logger.Logger, conf *config.Config) (store.Store, metricsaccountant.UsageTracker) {
if conf.StoreType == "etcd" || conf.StoreType == "ZooKeeper" {
adapter, workerPool := connectToStoreAdapter(l, conf)
return store.NewStore(conf, adapter, l), workerPool
} else {
l.Error(fmt.Sprintf("Unknown store type %s. Choose one of 'etcd' or 'ZooKeeper'", conf.StoreType), fmt.Errorf("Unkown store type"))
os.Exit(1)
}
return nil, nil
}
开发者ID:karlpilkington,项目名称:golang-devops-stuff,代码行数:11,代码来源:common.go
示例3: PrepForNextTest
func (coordinator *MCATCoordinator) PrepForNextTest() (*CLIRunner, *Simulator, *startstoplistener.StartStopListener) {
coordinator.StoreRunner.Reset()
coordinator.startStopListener.Reset()
coordinator.StateServer.Reset()
if coordinator.currentCLIRunner != nil {
coordinator.currentCLIRunner.Cleanup()
}
coordinator.currentCLIRunner = NewCLIRunner(coordinator.StoreRunner.NodeURLS(), coordinator.DesiredStateServerBaseUrl, coordinator.NatsPort, coordinator.MetricsServerPort, coordinator.Verbose)
store := storepackage.NewStore(coordinator.Conf, coordinator.StoreAdapter, fakelogger.NewFakeLogger())
simulator := NewSimulator(coordinator.Conf, coordinator.StoreRunner, store, coordinator.StateServer, coordinator.currentCLIRunner, coordinator.MessageBus)
return coordinator.currentCLIRunner, simulator, coordinator.startStopListener
}
开发者ID:philwhln,项目名称:hm9000,代码行数:14,代码来源:mcat_coordinator_test.go
示例4: main
func main() {
cmdsToStop = []*exec.Cmd{}
registerSignalHandler()
nats = natsrunner.NewNATSRunner(4222)
nats.Start()
fakeCC := desiredstateserver.NewDesiredStateServer()
go fakeCC.SpinUp(6001)
// etcd = storerunner.NewETCDClusterRunner(4001, 1)
// etcd.Start()
conf, _ := config.FromFile("./config.json")
adapter := storeadapter.NewETCDStoreAdapter(conf.StoreURLs, workerpool.NewWorkerPool(30))
adapter.Connect()
store = storepackage.NewStore(conf, adapter, fakelogger.NewFakeLogger())
r := rand.New(rand.NewSource(time.Now().Unix()))
num, err := strconv.Atoi(os.Args[1])
if err != nil {
panic(err)
}
sim := simulator.New(num, 10, r, nats.MessageBus, fakeCC)
//start all the HM components (make them pipe to stdout)
start("listen", false)
start("fetch_desired", true)
start("analyze", true)
start("send", true)
start("serve_metrics", false)
start("serve_api", false)
time.Sleep(time.Second)
go Tick(sim)
go Fetch()
select {}
}
开发者ID:pivotal-cf-experimental,项目名称:hmperformance,代码行数:36,代码来源:benchmarks.go
示例5: connectToStore
func connectToStore(l logger.Logger, conf *config.Config) (store.Store, metricsaccountant.UsageTracker) {
adapter, workerPool := connectToStoreAdapter(l, conf)
return store.NewStore(conf, adapter, l), workerPool
}
开发者ID:tomzhang,项目名称:golang-devops-stuff,代码行数:4,代码来源:common.go
示例6:
"github.com/cloudfoundry/storeadapter/fakestoreadapter"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"time"
)
var _ = Describe("Metrics Accountant", func() {
var store storepackage.Store
var accountant MetricsAccountant
var fakeStoreAdapter *fakestoreadapter.FakeStoreAdapter
conf, _ := config.DefaultConfig()
BeforeEach(func() {
fakeStoreAdapter = fakestoreadapter.New()
store = storepackage.NewStore(conf, fakeStoreAdapter, fakelogger.NewFakeLogger())
accountant = New(store)
})
Describe("Getting Metrics", func() {
Context("when the store is empty", func() {
It("should return a map of 0s", func() {
metrics, err := accountant.GetMetrics()
Ω(err).ShouldNot(HaveOccurred())
Ω(metrics).Should(Equal(map[string]float64{
"StartCrashed": 0,
"StartMissing": 0,
"StartEvacuating": 0,
"StopExtra": 0,
"StopDuplicate": 0,
"StopEvacuationComplete": 0,
开发者ID:nkts,项目名称:golang-devops-stuff,代码行数:31,代码来源:metricsaccountant_test.go
示例7: connectToStoreAndTrack
func connectToStoreAndTrack(l logger.Logger, conf *config.Config) (store.Store, metricsaccountant.UsageTracker) {
tracker := newUsageTracker(conf.StoreMaxConcurrentRequests)
adapter := connectToStoreAdapter(l, conf)
return store.NewStore(conf, adapter, l), tracker
}
开发者ID:nagyistge,项目名称:hm9000,代码行数:5,代码来源:common.go
示例8: connectToStore
func connectToStore(l logger.Logger, conf *config.Config) store.Store {
adapter := connectToStoreAdapter(l, conf)
return store.NewStore(conf, adapter, l)
}
开发者ID:nagyistge,项目名称:hm9000,代码行数:4,代码来源:common.go
示例9:
resultChan chan desiredstatefetcher.DesiredStateFetcherResult
)
BeforeEach(func() {
resultChan = make(chan desiredstatefetcher.DesiredStateFetcherResult, 1)
a1 = app.NewApp()
a2 = app.NewApp()
a3 = app.NewApp()
stateServer.SetDesiredState([]models.DesiredAppState{
a1.DesiredState(0),
a2.DesiredState(0),
a3.DesiredState(0),
})
fetcher = desiredstatefetcher.New(conf, natsRunner.MessageBus, store.NewStore(conf, storeAdapter), httpclient.NewHttpClient(), &timeprovider.RealTimeProvider{})
fetcher.Fetch(resultChan)
})
It("requests for the first set of data from the CC and stores the response", func() {
var node storeadapter.StoreNode
var err error
Eventually(func() error {
node, err = storeAdapter.Get("/desired/" + a1.AppGuid + "-" + a1.AppVersion)
return err
}, 1, 0.1).ShouldNot(HaveOccured())
Ω(node.TTL).Should(BeNumerically("<=", 10*60))
Ω(node.TTL).Should(BeNumerically(">=", 10*60-1))
Ω(node.Value).Should(Equal(a1.DesiredState(0).ToJson()))
开发者ID:Zhann,项目名称:hm9000,代码行数:31,代码来源:desired_state_fetcher_integration_test.go
注:本文中的github.com/cloudfoundry/hm9000/store.NewStore函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论