mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-03 13:00:37 +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
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg.Online {
|
|
||||||
rcfg, err := n.Repo.Config()
|
rcfg, err := n.Repo.Config()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if rcfg.Datastore.HashOnRead {
|
||||||
|
bs.RuntimeHashing(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
if cfg.Online {
|
||||||
do := setupDiscoveryOption(rcfg.Discovery)
|
do := setupDiscoveryOption(rcfg.Discovery)
|
||||||
if err := n.startOnlineServices(ctx, cfg.Routing, cfg.Host, do); err != nil {
|
if err := n.startOnlineServices(ctx, cfg.Routing, cfg.Host, do); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -17,6 +17,7 @@ type Datastore struct {
|
|||||||
|
|
||||||
Params *json.RawMessage
|
Params *json.RawMessage
|
||||||
NoSync bool
|
NoSync bool
|
||||||
|
HashOnRead bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Datastore) ParamData() []byte {
|
func (d *Datastore) ParamData() []byte {
|
||||||
|
Reference in New Issue
Block a user