Allow to call `shards_local` without the state – using a default state.
cabol opened this issue · comments
Carlos Andres Bolaños R.A. commented
Most of the cases, the tables are created with default parameters, normally shards
is used locally, using default pick funs. For those cases, it is not necessary to recover the state first, it can be created with default parameters, and avoid an unnecessary call to the ETS control table – such as shards
does currently. To achieve this, two things are required:
- Improve
shards_state
module, add setters functions in order to be able to create a sate and modify its properties. - In
shards_local
module, for all those function that receives thestate
as parameter, add an equivalent function without thestate
, creating a default one. E.g.: forshards_local:insert/3
:
insert(Tab, ObjOrObjL, State)
Create an equivalent function without the State
param, like this:
insert(Tab, ObjOrObjL) ->
insert(Tab, ObjOrObjL, shards_state:new()).