func()

in tx.go [174:203]


func (tx *Tx) onCommit() {
	allocStats := &tx.alloc.stats

	fileStats := &tx.file.stats
	fileStats.Size = uint64(tx.file.sizeEstimate)
	fileStats.MetaArea = tx.file.allocator.metaTotal
	fileStats.MetaAllocated = tx.file.allocator.metaTotal - tx.file.allocator.meta.freelist.Avail()
	fileStats.DataAllocated += allocStats.data.alloc - allocStats.data.freed - allocStats.toMeta

	o := tx.file.observer
	if o == nil {
		return
	}

	read := tx.accessStats.Read
	updated := tx.accessStats.Update
	new := tx.accessStats.New

	o.OnTxClose(tx.file.stats, TxStats{
		Readonly:  false,
		Commit:    true,
		Duration:  time.Since(tx.tsStart),
		Total:     read + updated + new,
		Accessed:  read,
		Allocated: allocStats.data.alloc - allocStats.toMeta,
		Freed:     allocStats.data.freed,
		Written:   updated + new,
		Updated:   updated,
	})
}