MCPcopy
hub / github.com/tinode/chat / Handler

Interface Handler

server/media/media.go:26–46  ·  view source on GitHub ↗

Handler is an interface which must be implemented by media handlers (uploaders-downloaders).

Source from the content-addressed store, hash-verified

24
25// Handler is an interface which must be implemented by media handlers (uploaders-downloaders).
26type Handler interface {
27 // Init initializes the media upload handler.
28 Init(jsconf string) error
29
30 // Headers checks if the handler wants to provide additional HTTP headers for the request.
31 // It could be CORS headers, redirect to serve files from another URL, cache-control headers.
32 // It returns headers as a map, HTTP status code to stop processing or 0 to continue, error.
33 Headers(method string, url *url.URL, headers http.Header, serve bool) (http.Header, int, error)
34
35 // Upload processes request for file upload. Returns file URL, file size, error.
36 Upload(fdef *types.FileDef, file io.Reader) (string, int64, error)
37
38 // Download processes request for file download.
39 Download(url string) (*types.FileDef, ReadSeekCloser, error)
40
41 // Delete deletes file from storage.
42 Delete(locations []string) error
43
44 // GetIdFromUrl extracts file ID from download URL.
45 GetIdFromUrl(url string) types.Uid
46}
47
48type AllowedOrigin struct {
49 Origin string

Callers 19

largeFileServeHTTPFunction · 0.65
largeFileReceiveHTTPFunction · 0.65
LargeFileServeMethod · 0.65
LargeFileReceiveMethod · 0.65
largeFileReceiveHTTPFunction · 0.65
LargeFileReceiveMethod · 0.65
UploadMethod · 0.65
largeFileServeHTTPFunction · 0.65
LargeFileServeMethod · 0.65
mainFunction · 0.65
writeOnceMethod · 0.65
topicDelMethod · 0.65

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…