func (l SecondaryLayer) Put(k string, finalizers ...func()) (added int) {
	l.lock.Lock()
	l.store.Put(k, func(oldV *FinalizerList, exists bool) (newV *FinalizerList, write bool) {
		if !exists || oldV == nil {
			if len(finalizers) == 0 {
				return nil, true
			}
			oldV = &FinalizerList{}
		}
		for i := range finalizers {
			if oldV.AddFinalizer(finalizers[i]) {
				added++
			}
		}
		return oldV, true
	})
	l.lock.Unlock()
	return
}
Put adds finalizers for the key, creating the item if not exists yet.
package btree2d
import (
	"io"
	"sync/atomic"
	"github.com/zenhotels/btree-2d/lockie"
	"github.com/zenhotels/btree-2d/util"
)
type SecondaryCmpFunc func(key1, key2 string) int
type SecondaryLayer struct {
	store  *SecondaryTree
	offset uint64
	synced *uint64  
	lock   lockie.Lockie
	cmp    SecondaryCmpFunc
}
func NewSecondaryLayer(cmp SecondaryCmpFunc) SecondaryLayer {
	var synced uint64
	return SecondaryLayer{
		synced: &synced,
		store:  NewSecondaryTree(cmp),
		offset: uint64(util.RevOffset()),
		lock:   lockie.NewLockie(),
		cmp:    cmp,
	}
}
func (l SecondaryLayer) Rev() uint64 {
	return l.store.Ver() + l.offset
}