Missing stat method
Closed this issue · 5 comments
The Database object has no method to get a Stat object by providing a Transaction.
Those methods exist:
public Stat stat() { ... }
public MDB_stat stat(Transaction tx) { ... }
But this one is missing:
public Stat stat(Transaction tx) { ... }
Because the org.fusesource.lmdbjni.JNI class has a package scope, it seems impossible to write (from another package):
MDB_stat stat = writeDb.stat(tx);
This method would be useful for getting the stats of a write transaction (in order to be able to be able to prevent MDB_MAP_FULL).
And since this is my first message here: thanks for this wonderful Java library!
In order to keep the API consistent, I think that MDB_stat stat(Transaction tx)
needs to change to return Stat
instead.
I agree.
By the way I noticed that it is possible to access the fields of the MDB_stat object like this:
Stat stat = db.stat();
long l = stat.ms_branch_pages;
... and those values are not initialized by the constructor of the Stat class (it initializes its own private fields instead).
In the end I am wondering if the private fields of the Stat class could simply be removed. If it was the case its methods could simply return the MDB_stat fields (that could remain public since they are final).
Yes, that would be ideal I think.
Thank you!
Thanks for reporting!