I've been on Lemmy for some time now and it's time for me to finally understand how Federation works. I have general idea and I have accounts on three federated instances, but I need some details.
Let Alpha, Beta, Gamma and Delta be four federated instances. I have an account on Alpha and create a post in a community on Beta. A persoson from Gamma comments on it and a person from Delta upvotes the post and the comment.
The question: On which instances are the post, the comment and the upvotes stored?
When you, on instance.alpha, view a community on instance.beta, you aren't actually on [email protected]. You're actually on an entirely separate copy - [email protected]@instance.alpha. That's the community you're reading and posting to and upvoting/downvoting in. Meanwhile, people on other instances are each on their own locally hosted copies of the same community.
The lemmy software (or kbin or mastodon or whatever) then periodically syncs up all the local copies of [email protected], so you all end up looking at (more or less) the same content, even though it's actually a bunch of technically separate communities.
Pretty good answer but there's no periodic sync. From the moment a community is subscribed to, the instance that is home to the community will send all activities in that community to the subscribed instances as they happen.
That's why you don't see old content all being synced. Just new content (and some old content if it is liked or replied to after subscribed)
Regardless of which on you create the content on, assuming they all federated with each other correctly, every instance hosts its own copy of your posts.
All of them. If you can see it from an instance, it's stored in that instance.
The only exception are images which may or may not be stored depending on the exact backend software and configuration.
Both "alpha" and "beta" has authority to hide the post (one hosts your account and the other hosts the community) from the rest of the federation. Similarly, both "beta" and "gamma" have the authority to hide the comment from the federation. That said, instances can also individually hide/purge stuff from their own views without affecting the wider federation if they so choose (which is how things like .world's blocking of piracy communities work)
"beta" handles distribution/"boosting" (in masto speak) of the post and comment to other instances (however "gamma" will send it to both "alpha" and "beta" as it's a reply to "alpha"). AFAIK "alpha" and "gamma" handle the boosting of the upvotes they receive from "delta" (though I could be wrong on that part).
Oh, and "boosting" doesn't mean "i got 1 new upvote on this comment :3" it means "delta has sent me this exact Like event owned by person@delta associated to comment@gamma (and a lot of other data)". There are also keys and signatures involved to make things a bit harder to spoof.
Both. The text data is in the database of all instances that are federated. Your account credentials are only stored on the instance you're registered to.
On all instances. Each instance has copy of what happened and every action is relayed by community instance (in this case, Beta) to all subscriber of the community.