generated from artefactual-sdps/preprocessing-base
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The preprocessing result signature expected by Enduro was updated in commit 9564b21 [1]. This commit adds a workflow Outcome and a Bag creation event to the PreservationTasks in the returned results. Changes: - Add the "EventOutcome" enum for use in the PreservationTasks results - Add a `make gen-enums` target to the Makefile to support generating and updating enumerable value lists - Add the eventlog module for structuring PreservationTasks results - Update the name of the `bagit` activity to `bagcreate` and update its method names - Add a bag creation event to the workflow with success and error messages - Add a system error workflow test [1] artefactual-sdps/enduro@9564b21
- Loading branch information
Showing
15 changed files
with
539 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
$(call _assert_var,MAKEDIR) | ||
$(call _conditional_include,$(MAKEDIR)/base.mk) | ||
$(call _assert_var,UNAME_OS) | ||
$(call _assert_var,UNAME_ARCH) | ||
$(call _assert_var,CACHE_VERSIONS) | ||
$(call _assert_var,CACHE_BIN) | ||
|
||
GO_ENUM_VERSION ?= 0.6.0 | ||
|
||
GO_ENUM := $(CACHE_VERSIONS)/go-enum/$(GO_ENUM_VERSION) | ||
$(GO_ENUM): | ||
rm -f $(CACHE_BIN)/go-enum | ||
mkdir -p $(CACHE_BIN) | ||
curl -sSL \ | ||
https://github.com/abice/go-enum/releases/download/v$(GO_ENUM_VERSION)/go-enum_$(UNAME_OS)_$(UNAME_ARCH) \ | ||
> $(CACHE_BIN)/go-enum | ||
chmod +x $(CACHE_BIN)/go-enum | ||
rm -rf $(dir $(GO_ENUM)) | ||
mkdir -p $(dir $(GO_ENUM)) | ||
touch $(GO_ENUM) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
ENUMS := \ | ||
internal/enums/event_outcome_enum.go | ||
|
||
$(ENUMS): GO_ENUM_FLAGS=--marshal --names --ptr --flag --sql --template=$(CURDIR)/hack/make/enums.tmpl | ||
|
||
gen-enums: $(ENUMS) # @HELP Generate go-enum assets. | ||
|
||
%_enum.go: %.go $(GO_ENUM) hack/make/enums.mk hack/make/enums.tmpl | ||
go-enum -f $*.go $(GO_ENUM_FLAGS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Values implements the entgo.io/ent/schema/field EnumValues interface. | ||
func (x {{.enum.Name}}) Values() []string { | ||
return {{.enum.Name}}Names() | ||
} | ||
|
||
// {{.enum.Name}}Interfaces returns an interface list of possible values of {{.enum.Name}}. | ||
func {{.enum.Name}}Interfaces() []interface{} { | ||
var tmp []interface{} | ||
for _, v := range _{{.enum.Name}}Names { | ||
tmp = append(tmp, v) | ||
} | ||
return tmp | ||
} | ||
|
||
// Parse{{.enum.Name}}WithDefault attempts to convert a string to a ContentType. | ||
// It returns the default value if name is empty. | ||
func Parse{{.enum.Name}}WithDefault(name string) ({{.enum.Name}}, error) { | ||
if name == "" { | ||
return _{{.enum.Name}}Value[_{{.enum.Name}}Names[0]], nil | ||
} | ||
if x, ok := _{{.enum.Name}}Value[name]; ok { | ||
return x, nil | ||
} | ||
return {{.enum.Name}}(""), fmt.Errorf("%s is not a valid {{.enum.Name}}, try [%s]", name, strings.Join(_{{.enum.Name}}Names, ", ")) | ||
} | ||
|
||
// Normalize{{.enum.Name}} attempts to parse a and normalize string as content type. | ||
// It returns the input untouched if name fails to be parsed. | ||
// Example: | ||
// | ||
// "enUM" will be normalized (if possible) to "Enum" | ||
func Normalize{{.enum.Name}}(name string) string { | ||
res, err := Parse{{.enum.Name}}(name) | ||
if err != nil { | ||
return name | ||
} | ||
return res.String() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package enums | ||
|
||
// ENUM( | ||
// unspecified | ||
// success | ||
// system failure | ||
// validation failure | ||
// ). | ||
type EventOutcome string |
Oops, something went wrong.