Getter defines the interface that schemes must implement to download things.
| 27 | // Getter defines the interface that schemes must implement to download |
| 28 | // things. |
| 29 | type Getter interface { |
| 30 | // Get downloads the given URL into the given directory. This always |
| 31 | // assumes that we're updating and gets the latest version that it can. |
| 32 | // |
| 33 | // The directory may already exist (if we're updating). If it is in a |
| 34 | // format that isn't understood, an error should be returned. Get shouldn't |
| 35 | // simply nuke the directory. |
| 36 | Get(context.Context, *Request) error |
| 37 | |
| 38 | // GetFile downloads the give URL into the given path. The URL must |
| 39 | // reference a single file. If possible, the Getter should check if |
| 40 | // the remote end contains the same file and no-op this operation. |
| 41 | GetFile(context.Context, *Request) error |
| 42 | |
| 43 | // Mode returns the mode based on the given URL. This is used to |
| 44 | // allow clients to let the getters decide which mode to use. |
| 45 | Mode(context.Context, *url.URL) (Mode, error) |
| 46 | |
| 47 | // Detect detects whether the Request.Src matches a known pattern to |
| 48 | // turn it into a proper URL, and also transforms and update Request.Src |
| 49 | // when necessary. |
| 50 | // The Getter must validate if the Request.Src is a valid URL |
| 51 | // with a valid scheme for the Getter, and also check if the |
| 52 | // current Getter is the forced one and return true if that's the case. |
| 53 | Detect(*Request) (bool, error) |
| 54 | } |
| 55 | |
| 56 | // Getters is the mapping of scheme to the Getter implementation that will |
| 57 | // be used to get a dependency. |
no outgoing calls
no test coverage detected