()
| 199 | } |
| 200 | |
| 201 | func (ds *dsorterMem) start() error { |
| 202 | // Requests are usually small packets, no more 1KB that is why we want to |
| 203 | // utilize intraControl network. |
| 204 | config := cmn.GCO.Get() |
| 205 | reqNetwork := cmn.NetIntraControl |
| 206 | // Responses to the other targets are objects that is why we want to use |
| 207 | // intraData network. |
| 208 | respNetwork := cmn.NetIntraData |
| 209 | |
| 210 | client := transport.NewIntraDataClient() |
| 211 | |
| 212 | streamMultiplier := config.DSort.SbundleMult |
| 213 | if ds.m.rs.StreamMultiplier != 0 { |
| 214 | streamMultiplier = ds.m.rs.StreamMultiplier |
| 215 | } |
| 216 | trname := fmt.Sprintf(recvReqStreamNameFmt, ds.m.ManagerUUID) |
| 217 | reqSbArgs := bundle.Args{ |
| 218 | Multiplier: streamMultiplier, |
| 219 | Net: reqNetwork, |
| 220 | Trname: trname, |
| 221 | Ntype: cluster.Targets, |
| 222 | } |
| 223 | if err := transport.HandleObjStream(trname, ds.makeRecvRequestFunc()); err != nil { |
| 224 | return errors.WithStack(err) |
| 225 | } |
| 226 | |
| 227 | trname = fmt.Sprintf(recvRespStreamNameFmt, ds.m.ManagerUUID) |
| 228 | respSbArgs := bundle.Args{ |
| 229 | Multiplier: streamMultiplier, |
| 230 | Net: respNetwork, |
| 231 | Trname: trname, |
| 232 | Ntype: cluster.Targets, |
| 233 | Extra: &transport.Extra{ |
| 234 | Compression: config.DSort.Compression, |
| 235 | Config: config, |
| 236 | MMSA: mm, |
| 237 | }, |
| 238 | } |
| 239 | if err := transport.HandleObjStream(trname, ds.makeRecvResponseFunc()); err != nil { |
| 240 | return errors.WithStack(err) |
| 241 | } |
| 242 | |
| 243 | ds.streams.builder = bundle.NewStreams(ds.m.ctx.smapOwner, ds.m.ctx.node, client, reqSbArgs) |
| 244 | ds.streams.records = bundle.NewStreams(ds.m.ctx.smapOwner, ds.m.ctx.node, client, respSbArgs) |
| 245 | return nil |
| 246 | } |
| 247 | |
| 248 | func (ds *dsorterMem) cleanupStreams() (err error) { |
| 249 | if !ds.streams.cleanupDone.CAS(false, true) { |
nothing calls this directly
no test coverage detected