MergeAll will merge all the available remote bug and identities
(remote string)
| 93 | |
| 94 | // MergeAll will merge all the available remote bug and identities |
| 95 | func (c *RepoCache) MergeAll(remote string) <-chan entity.MergeResult { |
| 96 | out := make(chan entity.MergeResult) |
| 97 | |
| 98 | dependency := [][]cacheMgmt{ |
| 99 | {c.identities}, |
| 100 | {c.bugs}, |
| 101 | } |
| 102 | |
| 103 | // run MergeAll according to entities dependencies and merge the results |
| 104 | go func() { |
| 105 | defer close(out) |
| 106 | |
| 107 | for _, subcaches := range dependency { |
| 108 | var wg sync.WaitGroup |
| 109 | for _, subcache := range subcaches { |
| 110 | wg.Add(1) |
| 111 | go func(subcache cacheMgmt) { |
| 112 | for res := range subcache.MergeAll(remote) { |
| 113 | out <- res |
| 114 | } |
| 115 | wg.Done() |
| 116 | }(subcache) |
| 117 | } |
| 118 | wg.Wait() |
| 119 | } |
| 120 | }() |
| 121 | |
| 122 | return out |
| 123 | } |
| 124 | |
| 125 | // Push update a remote with the local changes |
| 126 | func (c *RepoCache) Push(remote string) (string, error) { |