pages-server/server/database/setup.go

20 lines
399 B
Go
Raw Normal View History

2021-12-03 03:15:48 +00:00
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,
})
}