NewUriHandler parses the requested URI and finds the corresponding UriHandler. If the passed credentials are not nil, they will be used to override the default credentials (only for backups to minio or S3). Target URI formats: [scheme]://[host]/[path]?[args] [scheme]:///[path]?[args] /[path]?[ar
(uri *url.URL, creds *x.MinioCredentials)
| 135 | // file:///tmp/dgraph/backups |
| 136 | // /tmp/dgraph/backups?compress=gzip |
| 137 | func NewUriHandler(uri *url.URL, creds *x.MinioCredentials) (UriHandler, error) { |
| 138 | switch uri.Scheme { |
| 139 | case "file", "": |
| 140 | return NewFileHandler(uri), nil |
| 141 | case "minio", "s3": |
| 142 | return NewS3Handler(uri, creds) |
| 143 | } |
| 144 | return nil, errors.Errorf("Unable to handle url: %s", uri) |
| 145 | } |
| 146 | |
| 147 | // fileHandler is used for 'file:' URI scheme. |
| 148 | type fileHandler struct { |
no test coverage detected