mirror of
https://github.com/project-zot/zot.git
synced 2024-12-16 21:56:37 -05:00
4fb1e756c4
- MetaDB stores the time of the last update of a repo - During startup we check if the layout has been updated after the last recorded change in the db - If this is the case, the repo is parsed and updated in the DB otherwise it's skipped Signed-off-by: Laurentiu Niculae <niculae.laurentiu1@gmail.com>
23 lines
372 B
Go
23 lines
372 B
Go
package boltdb
|
|
|
|
import (
|
|
"path"
|
|
"time"
|
|
|
|
bolt "go.etcd.io/bbolt"
|
|
)
|
|
|
|
type DBParameters struct {
|
|
RootDir string
|
|
}
|
|
|
|
func GetBoltDriver(params DBParameters) (*bolt.DB, error) {
|
|
const perms = 0o600
|
|
|
|
boltDB, err := bolt.Open(path.Join(params.RootDir, "meta.db"), perms, &bolt.Options{Timeout: time.Second * 10})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return boltDB, nil
|
|
}
|