5 ms·
I have only used GraphQL when trying to get if a particular github user was my sponsor and it fails at that, you need to list all sponsors and iterate through t
by bullen 4y ago
I have only used GraphQL when trying to get if a particular github user was my sponsor and it fails at that, you need to list all sponsors and iterate through them manually.
My solution to database is JSON over HTTP on disk, one file per "value" or "row", this means you need EXT4 on type=small to have enough inodes.
Today is tried to solve the same problem as the github one on my own db: You would have a meta index for sponsorship user-user and then just query:
http://root.rupy.se/meta/user/user/marc/marcus http://root.rupy.se/meta/user/user/marc/marcus
To see if marc sponsors marcus, this took 2 minutes (refreshing my memory, otherwise 2 seconds), it scales and I did not have to alter anything. It just works.
- gkop 4y agoI want to take interest in your idea, but that path (“/meta/user/user/marc/marcus”) is just nauseating.
- bullen 4y agoWhy, it describes what the question is... meta (what type of storage) user/user is self-explanatory and marc/marcus is also simple... If you consider what this replaces it will feel less nauseating maybe? If you remove marcus: http://root.rupy.se/meta/user/user/marc http://root.rupy.se/meta/user/user/marc You get what the github GraphQL gives you, a paginatable JSON list. This is the most intuitive and simple way to represent any data and the entire distributed db is 2000 lines of code.
- Aeolun 4y agoIf you have to explain to someone that something is simple, it probably isn’t.
- Merad 4y agoLike many things, it might be simple and intuitive _once you already know how it works_. Looking at it for the first time, my reaction was similar that of the GP. My $0.02: if the question is "using meta storage, does user marcus sponsor user marc?" I would propose a url like meta/users/{username}/sponsors/{username}, or meta/users/marc/sponsors/marcus. To me, at least, that url states a few things: * meta/users/marc <- the user we're querying, and where we can get his info * meta/users/marc/sponsors <- every user who is a sponsor of marc * meta/users/marc/sponsors/marcus <- is marcus one of marc's sponsors? Of course it wouldn't be a forum oriented towards developers if 10 users didn't hold a dozen conflicting opinions.
- bullen 4y agoThe user/user is a "node type" to "node type" thing: it can be user/item f.ex. The marc/marcus is related to those so for user/item it could be marc/sword f.ex. The reason it's that way is that how it needs to be stored on disk. The detail data (what the relation has as meta data is subordined to the relationship of nodes user/user), you can put anything that marc/marcus have in common in that JSON file. (I just added that we used to be colleagues) Even if it feels awkward when you are used to wasteful structures once you know this is the least complex solution you will be thankful, specially in the long run since you wont have to learn anything else ever again.
- yencabulator 4y agoIn this case, "sponsors" is an extra tricky word, because in English you can say "X sponsors Y" or "one of Y's sponsors is X", and you can't tell from just the path which one was meant.
- Merad 4y agoGood callout! Using verbiage like "sponsoredby" or "sponsorof" in the url could help clarify the relationship and make it read more literally, i.e. to answer "does marcus sponsor marc" you could use meta/users/marc/sponsoredby/marcus or meta/users/marcus/sponsorof/marc.
- bullen 4y agoYeah, I used "fund": 1 in the user/user/marc/marcus... then you just have to decide the direction and everywhere except arabian it's left to right... so marc funds marcus. And user/user/marcus/marc has it if marcus funds marc.