Conversation
Proper release when ready
include/mri.h
Outdated
| /* Input: registered-context, cli-input, size-of-input */ | ||
| typedef int (*mri_config_change_cb)(void *, cstring_t, size_t); | ||
| /* Input: list-of-samples, amount-of-samples, output-string */ | ||
| typedef int (*mri_shaper_cb)(mri_capture_sample_t *, size_t, char *); |
There was a problem hiding this comment.
why capture? sounds unrelated
There was a problem hiding this comment.
Better suggestions ? (it's a sample-capture --> like pcap)
include/mri.h
Outdated
| * Each instance can only be linked to one domain (! consider !) | ||
| * Instance is global to process having thread-oriented CB support | ||
| */ | ||
| int mri_init(const char *domain); |
There was a problem hiding this comment.
what domains stand for? name of the process? what about multiple processes that use the same domain, e.g agent that runs on all nodes in a cluster?
There was a problem hiding this comment.
Actually that is exactly the use-case -> multiple processes using the same domain across cluster.
That way you can probe routing-domain or em-domain for example to get cluster-wide data
This is just another way to categorize data (initial-path will always be /<domain>/)
Best usage is for writing infra libraries that you want to access cluster-wide like system-events
include/mri.h
Outdated
| * when someone registers data on path, we capture his thread-id and | ||
| * allow him to poll on an event object that is related to his thread-id | ||
| * | ||
| * mri_get_eventloop_fd() will allow user to allocate time for MRI in any bitch-thread |
There was a problem hiding this comment.
what if you want more than one fds in the eventloop? e.g multiple clients connected to MRI and/or multiple timers etc.
There was a problem hiding this comment.
Not sure I understand, multiple-clients is not needed due to managing a per-thread notificator,
When you register your data to MRI it saves the thread-id as indicator to where you would like to fetch it
About multiple timers I'm clueless as to what/who/where/when 😅
src/mri_backend.cpp
Outdated
| }; | ||
|
|
||
| /** | ||
| * XTYPE |
There was a problem hiding this comment.
xtype is a complex type? one that contains multiple flat_types?
You started out nicely with the comments above.. :)
src/mri_backend.cpp
Outdated
| * 6. Path is defined as <ROOT>/<NODE-1>/<NODE-2>/.../<NODE-X> | ||
| */ | ||
| template <typename string_t> | ||
| xpath_node( string_t &&name, |
There was a problem hiding this comment.
since you called stuff here xpath, do you plan to support xpath filters?
Would be an awesome way to query data that is exposed via MRI. No need for pandas stuff like in xraycli :)
https://www.w3schools.com/xml/xpath_syntax.asp
There was a problem hiding this comment.
Good idea, would like to do that, but unsure if I need to actually add these into server-side (this file)
src/mri_backend.cpp
Outdated
| /* User-data (specified on registration) */ | ||
| tid_t m_tid; /*>! Thread whom registered node (origin) */ | ||
| void *m_xdata; /*>! User-defined data (node data internal) */ | ||
| mri_iterator_cb m_xdata_iterator; /*>! User-defined data iterator (tableview) */ |
There was a problem hiding this comment.
I suggest to add a few simple iterators for common types.
e.g something that is based on std::next for std collections
https://en.cppreference.com/w/cpp/iterator/next
or something for basic arrays
There was a problem hiding this comment.
Don't forget to add something for returning structs, a.k.a single row tables.
There was a problem hiding this comment.
Added .hpp file for generic iteration
Please elaborate about single-row-tables
src/mri_backend.cpp
Outdated
| * xpath_node | ||
| * Chains of nodes defining path (/ is root) | ||
| */ | ||
| struct xpath_node { |
There was a problem hiding this comment.
Consider adding filters, e.g ignore rows in which everything is zero
There was a problem hiding this comment.
Do you want to configure filters as server-side ? like a programmer would configure them ?
Currently this kind of filtering is made by ignoring data in the iterator-callback
src/mri_backend.cpp
Outdated
| #include <unordered_map> | ||
|
|
||
| #include "../include/mri.h" | ||
| #include "../deps/ordered_map.h" |
There was a problem hiding this comment.
what am I missing here? the regular std::map is ordered :<
There was a problem hiding this comment.
Don't know really, currently I just kept @grisha85 notation of using this
can be a quick replace due to being a typedef
Proper release when ready