Skip to content

Commit daf7e2b

Browse files
committed
chore: remove unused code
1 parent 6d1c4ee commit daf7e2b

File tree

1 file changed

+0
-58
lines changed

1 file changed

+0
-58
lines changed

commands/setup.go

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package commands
22

33
import (
4-
"context"
54
"errors"
65
"fmt"
76
"net/http"
@@ -35,35 +34,6 @@ import (
3534

3635
var log = logging.Logger("visor")
3736

38-
// RunContext wraps lens and DB connections.
39-
type RunContext struct {
40-
Opener lens.APIOpener
41-
Closer lens.APICloser
42-
DB *storage.Database
43-
}
44-
45-
// SetupStorageAndAPI setups of the sentinel database and returns a
46-
// ready-to-use RunContext with Openers and Closers using the chosen lens.
47-
func SetupStorageAndAPI(cctx *cli.Context) (context.Context, *RunContext, error) {
48-
ctx := cctx.Context
49-
opener, closer, err := setupLens(cctx)
50-
if err != nil {
51-
return nil, nil, xerrors.Errorf("setup lens: %w", err)
52-
}
53-
54-
db, err := setupDatabase(cctx)
55-
if err != nil {
56-
closer()
57-
return nil, nil, xerrors.Errorf("setup database: %w", err)
58-
}
59-
60-
return ctx, &RunContext{
61-
Opener: opener,
62-
Closer: closer,
63-
DB: db,
64-
}, nil
65-
}
66-
6737
func setupDatabase(cctx *cli.Context) (*storage.Database, error) {
6838
ctx := cctx.Context
6939
db, err := storage.NewDatabase(ctx, cctx.String("db"), cctx.Int("db-pool-size"), cctx.String("name"), cctx.Bool("db-allow-upsert"))
@@ -200,34 +170,6 @@ func setupLogging(cctx *cli.Context) error {
200170
return nil
201171
}
202172

203-
const (
204-
ChainHeadIndexerLockID = 98981111
205-
ChainHistoryIndexerLockID = 98981112
206-
ChainVisRefresherLockID = 98981113
207-
ProcessingStatsRefresherLockID = 98981114
208-
)
209-
210-
func NewGlobalSingleton(id int64, d *storage.Database) *GlobalSingleton {
211-
return &GlobalSingleton{
212-
LockID: storage.AdvisoryLock(id),
213-
Storage: d,
214-
}
215-
}
216-
217-
// GlobalSingleton is a task locker that ensures only one task can run across all processes
218-
type GlobalSingleton struct {
219-
LockID storage.AdvisoryLock
220-
Storage *storage.Database
221-
}
222-
223-
func (g *GlobalSingleton) Lock(ctx context.Context) error {
224-
return g.LockID.LockExclusive(ctx, g.Storage.DB)
225-
}
226-
227-
func (g *GlobalSingleton) Unlock(ctx context.Context) error {
228-
return g.LockID.UnlockExclusive(ctx, g.Storage.DB)
229-
}
230-
231173
func setupMetrics(cctx *cli.Context) error {
232174
// setup Prometheus
233175
registry := prom.NewRegistry()

0 commit comments

Comments
 (0)