diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-01-05 14:24:49 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-01-05 14:24:49 (GMT) |
commit | f2e1ae7dc36e6894d5f8e1d5b512d6b5437d4f21 (patch) | |
tree | 20da85381e31e530eaf01536d29a77d00ba4b8bf /src | |
parent | 7506bd000e605d2f8c4f7069e1fbf9e6022e3e71 (diff) |
minor refactoring
Diffstat (limited to 'src')
-rw-r--r-- | src/helsinki.at/rhimport/core.go | 1 | ||||
-rw-r--r-- | src/helsinki.at/rhimport/session.go | 8 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/helsinki.at/rhimport/core.go b/src/helsinki.at/rhimport/core.go index 58633d8..f74f422 100644 --- a/src/helsinki.at/rhimport/core.go +++ b/src/helsinki.at/rhimport/core.go @@ -52,6 +52,7 @@ func init() { } type ImportProgressCB func(step int, stepName string, progress float64, userdata interface{}) bool +type ImportDoneCB func(ImportResult, interface{}) bool type ImportContext struct { conf *Config diff --git a/src/helsinki.at/rhimport/session.go b/src/helsinki.at/rhimport/session.go index 82ab3cf..80acee1 100644 --- a/src/helsinki.at/rhimport/session.go +++ b/src/helsinki.at/rhimport/session.go @@ -62,7 +62,7 @@ type SessionProgressCB struct { } type SessionDoneCB struct { - cb func(ImportResult, interface{}) bool + cb ImportDoneCB userdata interface{} } @@ -88,7 +88,7 @@ type sessionAddDoneHandlerResponse struct { type sessionAddDoneHandlerRequest struct { userdata interface{} - callback func(ImportResult, interface{}) bool + callback ImportDoneCB response chan<- sessionAddDoneHandlerResponse } @@ -148,7 +148,7 @@ func (self *Session) addProgressHandler(userdata interface{}, cb ImportProgressC return } -func (self *Session) addDoneHandler(userdata interface{}, cb func(ImportResult, interface{}) bool) (resp sessionAddDoneHandlerResponse) { +func (self *Session) addDoneHandler(userdata interface{}, cb ImportDoneCB) (resp sessionAddDoneHandlerResponse) { if self.state != SESSION_NEW && self.state != SESSION_RUNNING { resp.err = fmt.Errorf("session is already done/canceled") } @@ -262,7 +262,7 @@ func (self *SessionChan) AddProgressHandler(userdata interface{}, cb ImportProgr return res.err } -func (self *SessionChan) AddDoneHandler(userdata interface{}, cb func(ImportResult, interface{}) bool) error { +func (self *SessionChan) AddDoneHandler(userdata interface{}, cb ImportDoneCB) error { resCh := make(chan sessionAddDoneHandlerResponse) req := sessionAddDoneHandlerRequest{} req.userdata = userdata |