27 lines
486 B
Go
27 lines
486 B
Go
package kvstore
|
|
|
|
import (
|
|
"path/filepath"
|
|
"time"
|
|
)
|
|
|
|
const (
|
|
commitInterval = 250 * time.Millisecond // How often to commit from WAL.
|
|
cleanInterval = time.Minute // How often to clean WAL.
|
|
cleanBeforeSecs = 86400 * 7 // Clean WAL entries older than.
|
|
)
|
|
|
|
func must(err error) {
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
func dataPath(dir string) string {
|
|
return filepath.Join(dir, "data")
|
|
}
|
|
|
|
func walPath(dir string) string {
|
|
return filepath.Join(dir, "wal")
|
|
}
|