Commit Graph

72 Commits (ec2f6912d8ab675bafc159e3be94db57e06080a6)

Author SHA1 Message Date
Jeff a8a6c175fc
Merge pull request #1128 from majestrate/use-std-chrono-2020-02-24
make llarp_time_t use std::chrono::milliseconds
5 years ago
Jeff Becker bf0416cab8
remove Time_t, add operator overload for printing llarp_time_t and add to_json function for serializing llarp_time_t to json 5 years ago
Jason Rhinelander 3bd400f6fe Fix string_view C++17 compatibility
string_view was implicitly convertible to std::string, but
std::string_view is only explicitly convertible.  This makes the
`operator std::string` explicit to be more compatible, and re-adds a
bunch of explicit string casts to the code where needed.

(This also fixes the build if changing the standard to c++17)
5 years ago
Jeff Becker f4520ac920
make decaying hashset use llarp::Time_t and move unit tests to use catch2 5 years ago
Jason Rhinelander 18a2444c50 Add gcc5 workaround for catch2 GENERATE(table
stdlibc++'s before v6 erroneously have the tuple constructor as
explicit, which causes the initializer lists here to fail.
5 years ago
Jason Rhinelander 1232f34f90 Rewrite generate expressions to make clang-7 happy 5 years ago
Jason Rhinelander 0839c16f19 Final abseil purge
Bye-bye Google Boost.
5 years ago
Jason Rhinelander 46242ba69b TrimWhiteSpace -> TrimWhitespace
Fix my dumb initial capitalization choice.
5 years ago
Jason Rhinelander 54186c4a89 Replace absl string_view with string_view from lokimq
When we add loki-mq has a dependency we can just alias it, but for now
it's easier to copy the header than add the whole submodule library.
5 years ago
Jason Rhinelander 98c34d995b De-abseil: Add our own llarp::TrimWhiteSpace
Adds a TrimWhiteSpace instead of using abseil's.

Adds Catch2 tests for it, and also converts the existing str tests to
catch (which look much, much nicer than the gtest ones).
5 years ago
Jason Rhinelander fe61367a87 Vastly simplified llarp::util::memFn
There is a huge pile of unnecessary machinery here that can be solved
with a few lambdas and some member function pointer type deduction.
5 years ago
Jason Rhinelander b4440094b0 De-abseil, part 2: mutex, locks, (most) time
- util::Mutex is now a std::shared_timed_mutex, which is capable of
  exclusive and shared locks.

- util::Lock is still present as a std::lock_guard<util::Mutex>.

- the locking annotations are preserved, but updated to the latest
  supported by clang rather than using abseil's older/deprecated ones.

- ACQUIRE_LOCK macro is gone since we don't pass mutexes by pointer into
  locks anymore (WTF abseil).

- ReleasableLock is gone.  Instead there are now some llarp::util helper
  methods to obtain unique and/or shared locks:
    - `auto lock = util::unique_lock(mutex);` gets an RAII-but-also
      unlockable object (std::unique_lock<T>, with T inferred from
      `mutex`).
    - `auto lock = util::shared_lock(mutex);` gets an RAII shared (i.e.
      "reader") lock of the mutex.
    - `auto lock = util::unique_locks(mutex1, mutex2, mutex3);` can be
      used to atomically lock multiple mutexes at once (returning a
      tuple of the locks).
  This are templated on the mutex which makes them a bit more flexible
  than using a concrete type: they can be used for any type of lockable
  mutex, not only util::Mutex.  (Some of the code here uses them for
  getting locks around a std::mutex).  Until C++17, using the RAII types
  is painfully verbose:

  ```C++
  // pre-C++17 - needing to figure out the mutex type here is annoying:
  std::unique_lock<util::Mutex> lock(mutex);
  // pre-C++17 and even more verbose (but at least the type isn't needed):
  std::unique_lock<decltype(mutex)> lock(mutex);
  // our compromise:
  auto lock = util::unique_lock(mutex);
  // C++17:
  std::unique_lock lock(mutex);
  ```

  All of these functions will also warn (under gcc or clang) if you
  discard the return value.  You can also do fancy things like
  `auto l = util::unique_lock(mutex, std::adopt_lock)` (which lets a
  lock take over an already-locked mutex).

- metrics code is gone, which also removes a big pile of code that was
  only used by metrics:
  - llarp::util::Scheduler
  - llarp:🧵:TimerQueue
  - llarp::util::Stopwatch
5 years ago
Jason Rhinelander ac1486d0be Replace absl::optional with optional-lite
Step 1 of removing abseil from lokinet.

For the most part this is a drop-in replacement, but there are also a
few changes here to the JSONRPC layer that were needed to work around
current gcc 10 dev snapshot:

- JSONRPC returns a json now instead of an optional<json>.  It doesn't
  make any sense to have a json rpc call that just closes the connection
  with returning anything.  Invoked functions can return a null (default
  constructed) result now if they don't have anything to return (such a
  null value won't be added as "result").
5 years ago
Jason Rhinelander 8aacc2d317 Update deprecated gtest macros
gtest ~renamed INSTANTIATE_TEST_CASE_P to INSTANTIATE_TEST_SUITE_P and
added a "backwards compatibility" shim, but the shim fails at compile
time if you pass in an empty fourth argument.
5 years ago
Stephen Shelton 9a65f19bb0
Add test to ensure config loading impacts runtime log level 5 years ago
Stephen Shelton 43998f97c8
Add unit tests for LogLevelToName and LogLevelToString 5 years ago
Jeff Becker 28752f85b7
improve test cases 5 years ago
Jeff Becker 8d11519eb2
unit tests for logging levels 5 years ago
Jeff Becker 562f3f07ab
add unit test for decaying hash set 5 years ago
Jason Rhinelander 1b710455a7 Disallow AlignedBuffer < 8 bytes; add oddball buffer sizes 5 years ago
Jeff Becker 9fa2b5c92a
remove undeeded test case 5 years ago
Stephen Shelton 1666498405 Replace bencode_write_version_entry with a more general-purpose function for writing bencoded dictionary entries 5 years ago
Michael edd0ec398f
Move thread stuff to subdirectory 5 years ago
Michael 0950571313
Move metrics to subdirectory 5 years ago
Michael 4d8fe2a8a8
Move meta programming to subdirectory 5 years ago
Jeff 146d977945 make osx unit tests compile on old gcc 5 years ago
Michael f9e9227e19
Fix gcc trunk warnings 5 years ago
Michael 5cef2865bd
Fix Ubuntu builds 5 years ago
Michael b01e5accbb
Add function to set threadname, and use from threadpool impl 5 years ago
Michael a2326efa37
Revert "Merge pull request #679 from tewinget/revert-config-refactor"
This reverts commit 2996a7f29c, reversing
changes made to 10df3bd4b3.
5 years ago
Thomas Winget d044d60101 Reverts #678 #677 and #669 with hashes:
10df3bd
766ece8
979f095

See those commits for further details
5 years ago
Michael 8c2d67f8f1
Fix tests 5 years ago
Michael bd78471dae
Move ini parser as well 5 years ago
Michael 95646d2d87
Publish metric tags 5 years ago
Michael 7d4126407c
Introduce tags for metrics 5 years ago
Michael d244674339
Unfuck integer metrics 5 years ago
Michael 0a5ac10880
Unfuck metrics 5 years ago
Michael a1ef2ca342
Tidy up metric code 5 years ago
Michael 3822fe2341
Create util::MemFn and memFn to make binding callbacks easier 5 years ago
Michael 7ca0927d8f
Replace dict_reader/list_reader with version which doesn't involve indirection 5 years ago
Jeff Becker 0cc8517bca
add error messages to ini parser and catch base cases. 5 years ago
Michael 9ee525a006
Fix shadowing warnings 6 years ago
Michael 544c5f9b61 Move metrics publishers to their own directory 6 years ago
Michael 25f10d5b11
Fix more address sanitiser issues 6 years ago
Michael 6b5a688e08
Fix Catalog.Iterator test failure 6 years ago
Jeff Becker 230e84c742
make signing work 6 years ago
Michael f2c5d32399
Metric collection subsystem 6 years ago
Michael acfff4ca5c
Threading structures for metrics 6 years ago
Rick V 8443c5ab8c
Support abseil on i686-pc-winnt-gnu 6 years ago
Ryan Tharp 75c7c12502 fix linux gcc 7.3 issues, feeling like #include <condition_variable> should be in one of the threading headers tho 6 years ago