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 | 6648578c53782af4334bb6e44b231d2cd7e22aa4 (patch) | |
tree | bc89456ac47480788102ad9adc9dab70e57425fc | |
parent | 00a14226835ba540d2c7675d3fac7cc2ab7f7695 (diff) |
minor refactoring
-rw-r--r-- | core.go | 1 | ||||
-rw-r--r-- | session.go | 8 |
2 files changed, 5 insertions, 4 deletions
@@ -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 @@ -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 |