Exemple #1
0
// GetStartServerFunc builds memory api server
func (f MemoryFactory) GetStartServerFunc() StartServerFunc {
	return func() (chan<- string, <-chan error) {
		_, _, driver := memory.Start(f.MaxMemory, f.Expiration)
		conf := api.Config{RateLimit: f.RateLimit}
		conf.SetDriver(driver)
		ctrl, status, _ := httpserver.Start(api.HTTPHandler(conf), f.Config)
		return ctrl, status
	}
}
Exemple #2
0
// GetStartServerFunc DonutFactory builds donut api server
func (f DonutFactory) GetStartServerFunc() StartServerFunc {
	return func() (chan<- string, <-chan error) {
		_, _, driver := donut.Start(f.Paths)
		conf := api.Config{RateLimit: f.RateLimit}
		conf.SetDriver(driver)
		ctrl, status, _ := httpserver.Start(api.HTTPHandler(conf), f.Config)
		return ctrl, status
	}
}
Exemple #3
0
// GetStartServerFunc DonutFactory builds donut api server
func (f DonutFactory) GetStartServerFunc() StartServerFunc {
	return func() (chan<- string, <-chan error) {
		driver, err := donut.NewDriver(f.Paths, f.MaxMemory, f.Expiration)
		if err != nil {
			log.Fatalln(err)
		}
		conf := api.Config{RateLimit: f.RateLimit}
		conf.SetDriver(driver)
		ctrl, status, _ := httpserver.Start(api.HTTPHandler(conf), f.Config)
		return ctrl, status
	}
}