zotregistry.io/zot@v1.4.4-0.20231124084042-02a8ed785457/pkg/meta/boltdb/parameters.go (about)

     1  package boltdb
     2  
     3  import (
     4  	"path"
     5  	"time"
     6  
     7  	bolt "go.etcd.io/bbolt"
     8  )
     9  
    10  type DBParameters struct {
    11  	RootDir string
    12  }
    13  
    14  func GetBoltDriver(params DBParameters) (*bolt.DB, error) {
    15  	const perms = 0o600
    16  
    17  	boltDB, err := bolt.Open(path.Join(params.RootDir, "meta.db"), perms, &bolt.Options{Timeout: time.Second * 10})
    18  	if err != nil {
    19  		return nil, err
    20  	}
    21  
    22  	return boltDB, nil
    23  }