fix: remove dangerous count methods from interface

- Removed countNouns() and countVerbs() from BaseStorageAdapter
- These methods would be dangerous with millions of entries
- We already have incremental statistics tracking via incrementStatistic()
- Statistics are maintained in cache and updated as items are added/removed
- Much more scalable than iterating through all items

The existing statistics system is the proper way to get counts:
- Uses incrementStatistic('noun'/'verb', service) on add
- Uses decrementStatistic() on delete
- Access via getStatistics() which returns cached counts
- No iteration through millions of items needed
This commit is contained in:
David Snelling 2025-09-02 15:02:50 -07:00
parent 7c46879334
commit f463ee3fe2

View file

@ -145,24 +145,6 @@ export abstract class BaseStorageAdapter implements StorageAdapter {
nextCursor?: string
}>
/**
* Count total number of nouns (optional)
* WARNING: Implementations should be efficient for large datasets.
* Consider caching counts or using database COUNT operations.
* @param filter Optional filter criteria
* @returns Promise that resolves to the count
*/
countNouns?(filter?: any): Promise<number>
/**
* Count total number of verbs (optional)
* WARNING: Implementations should be efficient for large datasets.
* Consider caching counts or using database COUNT operations.
* @param filter Optional filter criteria
* @returns Promise that resolves to the count
*/
countVerbs?(filter?: any): Promise<number>
// Statistics cache
protected statisticsCache: StatisticsData | null = null