Skip to content

MRI v1 Initial commit (WIP).#1

Open
oshamash wants to merge 7 commits intomasterfrom
v1
Open

MRI v1 Initial commit (WIP).#1
oshamash wants to merge 7 commits intomasterfrom
v1

Conversation

@oshamash
Copy link
Copy Markdown
Owner

@oshamash oshamash commented Mar 9, 2020

Proper release when ready

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 *);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why capture? sounds unrelated

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comment

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
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 for bitch-thread

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if you want more than one fds in the eventloop? e.g multiple clients connected to MRI and/or multiple timers etc.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 😅

};

/**
* XTYPE
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xtype is a complex type? one that contains multiple flat_types?
You started out nicely with the comments above.. :)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comment

* 6. Path is defined as <ROOT>/<NODE-1>/<NODE-2>/.../<NODE-X>
*/
template <typename string_t>
xpath_node( string_t &&name,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, would like to do that, but unsure if I need to actually add these into server-side (this file)

/* 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) */
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to add something for returning structs, a.k.a single row tables.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added .hpp file for generic iteration
Please elaborate about single-row-tables

* xpath_node
* Chains of nodes defining path (/ is root)
*/
struct xpath_node {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding filters, e.g ignore rows in which everything is zero

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

#include <unordered_map>

#include "../include/mri.h"
#include "../deps/ordered_map.h"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what am I missing here? the regular std::map is ordered :<

Copy link
Copy Markdown
Owner Author

@oshamash oshamash Mar 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know really, currently I just kept @grisha85 notation of using this
can be a quick replace due to being a typedef

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

Successfully merging this pull request may close these issues.

2 participants