Update internal/storage/collection.go

This commit is contained in:
gvsafronov committed 2026-10-06 21:42:15 +00:00
1 parent dd5f11fd3d
commit bd6c8acda6
1 file changed
+2 -8
+2 -8
View File
@@ -27,8 +27,8 @@
// ИЗМЕНЕНО (2026): Удалены все вызовы MVCCManager. // ИЗМЕНЕНО (2026): Удалены все вызовы MVCCManager.
// Time-travel реализован через WAL (см. transactions.go). // Time-travel реализован через WAL (см. transactions.go).
// //
// ИЗМЕНЕНО (2026): Добавлено AOF-логирование в Insert, Update, Delete, // ИЗМЕНЕНО (2026-10): Удалены вызовы LogAOFInsert/Update/Delete/Restore.
// PermanentDelete, RestoreDeleted (см. aof.go). // AOF удалён, единственный источник истины — WAL.
// //
// ИСПРАВЛЕНО (2026-10): // ИСПРАВЛЕНО (2026-10):
// 1. CountAll/CountDeleted/count-семантика приведены в порядок. // 1. CountAll/CountDeleted/count-семантика приведены в порядок.
@@ -428,7 +428,6 @@ func (c *Collection) Insert(doc *Document) error {
c.mu.Unlock() c.mu.Unlock()
AuditDocumentOperation("INSERT", c.dbName, c.name, doc.ID, doc.GetFields()) AuditDocumentOperation("INSERT", c.dbName, c.name, doc.ID, doc.GetFields())
LogAOFInsert(c.dbName, c.name, doc)
c.executeTriggers("AFTER_INSERT", doc.ID, doc.GetFields()) c.executeTriggers("AFTER_INSERT", doc.ID, doc.GetFields())
return nil return nil
@@ -568,7 +567,6 @@ func (c *Collection) Update(id string, updates map[string]interface{}) error {
c.mu.Unlock() c.mu.Unlock()
AuditDocumentOperation("UPDATE", c.dbName, c.name, id, updates) AuditDocumentOperation("UPDATE", c.dbName, c.name, id, updates)
LogAOFUpdate(c.dbName, c.name, id, updates)
c.executeTriggers("AFTER_UPDATE", id, newDoc.GetFields()) c.executeTriggers("AFTER_UPDATE", id, newDoc.GetFields())
return nil return nil
} }
@@ -608,8 +606,6 @@ func (c *Collection) Delete(id string) error {
AuditDocumentOperation("DELETE", c.dbName, c.name, id, nil) AuditDocumentOperation("DELETE", c.dbName, c.name, id, nil)
} }
LogAOFDelete(c.dbName, c.name, id)
c.mu.Lock() c.mu.Lock()
c.metadata.DocumentCount = c.docCount.Load() c.metadata.DocumentCount = c.docCount.Load()
c.metadata.UpdatedAt = time.Now().UnixMilli() c.metadata.UpdatedAt = time.Now().UnixMilli()
@@ -642,7 +638,6 @@ func (c *Collection) PermanentDelete(id string) error {
c.mu.Unlock() c.mu.Unlock()
AuditDocumentOperation("PERMANENT_DELETE", c.dbName, c.name, id, nil) AuditDocumentOperation("PERMANENT_DELETE", c.dbName, c.name, id, nil)
LogAOFDelete(c.dbName, c.name, id)
return nil return nil
} }
@@ -668,7 +663,6 @@ func (c *Collection) RestoreDeleted(id string) error {
c.mu.Unlock() c.mu.Unlock()
AuditDocumentOperation("RESTORE", c.dbName, c.name, id, nil) AuditDocumentOperation("RESTORE", c.dbName, c.name, id, nil)
LogAOFRestore(c.dbName, c.name, id)
return nil return nil
} }