Keeping a Running Total


I’m working on a site where I need to keep a running tab of inventory
sold. Each of my Item classes has a sku and a quantity. As items get
created, destroyed, and have their quantity changed, I want to alter
the value of a field called “allocated” in my sku class. Ideally, I
want to make this transactional, so the value of “allocated” doesn’t
fall out of sync. What is the best way to approach this?