c++ - LevelDB TEST_ Prefix for Methods -


i'm reading through code in leveldb , keep running across test_ prefix that's used. expect test_ indicates method used tests able operate on internals wouldn't otherwise public. such, i'd expect none of in critical paths. i'd expect them in none of primary methods. however, test_compactrange example called compactrange apart of main compaction path. test_ prefix mean, , can find info?

the authors seem use test_ prefix public methods not intended part of api. methods public make testing easier, , prefixed test_ discourage users calling them.

why shouldn't these methods appear in critical paths? private methods, visible testing.

other thoughts:

  • i'm not sure whether naming convention best practice. c++ has friend declarations accomplish similar.
  • the naming convention similar java guava library's @visiblefortesting annotation

edit: clear, i'm making guess based on handful of methods test_ prefix. grepping codebase shows such methods following (all public):

// compact files in named level overlap [*begin,*end] void test_compactrange(int level, const slice* begin, const slice* end);  // force current memtable contents compacted. status test_compactmemtable();  // return internal iterator on current state of database. // keys of iterator internal keys (see format.h). // returned iterator should deleted when no longer needed. iterator* test_newinternaliterator();  // return maximum overlapping data (in bytes) @ next level // file @ level >= 1. int64_t test_maxnextleveloverlappingbytes(); 

Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -