forked from celestiaorg/celestia-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstructors.go
More file actions
39 lines (32 loc) · 941 Bytes
/
Copy pathconstructors.go
File metadata and controls
39 lines (32 loc) · 941 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package pruner
import (
"github.com/ipfs/go-datastore"
libhead "github.com/celestiaorg/go-header"
headsync "github.com/celestiaorg/go-header/sync"
"github.com/celestiaorg/celestia-node/header"
"github.com/celestiaorg/celestia-node/nodebuilder/p2p"
modshare "github.com/celestiaorg/celestia-node/nodebuilder/share"
"github.com/celestiaorg/celestia-node/pruner"
)
// ensures Pruner always starts after Syncer
type syncerAnchor = headsync.Syncer[*header.ExtendedHeader]
func newPrunerService(
p pruner.Pruner,
window modshare.Window,
getter libhead.Store[*header.ExtendedHeader],
_ *syncerAnchor,
ds datastore.Batching,
opts []pruner.Option,
) (*pruner.Service, error) {
serv, err := pruner.NewService(p, window.Duration(), getter, ds, p2p.BlockTime, opts...)
if err != nil {
return nil, err
}
if MetricsEnabled {
err := pruner.WithPrunerMetrics(serv)
if err != nil {
return nil, err
}
}
return serv, nil
}