[PATCH 01/18] vinyl: rework internal quota API

Vladimir Davydov vdavydov.dev at gmail.com
Fri Aug 24 11:32:11 MSK 2018


On Mon, Aug 20, 2018 at 02:07:21PM +0300, Konstantin Osipov wrote:
> * Vladimir Davydov <vdavydov.dev at gmail.com> [18/08/16 23:03]:
> > + *
> > + * Usage pattern:
> > + *
> > + *   size_t reserved = <estimate>;
> > + *   if (vy_quota_try_use(q, reserved, timeout) != 0)
> > + *           return -1;
> > + *   <allocate memory>
> > + *   size_t used = <actually allocated>;
> > + *   vy_quota_commit_use(q, reserved, used);
> 
> How is this different from vy_quota_use(<estimate>); followed by
> vy_quota_release(<estimate> - <actually allocated>)? 
> 
> If vy_quota_commit_use() is actually release *or* force-use,
> depending on the sign of the result (<estimate> - <actually
> allocated>) then the new api is actually less clear than the old
> one.
> 
> If you would like to introduce a new call which would either
> release quota or force-use it, then this call should be called 
> vy_quota_adjust() or something like that, and the old call
> (vy_quota_use()) should be left intact. The new names are imho
> less clear.

NP, I'll rename vy_quota_try_use() back to vy_quota_use() and
vy_quota_commit_use() to vy_quota_adjust().



More information about the Tarantool-patches mailing list