Split the monolithic transaction into focused modules: append-only crash-recoverable journal under ~/.elydora/transactions with owner tokens and per-transaction namespaces, staged atomic publication (stage .pending, fsync, rename, fsync), platform-specific atomic replacement (MoveFileEx, renameat2, renamex_np), private-directory hardening per OS, lock-guarded recovery, and workspace cleanup that removes only transaction-created empty directories. Add the Kiro IDE 1.0 plugin: strict v1 hook schema with one enabled PreToolUse guard and PostToolUse audit pair bound to the active workspace, agent-to-workspace identity binding in runtime config, and exact migration of the legacy elydora-audit.kiro.hook contract. Gates: go test ./... and -race pass, go vet clean, govulncheck reports zero reachable vulnerabilities, git diff --check clean.
31 lines
424 B
Go
31 lines
424 B
Go
//go:build windows
|
|
|
|
package plugins
|
|
|
|
import (
|
|
"os"
|
|
|
|
"golang.org/x/sys/windows"
|
|
)
|
|
|
|
func lockTransactionFile(file *os.File) error {
|
|
return windows.LockFileEx(
|
|
windows.Handle(file.Fd()),
|
|
windows.LOCKFILE_EXCLUSIVE_LOCK,
|
|
0,
|
|
1,
|
|
0,
|
|
&windows.Overlapped{},
|
|
)
|
|
}
|
|
|
|
func unlockTransactionFile(file *os.File) error {
|
|
return windows.UnlockFileEx(
|
|
windows.Handle(file.Fd()),
|
|
0,
|
|
1,
|
|
0,
|
|
&windows.Overlapped{},
|
|
)
|
|
}
|