milestone 2 complete
Some checks failed
CI / Test (pull_request) Failing after 6s
CI / Build (pull_request) Failing after 7s
CI / Lint (pull_request) Failing after 13s

This commit is contained in:
2025-10-10 19:03:31 -04:00
parent 4a517d104a
commit a0f80c5c7d
19 changed files with 2225 additions and 145 deletions

View File

@ -155,6 +155,25 @@ func (t *Transaction) Rollback(entryID uint64) error {
return nil
}
// Commit captures the final state and writes to oplog
func (t *Transaction) Commit(operation, description string) error {
// Capture state_after
stateAfter, err := t.stateCapture.CaptureState()
if err != nil {
return fmt.Errorf("failed to capture state: %w", err)
}
// Create oplog entry
entry := models.NewOplogEntry(0, operation, description, nil, stateAfter)
// Write to oplog
if err := t.oplogWriter.AppendEntry(entry); err != nil {
return fmt.Errorf("failed to write to oplog: %w", err)
}
return t.Close()
}
// Helper function to execute a transaction on a repository
func ExecuteWithTransaction(repo *OnyxRepository, operation, description string, fn func() error) error {
txn, err := NewTransaction(repo)