@cryptotaxi247 / kubo / commits / 6c0e42b87

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>

Tommi Virtanen committed May 8, 2015 at 10:29 UTC 6c0e42b87d683e592d3c4ab3507d35a240bb36f5
2 files changed +5 -9
pin/indirect.go
+2 -2
@@ -11,9 +11,9 @@ type indirectPin struct {
11 refCounts map[key.Key]int
12 }
13
14 -func newIndirectPin(dstore ds.Datastore) *indirectPin {
14 +func newIndirectPin() *indirectPin {
15 return &indirectPin{
16 - blockset: set.NewDBWrapperSet(dstore, set.NewSimpleBlockSet()),
16 + blockset: set.NewSimpleBlockSet(),
17 refCounts: make(map[key.Key]int),
18 }
19 }
pin/pin.go
+3 -7
@@ -9,7 +9,6 @@ import (
9 "sync"
10
11 ds "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
12 - nsds "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/namespace"
12 context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
13 key "github.com/ipfs/go-ipfs/blocks/key"
14 "github.com/ipfs/go-ipfs/blocks/set"
@@ -65,17 +64,14 @@ type pinner struct {
64 func NewPinner(dstore ds.ThreadSafeDatastore, serv mdag.DAGService) Pinner {
65
66 // Load set from given datastore...
68 - rcds := nsds.Wrap(dstore, recursePinDatastoreKey)
69 - rcset := set.NewDBWrapperSet(rcds, set.NewSimpleBlockSet())
67 + rcset := set.NewSimpleBlockSet()
68
71 - dirds := nsds.Wrap(dstore, directPinDatastoreKey)
72 - dirset := set.NewDBWrapperSet(dirds, set.NewSimpleBlockSet())
69 + dirset := set.NewSimpleBlockSet()
70
74 - nsdstore := nsds.Wrap(dstore, indirectPinDatastoreKey)
71 return &pinner{
72 recursePin: rcset,
73 directPin: dirset,
78 - indirPin: newIndirectPin(nsdstore),
74 + indirPin: newIndirectPin(),
75 dserv: serv,
76 dstore: dstore,
77 }