MINOR: hlua_fcn: add Patref:purge() method
It is a special Lua Patref method: it bypasses the commit/prepare logic and purges the whole pattern reference items pointed to by Patref Lua object (all versions, not just the current one). It doesn't have a cli equivalent: it leverages pat_ref_purge_range().
This commit is contained in:
parent
fe394598c5
commit
fda5ca3472
@ -3456,6 +3456,11 @@ Patref class
|
||||
:returns: true if the pattern reference is used to handle maps instead
|
||||
of acl, false otherwise.
|
||||
|
||||
.. js:function:: Patref.purge(ref)
|
||||
|
||||
Completely prune all pattern reference entries pointed to by Patref object.
|
||||
This special operation doesn't require committing.
|
||||
|
||||
.. js:function:: Patref.prepare(ref)
|
||||
|
||||
Create a new empty version for Patref Object. It can be used to manipulate
|
||||
|
@ -2705,6 +2705,18 @@ int hlua_patref_prepare(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int hlua_patref_purge(lua_State *L)
|
||||
{
|
||||
struct hlua_patref *ref;
|
||||
|
||||
ref = hlua_checkudata(L, 1, class_patref_ref);
|
||||
BUG_ON(!ref);
|
||||
|
||||
lua_pushinteger(L, 0); // from
|
||||
lua_pushinteger(L, ~0); // to
|
||||
return _hlua_patref_clear(L, LUA_OK, 0);
|
||||
}
|
||||
|
||||
void hlua_fcn_new_patref(lua_State *L, struct pat_ref *ref)
|
||||
{
|
||||
struct hlua_patref *_ref;
|
||||
@ -2734,6 +2746,7 @@ void hlua_fcn_new_patref(lua_State *L, struct pat_ref *ref)
|
||||
hlua_class_function(L, "is_map", hlua_patref_is_map);
|
||||
hlua_class_function(L, "prepare", hlua_patref_prepare);
|
||||
hlua_class_function(L, "commit", hlua_patref_commit);
|
||||
hlua_class_function(L, "purge", hlua_patref_purge);
|
||||
}
|
||||
|
||||
int hlua_patref_gc(lua_State *L)
|
||||
|
Loading…
x
Reference in New Issue
Block a user