1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-09 23:42:20 +08:00

Use flatfs to store objects under /blocks outside of LevelDB

WARNING: No migration performed! That needs to come in a separate
commit, perhaps amended into this one.

Migration must move keyspace "/b" from leveldb to the flatfs subdir,
while removing the "b" prefix (keys should start with just "/").
This commit is contained in:
Tommi Virtanen
2015-03-16 14:03:28 -07:00
committed by Juan Batiz-Benet
parent 4f4b894627
commit 24daeec70c
5 changed files with 57 additions and 7 deletions

View File

@ -18,7 +18,7 @@ import (
var log = eventlog.Logger("blockstore")
// BlockPrefix namespaces blockstore datastores
var BlockPrefix = ds.NewKey("b")
var BlockPrefix = ds.NewKey("blocks")
var ValueTypeMismatch = errors.New("The retrieved value is not a Block")
@ -89,6 +89,8 @@ func (bs *blockstore) AllKeysChan(ctx context.Context) (<-chan u.Key, error) {
// KeysOnly, because that would be _a lot_ of data.
q := dsq.Query{KeysOnly: true}
// datastore/namespace does *NOT* fix up Query.Prefix
q.Prefix = BlockPrefix.String()
res, err := bs.datastore.Query(q)
if err != nil {
return nil, err