Add get_profile_info function #13

Merged
notplants merged 3 commits from get_profile_info into main 2022-01-13 15:05:35 +00:00
Owner

This PR might be an unnecessary optimization, but its pretty cool that it works.

It adds a function get_profile_info, which returns a HashMap<String, String> of keys to values, for the about information needed for a profile (currently with keys 'name', 'description' and 'image').

Whats interesting about it is it does this with one stream. It creates an about stream for that user, and then iterates through the messages from most recent to least recent.

When it has found values for all the keys its search for, or it reaches the end of the stream, whichever happens first, it exits.

Instead of making a different get_subset call to go-sbot for each value needed, it makes one call, with just one iteration through that stream, and gets all the info it needs.

This PR might be an unnecessary optimization, but its pretty cool that it works. It adds a function get_profile_info, which returns a HashMap<String, String> of keys to values, for the about information needed for a profile (currently with keys 'name', 'description' and 'image'). Whats interesting about it is it does this with one stream. It creates an about stream for that user, and then iterates through the messages from most recent to least recent. When it has found values for all the keys its search for, or it reaches the end of the stream, whichever happens first, it exits. Instead of making a different get_subset call to go-sbot for each value needed, it makes one call, with just one iteration through that stream, and gets all the info it needs.
notplants added 3 commits 2022-01-12 20:30:52 +00:00
notplants requested review from glyph 2022-01-12 20:30:58 +00:00
glyph approved these changes 2022-01-13 14:59:01 +00:00
glyph left a comment
Owner

This is awesome. I appreciate the thorough code comments and the elegance of using a single stream.

Good to merge 🟢

This is awesome. I appreciate the thorough code comments and the elegance of using a single stream. Good to merge 🟢
notplants changed target branch from about-stream to main 2022-01-13 15:05:28 +00:00
notplants merged commit 61fdb42027 into main 2022-01-13 15:05:35 +00:00
notplants deleted branch get_profile_info 2022-01-13 15:05:35 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: golgi-ssb/golgi#13
No description provided.