Documentation ¶
Index ¶
- type UploadService
- func (service *UploadService) Cleanup()
- func (service *UploadService) IsHealthy() bool
- func (service *UploadService) MainLoop(listener net.Listener, rpcListener net.Listener, tlsConfig *tls.Config) error
- func (service *UploadService) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (service *UploadService) UploadConfig(contents []byte)
- func (service *UploadService) UploadSingleFile(stream cstatic.UploadService_UploadSingleFileServer) error
- func (service *UploadService) WatchForConfigChanges(client *etcd.Client, etcdTimeout time.Duration, configPath string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UploadService ¶
type UploadService struct {
// contains filtered or unexported fields
}
UploadService implements the upload functionality for cstatic.
func (*UploadService) Cleanup ¶
func (service *UploadService) Cleanup()
Cleanup cancels all config watch operations currently in progress, closes all listeners and initiates an os.Exit call. It should be invoked in response to termination signals being received.
func (*UploadService) IsHealthy ¶
func (service *UploadService) IsHealthy() bool
IsHealthy determines whether the service is configured and ready to handle requests. If IsHealthy is false, any requests should be rejected.
func (*UploadService) MainLoop ¶
func (service *UploadService) MainLoop( listener net.Listener, rpcListener net.Listener, tlsConfig *tls.Config) error
MainLoop starts the HTTP server, registers the RPC handlers and serves any incoming requests.
func (*UploadService) ServeHTTP ¶
func (service *UploadService) ServeHTTP( w http.ResponseWriter, r *http.Request)
ServeHTTP proxies the incoming HTTP request onto the correct handler for gRPC, Prometheus or health checks.
func (*UploadService) UploadConfig ¶
func (service *UploadService) UploadConfig(contents []byte)
UploadConfig receives a new service configuration from etcd (via handler) and sets the internal data structures so we can start serving requests with the new configuration.
func (*UploadService) UploadSingleFile ¶
func (service *UploadService) UploadSingleFile( stream cstatic.UploadService_UploadSingleFileServer) error
UploadSingleFile uploads a single file to the store of the specified website.
func (*UploadService) WatchForConfigChanges ¶
func (service *UploadService) WatchForConfigChanges( client *etcd.Client, etcdTimeout time.Duration, configPath string)
WatchForConfigChanges watches the configured etcd location for updates and invokes UploadConfig as required.
This function should only ever be called once, during initialization, and will continue running in the background. Parallel invocations of this fuction on the same ContentService will block until the previous incarnation has exited.