Skip to content

Commit

Permalink
Refactors (#423)
Browse files Browse the repository at this point in the history
* JobStatus default value set to unknown to be safer

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* refactor main

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* more refactoring

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* internal deps encapsulated

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* more refactor

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* fix compile

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* use concrete scheduler

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* separate in logic files

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* more refactor

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* key namespace changes & fix proper closing of reputation module

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* fix

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* flaky test

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
  • Loading branch information
jsign authored May 29, 2020
1 parent 3d1f332 commit 6e22a66
Show file tree
Hide file tree
Showing 26 changed files with 801 additions and 888 deletions.
25 changes: 5 additions & 20 deletions api/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,11 @@ import (
"github.com/textileio/powergate/ffs/cidlogger"
"github.com/textileio/powergate/ffs/coreipfs"
"github.com/textileio/powergate/ffs/filcold"
"github.com/textileio/powergate/ffs/filcold/lotuschain"
"github.com/textileio/powergate/ffs/manager"
"github.com/textileio/powergate/ffs/minerselector/reptop"
ffsRpc "github.com/textileio/powergate/ffs/rpc"
"github.com/textileio/powergate/ffs/scheduler"
"github.com/textileio/powergate/ffs/scheduler/astore"
"github.com/textileio/powergate/ffs/scheduler/cistore"
"github.com/textileio/powergate/ffs/scheduler/jstore"
"github.com/textileio/powergate/filchain"
"github.com/textileio/powergate/gateway"
"github.com/textileio/powergate/health"
healthRpc "github.com/textileio/powergate/health/rpc"
Expand Down Expand Up @@ -79,9 +76,6 @@ type Server struct {
hm *health.Module

ffsManager *manager.Manager
js *jstore.Store
cis *cistore.Store
as *astore.Store
sched *scheduler.Scheduler
hs ffs.HotStorage
l *cidlogger.CidLogger
Expand Down Expand Up @@ -184,16 +178,13 @@ func NewServer(conf Config) (*Server, error) {
return nil, fmt.Errorf("creating ipfs client: %s", err)
}

lchain := lotuschain.New(c)
chain := filchain.New(c)
ms := reptop.New(rm, ai)

l := cidlogger.New(txndstr.Wrap(ds, "ffs/scheduler/logger"))
cs := filcold.New(ms, dm, ipfs, lchain, l)
l := cidlogger.New(txndstr.Wrap(ds, "ffs/cidlogger"))
cs := filcold.New(ms, dm, ipfs, chain, l)
hs := coreipfs.New(ipfs, l)
js := jstore.New(txndstr.Wrap(ds, "ffs/scheduler/jstore"))
as := astore.New(txndstr.Wrap(ds, "ffs/scheduler/astore"))
cis := cistore.New(txndstr.Wrap(ds, "ffs/scheduler/cistore"))
sched := scheduler.New(js, as, cis, l, hs, cs)
sched := scheduler.New(txndstr.Wrap(ds, "ffs/scheduler"), l, hs, cs)

ffsManager, err := manager.New(txndstr.Wrap(ds, "ffs/manager"), wm, sched)
if err != nil {
Expand Down Expand Up @@ -221,9 +212,6 @@ func NewServer(conf Config) (*Server, error) {

ffsManager: ffsManager,
sched: sched,
js: js,
cis: cis,
as: as,
hs: hs,
l: l,

Expand Down Expand Up @@ -387,9 +375,6 @@ func (s *Server) Close() {
if err := s.sched.Close(); err != nil {
log.Errorf("closing ffs scheduler: %s", err)
}
if err := s.js.Close(); err != nil {
log.Errorf("closing scheduler jobstore: %s", err)
}
if err := s.l.Close(); err != nil {
log.Errorf("closing cid logger: %s", err)
}
Expand Down
Loading

0 comments on commit 6e22a66

Please sign in to comment.