Store session history, preferences, and dated records in one database per home. Commit complete turns, checkpoint tool batches, and compact history by prefix. Add memory search and writes, with previews for ambiguous corrections. Review conversations in the background and support SQLite backup and restore.
18 lines
299 B
Go
18 lines
299 B
Go
//go:build linux || darwin || freebsd || netbsd || openbsd || dragonfly
|
|
|
|
package memory
|
|
|
|
import (
|
|
"os"
|
|
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
func lockFile(f *os.File, exclusive bool) error {
|
|
flag := unix.LOCK_SH
|
|
if exclusive {
|
|
flag = unix.LOCK_EX
|
|
}
|
|
return unix.Flock(int(f.Fd()), flag|unix.LOCK_NB)
|
|
}
|