1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-26 15:42:21 +08:00

pin: Remove code shadowing pins as datastore keys

These secondary copies were never actually queried, and didn't contain
the indirect refcounts so they couldn't become the authoritative
source anyway as is. New goal is to move pinning into IPFS objects.

A migration will be needed to remove the old data from the datastore.
This can happen at any time after this commit.

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
This commit is contained in:
Tommi Virtanen
2015-05-08 10:29:00 -07:00
committed by Jeromy
parent d586a3a05a
commit 6c0e42b87d
2 changed files with 5 additions and 9 deletions

View File

@ -11,9 +11,9 @@ type indirectPin struct {
refCounts map[key.Key]int
}
func newIndirectPin(dstore ds.Datastore) *indirectPin {
func newIndirectPin() *indirectPin {
return &indirectPin{
blockset: set.NewDBWrapperSet(dstore, set.NewSimpleBlockSet()),
blockset: set.NewSimpleBlockSet(),
refCounts: make(map[key.Key]int),
}
}

View File

@ -9,7 +9,6 @@ import (
"sync"
ds "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
nsds "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/namespace"
context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
key "github.com/ipfs/go-ipfs/blocks/key"
"github.com/ipfs/go-ipfs/blocks/set"
@ -65,17 +64,14 @@ type pinner struct {
func NewPinner(dstore ds.ThreadSafeDatastore, serv mdag.DAGService) Pinner {
// Load set from given datastore...
rcds := nsds.Wrap(dstore, recursePinDatastoreKey)
rcset := set.NewDBWrapperSet(rcds, set.NewSimpleBlockSet())
rcset := set.NewSimpleBlockSet()
dirds := nsds.Wrap(dstore, directPinDatastoreKey)
dirset := set.NewDBWrapperSet(dirds, set.NewSimpleBlockSet())
dirset := set.NewSimpleBlockSet()
nsdstore := nsds.Wrap(dstore, indirectPinDatastoreKey)
return &pinner{
recursePin: rcset,
directPin: dirset,
indirPin: newIndirectPin(nsdstore),
indirPin: newIndirectPin(),
dserv: serv,
dstore: dstore,
}