-
Notifications
You must be signed in to change notification settings - Fork 19
feat(shdict): multi-subsystems lua_shared_dict support #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Note: should revert |
build apisix-base with: api7/apisix-build-tools#190 |
end | ||
|
||
- zone = ngx_lua_ffi_shdict_udata_to_zone(zone) | ||
+ zone = C.ngx_meta_lua_ffi_shdict_udata_to_zone(zone) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to use ngx_lua_ffi_shdict_udata_to_zone and update it with ngx_lua_ffi_shdict_udata_to_zone = C.ngx_meta_lua_ffi_shdict_udata_to_zone
. And other similar places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now it looks like
local ngx_lua_ffi_shdict_get
local ngx_lua_ffi_shdict_incr
local ngx_lua_ffi_shdict_store
local ngx_lua_ffi_shdict_flush_all
local ngx_lua_ffi_shdict_get_ttl
local ngx_lua_ffi_shdict_set_expire
local ngx_lua_ffi_shdict_capacity
local ngx_lua_ffi_shdict_free_space
local ngx_lua_ffi_shdict_udata_to_zone
ffi.cdef[[
int ngx_meta_lua_ffi_shdict_get(void *zone, const unsigned char *key,
size_t key_len, int *value_type, unsigned char **str_value_buf,
size_t *str_value_len, double *num_value, int *user_flags,
int get_stale, int *is_stale, char **errmsg);
int ngx_meta_lua_ffi_shdict_incr(void *zone, const unsigned char *key,
size_t key_len, double *value, char **err, int has_init,
double init, long init_ttl, int *forcible);
int ngx_meta_lua_ffi_shdict_store(void *zone, int op,
const unsigned char *key, size_t key_len, int value_type,
const unsigned char *str_value_buf, size_t str_value_len,
double num_value, long exptime, int user_flags, char **errmsg,
int *forcible);
int ngx_meta_lua_ffi_shdict_flush_all(void *zone);
long ngx_meta_lua_ffi_shdict_get_ttl(void *zone,
const unsigned char *key, size_t key_len);
int ngx_meta_lua_ffi_shdict_set_expire(void *zone,
const unsigned char *key, size_t key_len, long exptime);
size_t ngx_meta_lua_ffi_shdict_capacity(void *zone);
void *ngx_meta_lua_ffi_shdict_udata_to_zone(void *zone_udata);
]]
if not pcall(function ()
return C.ngx_meta_lua_ffi_shdict_free_space
end)
then
ffi.cdef[[
size_t ngx_meta_lua_ffi_shdict_free_space(void *zone);
]]
end
pcall(function ()
ngx_lua_ffi_shdict_get = C.ngx_meta_lua_ffi_shdict_get
ngx_lua_ffi_shdict_incr = C.ngx_meta_lua_ffi_shdict_incr
ngx_lua_ffi_shdict_store = C.ngx_meta_lua_ffi_shdict_store
ngx_lua_ffi_shdict_flush_all = C.ngx_meta_lua_ffi_shdict_flush_all
ngx_lua_ffi_shdict_get_ttl = C.ngx_meta_lua_ffi_shdict_get_ttl
ngx_lua_ffi_shdict_set_expire = C.ngx_meta_lua_ffi_shdict_set_expire
ngx_lua_ffi_shdict_capacity = C.ngx_meta_lua_ffi_shdict_capacity
ngx_lua_ffi_shdict_free_space = C.ngx_meta_lua_ffi_shdict_free_space
ngx_lua_ffi_shdict_udata_to_zone = C.ngx_meta_lua_ffi_shdict_udata_to_zone
end)
if not pcall(function () return C.free end) then
ffi.cdef[[
void free(void *ptr);
]]
end
This reverts commit 904e6f3.
No description provided.