diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-01-05 14:33:38 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-01-05 14:33:38 (GMT) |
commit | f390aaa79bef626f69ced73b3eeb1f1ffea93c6d (patch) | |
tree | f8ec04c2a7a7e7485c7541f2a3c108adbdcee084 /src/helsinki.at/rhimport/fetcher.go | |
parent | f2e1ae7dc36e6894d5f8e1d5b512d6b5437d4f21 (diff) |
replaces FetchResult by ImportResult
Diffstat (limited to 'src/helsinki.at/rhimport/fetcher.go')
-rw-r--r-- | src/helsinki.at/rhimport/fetcher.go | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/helsinki.at/rhimport/fetcher.go b/src/helsinki.at/rhimport/fetcher.go index 55b814c..f5d5420 100644 --- a/src/helsinki.at/rhimport/fetcher.go +++ b/src/helsinki.at/rhimport/fetcher.go @@ -39,11 +39,6 @@ import ( "time" ) -type FetchResult struct { - ResponseCode int - ErrorString string -} - type FetcherCurlCBData struct { basepath string filename string @@ -91,7 +86,7 @@ func curlWriteCallback(ptr []byte, userdata interface{}) bool { return true } -func fetchFileCurl(ctx *ImportContext, res *FetchResult, uri *url.URL) (err error) { +func fetchFileCurl(ctx *ImportContext, res *ImportResult, uri *url.URL) (err error) { rhl.Printf("curl-based fetcher called for '%s'", ctx.SourceUri) easy := curl.EasyInit() @@ -155,7 +150,7 @@ func fetchFileCurl(ctx *ImportContext, res *FetchResult, uri *url.URL) (err erro return } -func fetchFileLocal(ctx *ImportContext, res *FetchResult, uri *url.URL) (err error) { +func fetchFileLocal(ctx *ImportContext, res *ImportResult, uri *url.URL) (err error) { rhl.Printf("Local fetcher called for '%s'", ctx.SourceUri) if ctx.ProgressCallBack != nil { if keep := ctx.ProgressCallBack(1, "fetching", 0.0, ctx.ProgressCallBackData); !keep { @@ -192,7 +187,7 @@ func fetchFileLocal(ctx *ImportContext, res *FetchResult, uri *url.URL) (err err return } -func fetchFileFake(ctx *ImportContext, res *FetchResult, uri *url.URL) error { +func fetchFileFake(ctx *ImportContext, res *ImportResult, uri *url.URL) error { rhdl.Printf("Fake fetcher for '%s'", ctx.SourceUri) if duration, err := strconv.ParseUint(uri.Host, 10, 32); err != nil { @@ -226,7 +221,7 @@ func fetchFileFake(ctx *ImportContext, res *FetchResult, uri *url.URL) error { return nil } -type FetchFunc func(*ImportContext, *FetchResult, *url.URL) (err error) +type FetchFunc func(*ImportContext, *ImportResult, *url.URL) (err error) // TODO: implement fetchers for: // archiv:// @@ -262,7 +257,7 @@ func fetcherInit() { } } -func checkPassword(ctx *ImportContext, result *FetchResult) (err error) { +func checkPassword(ctx *ImportContext, result *ImportResult) (err error) { ok := false if ok, err = ctx.rddb.CheckPassword(ctx.UserName, ctx.Password); err != nil { return @@ -274,8 +269,8 @@ func checkPassword(ctx *ImportContext, result *FetchResult) (err error) { return } -func FetchFile(ctx *ImportContext) (res *FetchResult, err error) { - res = &FetchResult{ResponseCode: http.StatusOK} +func FetchFile(ctx *ImportContext) (res *ImportResult, err error) { + res = &ImportResult{ResponseCode: http.StatusOK} var uri *url.URL if uri, err = url.Parse(ctx.SourceUri); err != nil { |