Qijing, I don't believe that this is correct. I promised to send a description to the ML, I'll do that today.
-amrith On Sun, 2016-05-15 at 01:16 -0700, Qijing Li wrote: > Hi Vilobh, > > Here is my thoughts on how Delimiter uses generation-id to guarantee > sequencing. Please correct me if I understand it wrong. > > First, the Delimiter need to introduce another model ResourceProvider > who has two attributes: > > * resource_id > * generation_id > > The followings are the steps of how to consume a quota: > > Step 1. Check if there is enough available quota > > If yes, then get the $generation_id by querying the model > ResourceProvider with the given resource_id which is the point in time > view of resource usage. > > If no, terminate the process of consuming the quota and return the > message of “No enough quotas available." > > Step 2. Consume the quota. > > 2.1 Begin transaction > > 2.2 Update the QuotaUsage model: QuotaUsage.in_use = > QuotaUsage.in_use + amount of quota requested. > > 2.3 Get the $generation_id by querying the ResourceProvider by the > given resource_id. > > If the $generation_id is larger than the $generation_id in > Step 1, then roll back transaction and GOTO step 1. > > this case means there is someone else has changed the > QuotaUsage during this process. > > If the $generation_id is the same as the $generation_id in > Step 1, then increase the ResourceProvider.generation_id by one and > > Commit the transaction. Done! > > Note: no case the $generation_id is less than the > $generation_id in Step 1 because the $generation_id is nondecreasing. > > > — Qijing > > > __________________________________________________________________________ > OpenStack Development Mailing List (not for usage questions) > Unsubscribe: [email protected]?subject:unsubscribe > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
signature.asc
Description: This is a digitally signed message part
__________________________________________________________________________ OpenStack Development Mailing List (not for usage questions) Unsubscribe: [email protected]?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
