1

I'm working on a project that requires GAAP accounting conformance for deferred revenue collection. Cash is converted to a proprietary "currency" or credits. These credits may have different values based upon the purchase price at time of conversion (including exchange rate fluctuations).

As each purchase is made, the amount is deducted from the earliest "bucket" of credits until they are exhausted and the next eldest bucket is encountered. The valuation of the credits spent define the total revenue for that particular purchase... so it may differ for each product simply based upon the order of credits and debits / the value of each credit.

My sequential mind sees this as an easy imperative problem. With the data I'm capturing, I can replay the transaction logs and arrive at a daily total for revenue for each customer and each product... that can then be amortized for the services provided. No problem.

My data is in a sharded MongoDB cluster of replica sets. Dumping it and writing a post-processing script is easy, but I'd love to be able to report directly out of it.

I've played with simple MapReduce operations in the past. Is there any way to sequentially process a transaction log? While normal transaction logs can be processed in parallel, and I've done this, I just can't seem to find a way to twist MapReduce (MongoDB or Hadoop) to replay in order. I don't think it can be done. Am I wrong or just a n00b?

My only options at this point are post-processing replay, manipulating currency buckets at time of purchase or utilizing something I've overlooked... perhaps I'm not thinking enough outside the box here.

Any brief insights or pointers are greatly appreciated.

4

0 回答 0