api

package
v1.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2024 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close(ctx context.Context) error

Close represents the graceful shutting down of the http server

Types

type Downloader

type Downloader interface {
	// Download retrieves/creates the file requested in the http.Request , returning:
	// body - a reader with the contents of the file. This must be closed by the caller.
	// headers - should include Content-Type and Content-Disposition
	// status - the http status code - should be 200 unless there was an error
	// err - any error that occurred during processing
	Download(r *http.Request) (body io.ReadCloser, headers map[string]string, status int, err error)
	// Type returns the (conceptual) type of file downloaded - forms part of the request path handled by this Downloader
	Type() string
	// QueryParameters returns the names of query parameters required by this Downloader
	QueryParameters() []string
}

Downloader defines the functions that are assigned to handle get requests

type DownloaderAPI

type DownloaderAPI struct {
	// contains filtered or unexported fields
}

DownloaderAPI manages requests to download files, calling the necessary backend services to fulfill the request

func StartDownloaderAPI

func StartDownloaderAPI(ctx context.Context, cfg *config.Config, errorChan chan error, hc *healthcheck.HealthCheck, downloaders ...Downloader) *DownloaderAPI

StartDownloaderAPI manages all the routes configured to the downloader

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL