mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-29 09:34:03 +08:00
core: Add config option for datastore read rehashing
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
This commit is contained in:
@ -130,16 +130,22 @@ func setupNode(ctx context.Context, n *IpfsNode, cfg *BuildCfg) error {
|
||||
}
|
||||
|
||||
var err error
|
||||
n.Blockstore, err = bstore.WriteCached(bstore.NewBlockstore(n.Repo.Datastore()), kSizeBlockstoreWriteCache)
|
||||
bs := bstore.NewBlockstore(n.Repo.Datastore())
|
||||
n.Blockstore, err = bstore.WriteCached(bs, kSizeBlockstoreWriteCache)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if cfg.Online {
|
||||
rcfg, err := n.Repo.Config()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if rcfg.Datastore.HashOnRead {
|
||||
bs.RuntimeHashing(true)
|
||||
}
|
||||
|
||||
if cfg.Online {
|
||||
do := setupDiscoveryOption(rcfg.Discovery)
|
||||
if err := n.startOnlineServices(ctx, cfg.Routing, cfg.Host, do); err != nil {
|
||||
return err
|
||||
|
@ -17,6 +17,7 @@ type Datastore struct {
|
||||
|
||||
Params *json.RawMessage
|
||||
NoSync bool
|
||||
HashOnRead bool
|
||||
}
|
||||
|
||||
func (d *Datastore) ParamData() []byte {
|
||||
|
Reference in New Issue
Block a user