include/llfio/v2.0/algorithm/contents.hpp
/*! \brief Calculate the contents of everything within and under `dirh`. What
  is returned is unordered.

  This is a very thin veneer over `traverse()` which came out of the fact that
  I kept writing "get me the contents" traversal visitors again and again, so
  eventually I just wrote a library edition. Its only "clever" bit is that it
  stores the contents in thread local storage, and merges the contents afterwards.

  It is race free to concurrent relocations of `dirh`. It is entirely implemented
  in header-only code, as it is very simple.
  */
\brief Calculate the contents of everything within and under `dirh`. What
is returned is unordered.

This is a very thin veneer over `traverse()` which came out of the fact that
I kept writing "get me the contents" traversal visitors again and again, so
eventually I just wrote a library edition. Its only "clever" bit is that it
stores the contents in thread local storage, and merges the contents afterwards.

It is race free to concurrent relocations of `dirh`. It is entirely implemented
in header-only code, as it is very simple.
\ brief Calculate the contents of everything within and under ` dirh ` . What is returned is unordered . This is a very thin veneer over ` traverse () ` which came out of the fact that I kept writing " get me the contents " traversal visitors again and again so eventually I just wrote a library edition . Its only " clever " bit is that it stores the contents in thread local storage and merges the contents afterwards . It is race free to concurrent relocations of ` dirh ` . It is entirely implemented in header - only code as it is very simple .
inline result<contents_visitor::contents_type> contents(const path_handle &dirh, contents_visitor *visitor = nullptr, size_t threads = 0,
                                                          bool force_slow_path = false) noexcept
  {
    contents_visitor default_visitor;
    if(visitor == nullptr)
    {
      visitor = &default_visitor;
    }
    contents_visitor::_state_type state(dirh);
    OUTCOME_TRY(auto &&dirhpath, dirh.current_path());
    state.rootdirpathlen.store(dirhpath.native().size() + 1, std::memory_order_relaxed);
    OUTCOME_TRY(traverse(dirh, visitor, threads, &state, force_slow_path));
    return {std::move(state.contents)};
  }
inline result < contents_visitor :: contents_type > contents ( const path_handle & dirh , contents_visitor * visitor = nullptr , size_t threads = 0 , bool force_slow_path = false ) noexcept { contents_visitor default_visitor ; if ( visitor == nullptr ) { visitor = & default_visitor ; } contents_visitor :: _state_type state ( dirh ) ; OUTCOME_TRY ( auto && dirhpath , dirh . current_path ( ) ) ; state . rootdirpathlen . store ( dirhpath . native ( ) . size ( ) + 1 , std :: memory_order_relaxed ) ; OUTCOME_TRY ( traverse ( dirh , visitor , threads , & state , force_slow_path ) ) ; return { std :: move ( state . contents ) } ; }
\brief Calculate the contents of everything within and under `dirh`.
\ brief Calculate the contents of everything within and under ` dirh ` .