()
| 1230 | ) |
| 1231 | |
| 1232 | func (w *WorkspaceUpdate) Clone() WorkspaceUpdate { |
| 1233 | clone := WorkspaceUpdate{ |
| 1234 | UpsertedWorkspaces: make([]*Workspace, len(w.UpsertedWorkspaces)), |
| 1235 | UpsertedAgents: make([]*Agent, len(w.UpsertedAgents)), |
| 1236 | DeletedWorkspaces: make([]*Workspace, len(w.DeletedWorkspaces)), |
| 1237 | DeletedAgents: make([]*Agent, len(w.DeletedAgents)), |
| 1238 | Kind: w.Kind, |
| 1239 | } |
| 1240 | for i, ws := range w.UpsertedWorkspaces { |
| 1241 | clone.UpsertedWorkspaces[i] = &Workspace{ |
| 1242 | ID: ws.ID, |
| 1243 | Name: ws.Name, |
| 1244 | Status: ws.Status, |
| 1245 | } |
| 1246 | } |
| 1247 | for i, a := range w.UpsertedAgents { |
| 1248 | clone.UpsertedAgents[i] = ptr.Ref(a.Clone()) |
| 1249 | } |
| 1250 | for i, ws := range w.DeletedWorkspaces { |
| 1251 | clone.DeletedWorkspaces[i] = &Workspace{ |
| 1252 | ID: ws.ID, |
| 1253 | Name: ws.Name, |
| 1254 | Status: ws.Status, |
| 1255 | } |
| 1256 | } |
| 1257 | for i, a := range w.DeletedAgents { |
| 1258 | clone.DeletedAgents[i] = ptr.Ref(a.Clone()) |
| 1259 | } |
| 1260 | return clone |
| 1261 | } |
| 1262 | |
| 1263 | func (t *tunnelUpdater) handleUpdate(update *proto.WorkspaceUpdate, updateKind UpdateKind) error { |
| 1264 | t.Lock() |
no test coverage detected