get_about_messages #4

Closed
opened 2021-12-22 20:29:09 +00:00 by notplants · 3 comments
Owner

still thinking about how to get the about messages we need for a profile.

Based on models.js in goasis,
b7d92c6307/item/src/models.js (L93)

we can see here that they filter down to just messages where a certain key (e.g. description, or image) != undefined.

I think we may have to do the same thing in rust. I'm not sure if getSubset has capability to construct a query like that?

the tricky thing is that each individual about message may just have a particular key in it (e.g. just description, or just image), not all of them. To find the latest description, we need to look at all about messages from that auther that contain the field description, and choose the latest one.

so we could use getSubset to get the about messages by the author, and then filter in rust. does this also make sense to you @glyph and @cblgh or do you see another way?

still thinking about how to get the about messages we need for a profile. Based on models.js in goasis, https://git.sr.ht/~cryptix/ssb-oasis/tree/b7d92c630722fc99cdb91c8e540cca93c0e02669/item/src/models.js#L93 we can see here that they filter down to just messages where a certain key (e.g. description, or image) != undefined. I think we may have to do the same thing in rust. I'm not sure if getSubset has capability to construct a query like that? the tricky thing is that each individual about message may just have a particular key in it (e.g. just description, or just image), not all of them. To find the latest description, we need to look at all about messages from that auther that contain the field description, and choose the latest one. so we could use getSubset to get the about messages by the author, and then filter in rust. does this also make sense to you @glyph and @cblgh or do you see another way?
Author
Owner

hmm I'm also recalling that cryptix mentioned ssb-names https://github.com/ssbc/ssb-names,

but I can't find in notes or elsewhere, if there is a go-equivalent for this plugin or how to use it?

hmm I'm also recalling that cryptix mentioned ssb-names https://github.com/ssbc/ssb-names, but I can't find in notes or elsewhere, if there is a go-equivalent for this plugin or how to use it?
Owner

@notplants

Yes, we will have to filter the results of the getSubset query. The code you linked is using getSubset (getMessagesOfType is just a special case of getSubset):

L84: partialReplication.getMessagesOfType

There's a little more context about getMessagesOfType in this issue.

getSubset has a descending option which gives the latest message first. That will be useful when constructing these queries.

Then you can iterate on the vector of messages and use get to index into each one and break when you find what you're looking for.

@notplants Yes, we will have to filter the results of the `getSubset` query. The code you linked is using `getSubset` (`getMessagesOfType` is just a special case of `getSubset`): L84: `partialReplication.getMessagesOfType` There's a little more context about `getMessagesOfType` in [this issue](https://github.com/cryptoscope/ssb/issues/130). `getSubset` has a `descending` option which gives the latest message first. That will be useful when constructing these queries. Then you can iterate on the vector of messages and use [`get`](https://docs.serde.rs/serde_json/value/enum.Value.html#method.get) to index into each one and `break` when you find what you're looking for.
Author
Owner

Closing this since this is done now.

Closing this since this is done now.
Sign in to join this conversation.
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#4
No description provided.