common: Implement the "token bucket" rate limiter

Add a generic implementation of this common rate limiting algorithm.

Change-Id: I8737479c5cee6b4f4462468a3bac9776885dca5d