func New(endpoints []string, options *store.Config) (store.Store, error) {
	var (
		db          *bolt.DB
		err         error
		boltOptions *bolt.Options
		timeout     = transientTimeout
	)
	if len(endpoints) > 1 {
		return nil, ErrMultipleEndpointsUnsupported
	}
	if (options == nil) || (len(options.Bucket) == 0) {
		return nil, ErrBoltBucketOptionMissing
	}
	dir, _ := filepath.Split(endpoints[0])
	if err = os.MkdirAll(dir, 0750); err != nil {
		return nil, err
	}
	if options.PersistConnection {
		boltOptions = &bolt.Options{Timeout: options.ConnectionTimeout}
		db, err = bolt.Open(endpoints[0], filePerm, boltOptions)
		if err != nil {
			return nil, err
		}
	}
	if options.ConnectionTimeout != 0 {
		timeout = options.ConnectionTimeout
	}
	b := &BoltDB{
		client:            db,
		path:              endpoints[0],
		boltBucket:        []byte(options.Bucket),
		timeout:           timeout,
		PersistConnection: options.PersistConnection,
	}
	return b, nil
}
New opens a new BoltDB connection to the specified path and bucket
package boltdb
import (
	"bytes"
	"encoding/binary"
	"errors"
	"os"
	"path/filepath"
	"sync"
	"sync/atomic"
	"time"
	"github.com/boltdb/bolt"
	"github.com/docker/libkv"
	"github.com/docker/libkv/store"
)
var (
	ErrMultipleEndpointsUnsupported = errors.New("boltdb supports one endpoint and should be a file path")
	ErrBoltBucketOptionMissing = errors.New("boltBucket config option missing")
)
const (
	filePerm os.FileMode = 0644
)
type BoltDB struct {
	client     *bolt.DB
	boltBucket []byte
	dbIndex    uint64
	path       string
	timeout    time.Duration
	PersistConnection bool
	sync.Mutex
}
const (
	libkvmetadatalen = 8
	transientTimeout = time.Duration(10) * time.Second
)
func Register() {
	libkv.AddStore(store.BOLTDB, New)
}