mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2024-12-01 02:35:28 +00:00
20 lines
399 B
Go
20 lines
399 B
Go
|
package database
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"github.com/akrylysov/pogreb"
|
||
|
"github.com/akrylysov/pogreb/fs"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
func New(path string) (KeyDB, error) {
|
||
|
if path == "" {
|
||
|
return nil, fmt.Errorf("path not set")
|
||
|
}
|
||
|
return pogreb.Open(path, &pogreb.Options{
|
||
|
BackgroundSyncInterval: 30 * time.Second,
|
||
|
BackgroundCompactionInterval: 6 * time.Hour,
|
||
|
FileSystem: fs.OSMMap,
|
||
|
})
|
||
|
}
|