1
0
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:
Jakub Sztandera
2016-06-24 22:10:31 +02:00
parent f2686965ac
commit 0f3dc1e84a
2 changed files with 14 additions and 7 deletions

View File

@ -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

View File

@ -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 {