Summary
Rename the module-root export registryStatus() to getRegistryStatus(), keeping
registryStatus() as a deprecated alias until the next major (v3.0.0) removes it.
Why
The module root has two conventions for the same shape of API — a zero-argument function
that samples live native state and returns a plain object:
| Export |
Convention |
registryStatus() |
bare noun |
getWriteBufferManagerStats() (added in #824) |
get prefix |
Both walk the database registry and return a snapshot. There is no principled reason for
them to read differently, and whichever one we leave alone becomes the precedent for the
next diagnostic export.
get wins because these calls do real work rather than reading a stored property.
getWriteBufferManagerStats() takes a try_lock on the registry and can return
inventoryAvailable: false; registryStatus() walks every descriptor. The codebase already
reserves bare nouns for cheap, stable properties (db.compression, db.status) and uses
get* for the sampling calls (db.getStats(), db.getStat(), db.getEstimatedKeyCount()).
Renaming the one non-conforming export is a smaller change than converting the new one to a
getter, and it does not put a lock-taking call behind property-access syntax.
Proposed change
- Add
getRegistryStatus() as the canonical name.
- Keep
registryStatus() exported as an alias to the same function, marked
@deprecated in JSDoc, pointing at the new name.
- Remove the alias in v3.0.0.
- README documents
getRegistryStatus() only. The deprecated alias does not need a
README entry; the JSDoc @deprecated tag is the discovery path for existing callers.
Scope
Downstream consumers
registryStatus() is used in both Harper repos today, so the alias is what keeps this
non-breaking:
harper — dataLayer/rocksdbBackup.ts (production path), plus three files under
unitTests/resources/
harper-pro — core/dataLayer/rocksdbBackup.ts (production path), plus one file under
core/unitTests/resources/
Migrating those call sites is a follow-up and does not gate this change. They must be
migrated before the alias is removed in v3.0.0.
Context
Came out of review on #824 (Make a WriteBufferManager write stall observable), which
introduced getWriteBufferManagerStats(). That PR originally exposed the function twice, as
a RocksDatabase static and as a module-root export; the static is being dropped in favor of
the top-level export, which is what puts the two naming conventions side by side at the
module root.
Summary
Rename the module-root export
registryStatus()togetRegistryStatus(), keepingregistryStatus()as a deprecated alias until the next major (v3.0.0) removes it.Why
The module root has two conventions for the same shape of API — a zero-argument function
that samples live native state and returns a plain object:
registryStatus()getWriteBufferManagerStats()(added in #824)getprefixBoth walk the database registry and return a snapshot. There is no principled reason for
them to read differently, and whichever one we leave alone becomes the precedent for the
next diagnostic export.
getwins because these calls do real work rather than reading a stored property.getWriteBufferManagerStats()takes atry_lockon the registry and can returninventoryAvailable: false;registryStatus()walks every descriptor. The codebase alreadyreserves bare nouns for cheap, stable properties (
db.compression,db.status) and usesget*for the sampling calls (db.getStats(),db.getStat(),db.getEstimatedKeyCount()).Renaming the one non-conforming export is a smaller change than converting the new one to a
getter, and it does not put a lock-taking call behind property-access syntax.
Proposed change
getRegistryStatus()as the canonical name.registryStatus()exported as an alias to the same function, marked@deprecatedin JSDoc, pointing at the new name.getRegistryStatus()only. The deprecated alias does not need aREADME entry; the JSDoc
@deprecatedtag is the discovery path for existing callers.Scope
src/load-binding.ts— exportgetRegistryStatus, retainregistryStatusas adeprecated alias with a JSDoc
@deprecatedtag naming the replacement and theremoval version.
src/index.ts— re-export both.README.md— rename theregistryStatus(): RegistryStatussection heading and itsexample, and update any anchor links to it.
function, so the deprecation window is enforced rather than assumed.
Downstream consumers
registryStatus()is used in both Harper repos today, so the alias is what keeps thisnon-breaking:
harper—dataLayer/rocksdbBackup.ts(production path), plus three files underunitTests/resources/harper-pro—core/dataLayer/rocksdbBackup.ts(production path), plus one file undercore/unitTests/resources/Migrating those call sites is a follow-up and does not gate this change. They must be
migrated before the alias is removed in v3.0.0.
Context
Came out of review on #824 (Make a WriteBufferManager write stall observable), which
introduced
getWriteBufferManagerStats(). That PR originally exposed the function twice, asa
RocksDatabasestatic and as a module-root export; the static is being dropped in favor ofthe top-level export, which is what puts the two naming conventions side by side at the
module root.