@@ -21,6 +21,7 @@ func (a Action) String() string {
2121
2222var (
2323 ActionFind = Action {"find" }
24+ ActionFixity = Action {"fixity" }
2425 ActionMove = Action {"move" }
2526 ActionReplicate = Action {"Replicate" }
2627 ActionIndex = Action {"index" }
@@ -57,6 +58,7 @@ func StartEvent(a Action) Event {
5758 }
5859}
5960
61+ // EndEvent marks the AIP with the provided status and stores the event.
6062func EndEvent (ctx context.Context , s AIPStatus , a * App , e Event , aip * models.Aip ) error {
6163 e .End = time .Now ()
6264 if err := a .UpdateAIPStatus (ctx , aip .ID , s ); err != nil {
@@ -69,13 +71,15 @@ func EndEvent(ctx context.Context, s AIPStatus, a *App, e Event, aip *models.Aip
6971 return aip .InsertEvents (ctx , a .DB , setter )
7072}
7173
74+ // EndEventNoChange stores the event without changing the AIP status.
7275func EndEventNoChange (ctx context.Context , a * App , e Event , aip * models.Aip ) error {
7376 if err := aip .Reload (ctx , a .DB ); err != nil {
7477 return err
7578 }
7679 return EndEvent (ctx , AIPStatus (aip .Status ), a , e , aip )
7780}
7881
82+ // EndEventErr records the error, marks the AIP as failed, and stores the event.
7983func EndEventErr (ctx context.Context , a * App , e Event , aip * models.Aip , eventErr string ) error {
8084 e .End = time .Now ()
8185 a .AddAIPError (ctx , aip , eventErr )
@@ -89,6 +93,17 @@ func EndEventErr(ctx context.Context, a *App, e Event, aip *models.Aip, eventErr
8993 return aip .InsertEvents (ctx , a .DB , setter )
9094}
9195
96+ // EndEventErrNoFailure records the error and stores the event without changing the AIP status.
97+ func EndEventErrNoFailure (ctx context.Context , a * App , e Event , aip * models.Aip , eventErr string ) error {
98+ e .End = time .Now ()
99+ a .AddAIPError (ctx , aip , eventErr )
100+ setter , err := EventToSetter (e )
101+ if err != nil {
102+ return err
103+ }
104+ return aip .InsertEvents (ctx , a .DB , setter )
105+ }
106+
92107func EventToSetter (e Event ) (* models.EventSetter , error ) {
93108 formatDetails , err := e .FormatDetails ()
94109 if err != nil {
0 commit comments