Skip to content
Snippets Groups Projects
Commit 6c0e42b8 authored by Tommi Virtanen's avatar Tommi Virtanen Committed by Jeromy Johnson
Browse files

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: default avatarJeromy <jeromyj@gmail.com>
parent d586a3a0
Branches
No related tags found
1 merge request!1New
...@@ -11,9 +11,9 @@ type indirectPin struct { ...@@ -11,9 +11,9 @@ type indirectPin struct {
refCounts map[key.Key]int refCounts map[key.Key]int
} }
func newIndirectPin(dstore ds.Datastore) *indirectPin { func newIndirectPin() *indirectPin {
return &indirectPin{ return &indirectPin{
blockset: set.NewDBWrapperSet(dstore, set.NewSimpleBlockSet()), blockset: set.NewSimpleBlockSet(),
refCounts: make(map[key.Key]int), refCounts: make(map[key.Key]int),
} }
} }
......
...@@ -9,7 +9,6 @@ import ( ...@@ -9,7 +9,6 @@ import (
"sync" "sync"
ds "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore" 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" context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
key "github.com/ipfs/go-ipfs/blocks/key" key "github.com/ipfs/go-ipfs/blocks/key"
"github.com/ipfs/go-ipfs/blocks/set" "github.com/ipfs/go-ipfs/blocks/set"
...@@ -65,17 +64,14 @@ type pinner struct { ...@@ -65,17 +64,14 @@ type pinner struct {
func NewPinner(dstore ds.ThreadSafeDatastore, serv mdag.DAGService) Pinner { func NewPinner(dstore ds.ThreadSafeDatastore, serv mdag.DAGService) Pinner {
// Load set from given datastore... // Load set from given datastore...
rcds := nsds.Wrap(dstore, recursePinDatastoreKey) rcset := set.NewSimpleBlockSet()
rcset := set.NewDBWrapperSet(rcds, set.NewSimpleBlockSet())
dirds := nsds.Wrap(dstore, directPinDatastoreKey) dirset := set.NewSimpleBlockSet()
dirset := set.NewDBWrapperSet(dirds, set.NewSimpleBlockSet())
nsdstore := nsds.Wrap(dstore, indirectPinDatastoreKey)
return &pinner{ return &pinner{
recursePin: rcset, recursePin: rcset,
directPin: dirset, directPin: dirset,
indirPin: newIndirectPin(nsdstore), indirPin: newIndirectPin(),
dserv: serv, dserv: serv,
dstore: dstore, dstore: dstore,
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment