( listenNetwork, listenAddr string, containerGraceTime time.Duration, readHeaderTimeout time.Duration, backend garden.Backend, logger lager.Logger, )
| 46 | } |
| 47 | |
| 48 | func New( |
| 49 | listenNetwork, listenAddr string, |
| 50 | containerGraceTime time.Duration, |
| 51 | readHeaderTimeout time.Duration, |
| 52 | backend garden.Backend, |
| 53 | logger lager.Logger, |
| 54 | ) *GardenServer { |
| 55 | s := &GardenServer{ |
| 56 | logger: logger.Session("garden-server"), |
| 57 | |
| 58 | listenNetwork: listenNetwork, |
| 59 | listenAddr: listenAddr, |
| 60 | |
| 61 | containerGraceTime: containerGraceTime, |
| 62 | backend: backend, |
| 63 | |
| 64 | stopping: make(chan bool), |
| 65 | |
| 66 | handling: new(sync.WaitGroup), |
| 67 | conns: make(map[net.Conn]net.Conn), |
| 68 | |
| 69 | streamer: streamer.New(time.Minute), |
| 70 | |
| 71 | destroys: make(map[string]struct{}), |
| 72 | destroysL: new(sync.Mutex), |
| 73 | |
| 74 | startMutex: new(sync.Mutex), |
| 75 | } |
| 76 | |
| 77 | handlers := map[string]http.Handler{ |
| 78 | routes.Ping: http.HandlerFunc(s.handlePing), |
| 79 | routes.Capacity: http.HandlerFunc(s.handleCapacity), |
| 80 | routes.Create: http.HandlerFunc(s.handleCreate), |
| 81 | routes.Destroy: http.HandlerFunc(s.handleDestroy), |
| 82 | routes.List: http.HandlerFunc(s.handleList), |
| 83 | routes.Stop: http.HandlerFunc(s.handleStop), |
| 84 | routes.StreamIn: http.HandlerFunc(s.handleStreamIn), |
| 85 | routes.StreamOut: http.HandlerFunc(s.handleStreamOut), |
| 86 | routes.CurrentBandwidthLimits: http.HandlerFunc(s.handleCurrentBandwidthLimits), |
| 87 | routes.CurrentCPULimits: http.HandlerFunc(s.handleCurrentCPULimits), |
| 88 | routes.CurrentDiskLimits: http.HandlerFunc(s.handleCurrentDiskLimits), |
| 89 | routes.CurrentMemoryLimits: http.HandlerFunc(s.handleCurrentMemoryLimits), |
| 90 | routes.NetIn: http.HandlerFunc(s.handleNetIn), |
| 91 | routes.NetOut: http.HandlerFunc(s.handleNetOut), |
| 92 | routes.BulkNetOut: http.HandlerFunc(s.handleBulkNetOut), |
| 93 | routes.Info: http.HandlerFunc(s.handleInfo), |
| 94 | routes.BulkInfo: http.HandlerFunc(s.handleBulkInfo), |
| 95 | routes.BulkMetrics: http.HandlerFunc(s.handleBulkMetrics), |
| 96 | routes.Run: http.HandlerFunc(s.handleRun), |
| 97 | routes.Stdout: streamer.HandlerFunc(s.streamer.ServeStdout), |
| 98 | routes.Stderr: streamer.HandlerFunc(s.streamer.ServeStderr), |
| 99 | routes.Attach: http.HandlerFunc(s.handleAttach), |
| 100 | routes.Metrics: http.HandlerFunc(s.handleMetrics), |
| 101 | routes.Properties: http.HandlerFunc(s.handleProperties), |
| 102 | routes.Property: http.HandlerFunc(s.handleProperty), |
| 103 | routes.SetProperty: http.HandlerFunc(s.handleSetProperty), |
| 104 | routes.RemoveProperty: http.HandlerFunc(s.handleRemoveProperty), |
| 105 | routes.SetGraceTime: http.HandlerFunc(s.handleSetGraceTime), |
no test coverage detected