Big Brother
We always know who the Boss is.
Last updated
We always know who the Boss is.
Last updated
Now we need to upload our DB to S3 bucket, but if we allow each device to upload their database regardless of which device has all the changes (or most of), we will end up overwriting data every time each device uploads new DB.
We do now want a device which is sitting ideal, overwrite its data with a device which has larger data set.
So, how can we solve this? If we can know which device has most amount of data, it would be great and if we can determine that without maintaining that on server, that would amazing.
Here is he approach:
Keep track of all the data being download and locally created in table called BigBrother
.
We keep count of all the data that was created by our device as well as other devices by reading updatedBy
device installation id.
You can also decide, which collection/table has higher priority, than you can compare count of that only collection and decide if you are Big Brother
or not.
Now, while uploading, you check if your local device installation ID is matching with max(count) of installationI
d.
You can also remove older entries you do not need (like a week old data)