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
+3 -9
+3 -9
View File
@@ -27,8 +27,8 @@
// ИЗМЕНЕНО (2026): Удалены все вызовы MVCCManager.
// Time-travel реализован через WAL (см. transactions.go).
//
// ИЗМЕНЕНО (2026): Добавлено AOF-логирование в Insert, Update, Delete,
// PermanentDelete, RestoreDeleted (см. aof.go).
// ИЗМЕНЕНО (2026-10): Удалены вызовы LogAOFInsert/Update/Delete/Restore.
// AOF удалён, единственный источник истины — WAL.
//
// ИСПРАВЛЕНО (2026-10):
// 1. CountAll/CountDeleted/count-семантика приведены в порядок.
@@ -428,7 +428,6 @@ func (c *Collection) Insert(doc *Document) error {
c.mu.Unlock()
AuditDocumentOperation("INSERT", c.dbName, c.name, doc.ID, doc.GetFields())
LogAOFInsert(c.dbName, c.name, doc)
c.executeTriggers("AFTER_INSERT", doc.ID, doc.GetFields())
return nil
@@ -568,7 +567,6 @@ func (c *Collection) Update(id string, updates map[string]interface{}) error {
c.mu.Unlock()
AuditDocumentOperation("UPDATE", c.dbName, c.name, id, updates)
LogAOFUpdate(c.dbName, c.name, id, updates)
c.executeTriggers("AFTER_UPDATE", id, newDoc.GetFields())
return nil
}
@@ -608,8 +606,6 @@ func (c *Collection) Delete(id string) error {
AuditDocumentOperation("DELETE", c.dbName, c.name, id, nil)
}
LogAOFDelete(c.dbName, c.name, id)
c.mu.Lock()
c.metadata.DocumentCount = c.docCount.Load()
c.metadata.UpdatedAt = time.Now().UnixMilli()
@@ -642,7 +638,6 @@ func (c *Collection) PermanentDelete(id string) error {
c.mu.Unlock()
AuditDocumentOperation("PERMANENT_DELETE", c.dbName, c.name, id, nil)
LogAOFDelete(c.dbName, c.name, id)
return nil
}
@@ -668,7 +663,6 @@ func (c *Collection) RestoreDeleted(id string) error {
c.mu.Unlock()
AuditDocumentOperation("RESTORE", c.dbName, c.name, id, nil)
LogAOFRestore(c.dbName, c.name, id)
return nil
}
@@ -1788,4 +1782,4 @@ func toFloat64(val interface{}) (float64, bool) {
default:
return 0, false
}
}
}