Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistent handling of read/write/readwrite metrics #4

Closed
tilsche opened this issue Oct 24, 2018 · 2 comments
Closed

Consistent handling of read/write/readwrite metrics #4

tilsche opened this issue Oct 24, 2018 · 2 comments

Comments

@tilsche
Copy link
Contributor

tilsche commented Oct 24, 2018

If a ReadMetric or WriteMetric is requested, and a ReadWritteMetric is already known in the Directory, this should be used.
There should never be multiple Metric objects for the same metric open at the same time in a Directory (see also #3)

@tilsche
Copy link
Contributor Author

tilsche commented Mar 13, 2019

This is addressed in either in the read-write-split or simple-metrics branches. We just need to figure out which to keep.

read-write-split:

  • actual class is decided on by config mode during construction
  • stored in std::variant
  • getting a reference to a specific type is possible when the stored type of the requested type (including subclasses) (e.g. pointers are convertible)
  • pro: restrict actual interface on usage
  • pro: seems to work, tests successful
  • con: my head hurts whenever I think about it - e.g. cannot easily reason whether the code is correct
  • con: additional indirection (unique_ptr) is necessary in order to allow move operations of the variant without hurting my head even more

simple-metric:

  • checks methods at runtime based on mode it was opened with
  • pro: easy to reason about
  • con: no static limitation of the used interface

I flavor simple-metric... because every time I thought I figured out the diamond of death it became even worse. How deep is that rabbit hole?

Any other opinions?

@tilsche
Copy link
Contributor Author

tilsche commented Aug 4, 2020

I went with the simple-metric solution a long time ago.

@tilsche tilsche closed this as completed Aug 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant