changeset 4980:21d2acc080c9

Add the ability to be staged to the WFS feature downloader. This will be needed for FD downloads.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 04 Mar 2020 15:36:06 +0100
parents ee12730acd73
children 9f0830a1845d
files pkg/imports/wfsjob.go
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/imports/wfsjob.go	Tue Mar 03 18:13:57 2020 +0100
+++ b/pkg/imports/wfsjob.go	Wed Mar 04 15:36:06 2020 +0100
@@ -48,6 +48,8 @@
 		depends     [2][]string
 
 		newConsumer func(context.Context, *sql.Conn, Feedback) (WFSFeatureConsumer, error)
+
+		stageDone func(context.Context, *sql.Tx, int64) error
 	}
 
 	WFSFeatureJob struct {
@@ -64,13 +66,15 @@
 	return wfjc.depends
 }
 
-func (*WFSFeatureJobCreator) AutoAccept() bool {
-	return true
+func (wfjc *WFSFeatureJobCreator) AutoAccept() bool {
+	return wfjc.stageDone == nil
 }
 
-// StageDone is a NOP for WFS imports.
-func (*WFSFeatureJobCreator) StageDone(context.Context, *sql.Tx, int64) error {
-	return nil
+func (wfjc *WFSFeatureJobCreator) StageDone(ctx context.Context, tx *sql.Tx, id int64) error {
+	if wfjc.stageDone == nil {
+		return nil
+	}
+	return wfjc.stageDone(ctx, tx, id)
 }
 
 func (wfjc *WFSFeatureJobCreator) Create() Job {