Commit d19f2eff authored by Jeromy's avatar Jeromy

Correct pinning for dagmodifier, and a bunch more tests

parent 437724c9
......@@ -47,6 +47,7 @@ type Pinner interface {
// may not be successful
type ManualPinner interface {
PinWithMode(util.Key, PinMode)
RemovePinWithMode(util.Key, PinMode)
Pinner
}
......@@ -198,6 +199,20 @@ func (p *pinner) IsPinned(key util.Key) bool {
p.indirPin.HasKey(key)
}
func (p *pinner) RemovePinWithMode(key util.Key, mode PinMode) {
switch mode {
case Direct:
p.directPin.RemoveBlock(key)
case Indirect:
p.indirPin.Decrement(key)
case Recursive:
p.recursePin.RemoveBlock(key)
default:
// programmer error, panic OK
panic("unrecognized pin type")
}
}
// LoadPinner loads a pinner and its keysets from the given datastore
func LoadPinner(d ds.ThreadSafeDatastore, dserv mdag.DAGService) (Pinner, error) {
p := new(pinner)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment