mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-24 22:06:57 +00:00
open key-database deterministic
This commit is contained in:
parent
796f24262e
commit
5ca5020cfa
8 changed files with 94 additions and 48 deletions
19
server/database/setup.go
Normal file
19
server/database/setup.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
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,
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue