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

New client node data pull from server #9

Open
sniperwolfpk5 opened this issue Jan 27, 2022 · 0 comments
Open

New client node data pull from server #9

sniperwolfpk5 opened this issue Jan 27, 2022 · 0 comments

Comments

@sniperwolfpk5
Copy link

Dear @egarim

I appreciate your hard work. I found it an excellent sync library. I have seen all of your videos regarding the sync framework.
The Unit test is not depicting all the scenarios. Please consider the following procedure.

Let's say I have a client node connected to the server with Identity = store 1. The client syncs all its data to the server. Somehow client one crashed/lost their data, or I want the same data to be synced on 2nd device, or a fresh client with the same Identity want to restore data. It is working fine, but It does not sync its data; it syncs all other data. I have seen the code in ISyncServerNode, which fetches deltas for other Nodes.

public class SyncServerNode : ISyncServerNode
{
   ...
    public virtual Task<IEnumerable<IDelta>> GetDeltasAsync(Guid startindex, string identity, CancellationToken cancellationToken)
    {
        return this.deltaStore?.GetDeltasFromOtherNodes(startindex, identity, cancellationToken);
    }
   ...

Look at this code return this.deltaStore?.GetDeltasFromOtherNodes(startindex, identity, cancellationToken); It fetches data of other nodes. There should be another function in the ISyncServerNode.

public interface ISyncServerNode
{
    string NodeId { get; set; }
    Task SaveDeltasAsync(IEnumerable<IDelta> deltas, CancellationToken cancellationToken);
    Task<IEnumerable<IDelta>> GetDeltasFromOtherNodesAsync(Guid startindex, string identity, CancellationToken cancellationToken);
    Task<IEnumerable<IDelta>> GetDeltasAsync(Guid startindex, CancellationToken cancellationToken);
    Task ProcessDeltasAsync(IEnumerable<IDelta> deltas, CancellationToken cancellationToken);
}

There should be two functions like

Task<IEnumerable<IDelta>> GetDeltasFromOtherNodesAsync(Guid startindex, string identity, CancellationToken cancellationToken);
Task<IEnumerable<IDelta>> GetDeltasAsync(Guid startindex, CancellationToken cancellationToken);

One should be used for the normal operation scenario, and the 2nd should be used in case of a fresh/new/crashed node. Similarly, the SynController Fetch function should also be updated with NodeId and without NodeId or another filter header.

Thank you,
Qamar Abbas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant