comparison pkg/imports/wfsjob.go @ 5034:59a99655f34d

Added feedback support for StageDone.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 20 Mar 2020 12:28:04 +0100
parents ae3a1392f9d0
children c9bca9a9666c
comparison
equal deleted inserted replaced
5033:13d9820c1ea4 5034:59a99655f34d
47 description string 47 description string
48 depends [2][]string 48 depends [2][]string
49 49
50 newConsumer func(context.Context, *sql.Conn, Feedback) (WFSFeatureConsumer, error) 50 newConsumer func(context.Context, *sql.Conn, Feedback) (WFSFeatureConsumer, error)
51 51
52 stageDone func(context.Context, *sql.Tx, int64) error 52 stageDone func(context.Context, *sql.Tx, int64, Feedback) error
53 } 53 }
54 54
55 WFSFeatureJob struct { 55 WFSFeatureJob struct {
56 models.WFSImport 56 models.WFSImport
57 creator *WFSFeatureJobCreator 57 creator *WFSFeatureJobCreator
84 84
85 func (wfjc *WFSFeatureJobCreator) AutoAccept() bool { 85 func (wfjc *WFSFeatureJobCreator) AutoAccept() bool {
86 return wfjc.stageDone == nil 86 return wfjc.stageDone == nil
87 } 87 }
88 88
89 func (wfjc *WFSFeatureJobCreator) StageDone(ctx context.Context, tx *sql.Tx, id int64) error { 89 func (wfjc *WFSFeatureJobCreator) StageDone(
90 ctx context.Context,
91 tx *sql.Tx,
92 id int64,
93 feedback Feedback,
94 ) error {
90 if wfjc.stageDone == nil { 95 if wfjc.stageDone == nil {
91 return nil 96 return nil
92 } 97 }
93 return wfjc.stageDone(ctx, tx, id) 98 return wfjc.stageDone(ctx, tx, id, feedback)
94 } 99 }
95 100
96 func (wfjc *WFSFeatureJobCreator) Create() Job { 101 func (wfjc *WFSFeatureJobCreator) Create() Job {
97 return &WFSFeatureJob{creator: wfjc} 102 return &WFSFeatureJob{creator: wfjc}
98 } 103 }