mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-26 07:28:20 +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:
@ -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),
|
||||
}
|
||||
}
|
||||
|
10
pin/pin.go
10
pin/pin.go
@ -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,
|
||||
}
|
||||
|
Reference in New Issue
Block a user