Browse Source

En cours de développement

master
losyme 2 months ago
parent
commit
28b8ec792b
  1. 4
      go.mod
  2. 8
      go.sum
  3. 11
      internal/storage/memory/jobs.go
  4. 13
      internal/storage/memory/workflows.go

4
go.mod

@ -3,8 +3,8 @@ module forge.chapril.org/dune/dune
go 1.17
require (
forge.chapril.org/dune/jw v0.0.0-20211124164443-54bdf5007b39
forge.chapril.org/dune/sdk v0.0.0-20211125142611-8e977b87697a
forge.chapril.org/dune/jw v0.0.0-20211126094337-5011155e7d32
forge.chapril.org/dune/sdk v0.0.0-20211126094413-f2c8d7cae712
forge.chapril.org/losyme/application v0.0.0-20211029102910-b7db6effc015
forge.chapril.org/losyme/cmdline v0.0.0-20211029192907-e6f74788c44f
forge.chapril.org/losyme/config v0.0.0-20211124132928-6e36812750b5

8
go.sum

@ -1,7 +1,7 @@
forge.chapril.org/dune/jw v0.0.0-20211124164443-54bdf5007b39 h1:rL9AvrSL89tgld9zy31cusqnuo9ORGmd4rCLroiYiC4=
forge.chapril.org/dune/jw v0.0.0-20211124164443-54bdf5007b39/go.mod h1:7CyK2ZvzHntSlOZ7kWcqVhkmUzlE0QI3uKW9kPbNbOY=
forge.chapril.org/dune/sdk v0.0.0-20211125142611-8e977b87697a h1:gwzPTY/XfYrGStkzMbEVtRZY76jvlWHK3D83RMfJeEE=
forge.chapril.org/dune/sdk v0.0.0-20211125142611-8e977b87697a/go.mod h1:1xvy88D/oZTmcMesjd6UHp7o3DVSsQWZPVcMSBHkoX8=
forge.chapril.org/dune/jw v0.0.0-20211126094337-5011155e7d32 h1:g2IrK2c0Nkz+AJbabpkDImtDxLddi97xpWDzAgQehCA=
forge.chapril.org/dune/jw v0.0.0-20211126094337-5011155e7d32/go.mod h1:LEDlIDkGkdvYAzSdZeucZDkbhkf0K5WUV7rTK8ILsc4=
forge.chapril.org/dune/sdk v0.0.0-20211126094413-f2c8d7cae712 h1:LplFsnhc/1Ap/oUISdYTgZFA4oTxvgf/i0glAdccH+Q=
forge.chapril.org/dune/sdk v0.0.0-20211126094413-f2c8d7cae712/go.mod h1:lI5NTCj9urBLdGAQaCUmWh7TV+wU4uIs1Z3NDi+irF8=
forge.chapril.org/losyme/application v0.0.0-20211029102910-b7db6effc015 h1:mZQ2kC2ucXI0lNRVyIOVEz3zu0ChOQ9wTPG0W69fI1Y=
forge.chapril.org/losyme/application v0.0.0-20211029102910-b7db6effc015/go.mod h1:olQo5n5tnBRHq0wcc0lNbymvsXdTuYaCjNfd2d/+01w=
forge.chapril.org/losyme/buffer v0.0.0-20211003203540-771701f5a518 h1:B7wu0DWUwpt0Mw/VTuWQZikhV/VD6kc2iJWbIY+jgEM=

11
internal/storage/memory/jobs.go

@ -29,9 +29,9 @@ func (m *memory) ValidateJob(_ *jw.Job) error {
func (m *memory) insertJob(job *jw.Job) (bool, error) {
if _, j := m.findJob(job.ID); j != nil {
return false, errors.New( //////////////////////////////////////////////////////////////////////////////////////
"this job identifier already exists",
"id", job.ID,
return false, errors.Wrap( /////////////////////////////////////////////////////////////////////////////////////
jw.ErrStorage,
errors.New("this job identifier already exists", "id", job.ID),
)
}
@ -64,7 +64,10 @@ func (m *memory) updateJob(job *jw.Job) error {
return nil
}
return errors.New("this job does not exist") ///////////////////////////////////////////////////////////////////////
return errors.Wrap( ////////////////////////////////////////////////////////////////////////////////////////////////
jw.ErrStorage,
errors.New("this job does not exist", "job", job.ID),
)
}
func (m *memory) UpdateJob(job *jw.Job) error {

13
internal/storage/memory/workflows.go

@ -30,9 +30,9 @@ func (m *memory) InsertWorkflow(wf *jw.Workflow, job *jw.Job) error {
defer m.sm.Unlock()
if _, w := m.findWorkflow(wf.ID); w != nil {
return errors.New( /////////////////////////////////////////////////////////////////////////////////////////////
"this workflow identifier already exists",
"id", wf.ID,
return errors.Wrap( ////////////////////////////////////////////////////////////////////////////////////////////
jw.ErrStorage,
errors.New("this workflow identifier already exists", "id", wf.ID),
)
}
@ -54,7 +54,7 @@ func (m *memory) Workflow(id string, mustExist bool) (*jw.Workflow, error) {
}
if mustExist {
return nil, errors.New("this workflow does not exist") /////////////////////////////////////////////////////////
return nil, errors.New("this workflow does not exist", "id", id) ///////////////////////////////////////////////
}
return nil, nil
@ -71,7 +71,10 @@ func (m *memory) UpdateWorkflow(wf *jw.Workflow, job, nextJob *jw.Job) error {
if wf != nil {
i, w := m.findWorkflow(wf.ID)
if w == nil {
return errors.New("this workflow does not exist") //////////////////////////////////////////////////////////
return errors.Wrap( ////////////////////////////////////////////////////////////////////////////////////////
jw.ErrStorage,
errors.New("this workflow does not exist", "wf", wf.ID),
)
}
m.workflows[i] = wf

Loading…
Cancel
Save