Some things looks strange to me with the store refactoring, is that intentional:
-
Using
getCapacity
with a not valid resource returnsnull
, while usinggetUsedCapacity
with the same resource returns0
.extension.store.getCapacity("power") // => null extension.store.getUsedCapacity("power") // => 0
It seems inconsistent to me, maybe it should be aligned on one or the other behavior (I personally think returning
0
in both cases makes more sense, but the spec/doc seems to expectnull
in both cases). -
Using
getCapacity
on tombstones returnsnull
(I guess it is the same for ruins).
I think there is actually no limit, so returningNumber.MAX_SAFE_INTEGER
orInfinity
would make more sense and be more useful.
For example, having this behavior looks inconsistent to me:tombstone.store.getUsedCapacity("energy") // => 500 tombstone.store.getCapacity("energy") // => null (even though there is actually some energy in the tombstone...)
Note that mostly, the issue is that when getting
null
, we don't know if the store does not accept this resource at all, or if the limit is actually infinity. So if my first point is taken into account so thatgetCapacity
returns0
when the store does not accept the resource, then it would be kind of ok to keepnull
for infinity...