From 1009aeb54625687a668f4b0201fd60f03431add3 Mon Sep 17 00:00:00 2001 From: Tommi Virtanen Date: Fri, 8 May 2015 10:29:00 -0700 Subject: [PATCH] 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. --- pin/indirect.go | 4 ++-- pin/pin.go | 10 +++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/pin/indirect.go b/pin/indirect.go index a4cbde30faf..71188a5e144 100644 --- a/pin/indirect.go +++ b/pin/indirect.go @@ -11,9 +11,9 @@ type indirectPin struct { refCounts map[util.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[util.Key]int), } } diff --git a/pin/pin.go b/pin/pin.go index b5a825f33dd..f39de598ab9 100644 --- a/pin/pin.go +++ b/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" "github.com/ipfs/go-ipfs/blocks/set" mdag "github.com/ipfs/go-ipfs/merkledag" @@ -64,17 +63,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, }