Skip to content

Commit

Permalink
pin: Remove code shadowing pins as datastore keys
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tv42 committed May 11, 2015
1 parent a55f480 commit 1009aeb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions pin/indirect.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
}
Expand Down
10 changes: 3 additions & 7 deletions pin/pin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
}
Expand Down

0 comments on commit 1009aeb

Please sign in to comment.