Implement APIs for the counter extension

The maximum number of records that \p records can hold.