1. 07 Oct, 2020 1 commit
  2. 06 Oct, 2020 4 commits
  3. 05 Oct, 2020 9 commits
  4. 30 Sep, 2020 2 commits
  5. 29 Sep, 2020 2 commits
    • Simone Basso's avatar
    • Simone Basso's avatar
      oonimkall/session.go: significantly simplify the implementation (#954) · 9576c73d
      Simone Basso authored
      * oonimkall/session.go: significantly simplify the implementation
      
      When helping @lorenzoPrimi with https://github.com/ooni/probe-android/pull/360
      I had the impression there was too much complexity.
      
      Then we said we could improve the situation by changing the class names
      as written in https://github.com/ooni/probe-engine/issues/951#issue-708184925.
      
      But then there was still too much complexity. I could not easily picture in
      my mind why each class was needed. This was actually a strong signal that we
      needed to refactor the code more than just renaming clases.
      
      So, here's the new approach (for which I'll write soon a mini design document
      that will be referenced inside the code - or maybe this is the document!):
      
      1. Session uses runtime.SetFinalizer therefore we don't need to be concerned
      about wrapping it and using AutoCloseable in Java. It is not normal for Go code
      to use finalizers, but I believe it makes sense in this context, _because_ it
      simplifies interfacing Go and Java code.
      
      2. We introduce again a Context instance _because_ it was too painful to have
      each Task define the same operations and also too bloated.
      
      3. A Context is created from a Session, therefore the Session can keep track
      of what `cancel()` functions to be called when done. So now the programmer is
      feee to just not be concerned about calling `cancel()` _unless_ there is the
      need for really cancelling the operation. The Session will specifically call
      all the cancelling functions inside of its finalizer.
      
      4. All Session methods are now "synchronized" with respect to a mutex that
      is inside of the session itself. This removes any concerns regarding the usage
      from multiple threads. Yet, we're still not able to have a long running
      session yet, mainly because now we're tracking child contexts. But I also
      do not think pushing for a global session is particularly useful.
      
      5. The resubmission now happens within a session. We have a submitter inside
      the session and we are confident thread-safe-wise there are no issues since
      also the method for submitting is, of course, thread safe.
      
      This strategy completely eliminates the need of wrappers for the sake of
      introducing AutoCloseable properties in the code.
      
      While there, I also modified `/session.go` such that it's possible to perform
      an unmemoised lookup of the probe location. This has been instrumental to remove
      one more limitation of the previous `/oonimkall/session.go` API.
      
      * oonimkall: improve new session API's tests
      
      This ensures that we're cleaning up everything using finalizers.
      
      While there are debugging code to understand flaky test.
      
      * final changes
      9576c73d
  6. 24 Sep, 2020 1 commit
  7. 21 Sep, 2020 3 commits
  8. 17 Sep, 2020 1 commit
  9. 15 Sep, 2020 3 commits
  10. 11 Sep, 2020 4 commits
  11. 09 Sep, 2020 2 commits
  12. 08 Sep, 2020 1 commit
  13. 07 Sep, 2020 1 commit
  14. 04 Sep, 2020 4 commits
  15. 03 Sep, 2020 2 commits