Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local Syncing #41

Open
3 of 4 tasks
oubiwann opened this issue Jan 11, 2023 · 0 comments
Open
3 of 4 tasks

Local Syncing #41

oubiwann opened this issue Jan 11, 2023 · 0 comments
Labels
Milestone

Comments

@oubiwann
Copy link
Contributor

oubiwann commented Jan 11, 2023

Once this ticket is done:

we'll be able to send encrypted copies of the data base to other local nodes/instances. Full syncing is going to be a while out ... I think I'd prefer wait on syncing passwords until we had support for multiple versions (see #32). For now, though, we can sync metadata.

Before this, we need some new features/enhancements:

The communications and actions protocol might look something like this:

  • A sends encrypted data to B
  • B receives request and acknowledges by sending encrypted data to A
  • A lets B know that it received B's data
  • At this point, both may proceed with the following, sending an error to the peer in the event of a problem (which will cause both to abort):
    • decrypt data
    • iterate over data to be synced, collecting into a temp data structure
    • backing up the current state to disk, tagged with "sync"
    • updating local state

We'll need a protocol struct for tracking all this ... maybe in sync.rs:

struct Protocol {
  node: String,
  initiator: (Initiator::Self, Initiator::Other),
  data_sent: bool,
  data_received: bool,
  error: (Error::Self, Error::Other, Error:None),
  decrypted: bool,
  iterated: bool,
  backup: bool,
  data_merged: bool,
  data_replaced: bool,
}

Merging logic to be done:

  • created - take the less recent date
  • imported - take the less recent date
  • updated - take the more recent date
  • password_changed - take the more recent date
  • last_used - take the more recent date
  • synced - time::now
  • access_count - sum from both

Any fields not listed will be done after #32 has been completed.

With this in place:

  • Add new sync CLI command, taking the host as arg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant