]> git.giacomolli.uk - onechat/blobdiff - log.go
Name the tool schemas of the prompt
[onechat] / log.go
diff --git a/log.go b/log.go
index dfb6e7098ab1df2048da5c96604f37ef6e591345..c3d7190be9d6fa85467bc5a06cf1c1d7cbd4019b 100644 (file)
--- a/log.go
+++ b/log.go
@@ -7,14 +7,10 @@ import (
        "fmt"
        "os"
        "path/filepath"
        "fmt"
        "os"
        "path/filepath"
-       "syscall"
        "time"
        "unicode/utf8"
 )
 
        "time"
        "unicode/utf8"
 )
 
-// errLocked tells that another process owns the chat.
-var errLocked = errors.New("another process owns the chat")
-
 // kinds holds the kinds that a message can have.
 var kinds = map[string]bool{
        "user":  true,
 // kinds holds the kinds that a message can have.
 var kinds = map[string]bool{
        "user":  true,
@@ -250,23 +246,3 @@ func validateMessage(message Message) error {
 
        return nil
 }
 
        return nil
 }
-
-// lockFile opens the file at path and takes an exclusive lock on it. The lock
-// stays until the file closes or the process ends.
-func lockFile(path string) (*os.File, error) {
-       file, err := os.OpenFile(path, os.O_CREATE|os.O_RDWR, 0o600)
-       if err != nil {
-               return nil, fmt.Errorf("open lock file: %w", err)
-       }
-
-       err = syscall.Flock(int(file.Fd()), syscall.LOCK_EX|syscall.LOCK_NB)
-       if errors.Is(err, syscall.EWOULDBLOCK) {
-               err = errLocked
-       }
-
-       if err != nil {
-               return nil, errors.Join(fmt.Errorf("lock chat: %w", err), file.Close())
-       }
-
-       return file, nil
-}