misc helpers and utilities
(msg *apc.ActionMsg, bck *cluster.Bck, waitmsync bool)
| 974 | /// |
| 975 | |
| 976 | func (p *proxy) prepTxnClient(msg *apc.ActionMsg, bck *cluster.Bck, waitmsync bool) *txnClientCtx { |
| 977 | c := &txnClientCtx{p: p, uuid: cos.GenUUID(), smap: p.owner.smap.get()} |
| 978 | c.msg = p.newAmsg(msg, nil, c.uuid) |
| 979 | body := cos.MustMarshal(c.msg) |
| 980 | |
| 981 | query := make(url.Values, 2) |
| 982 | if bck == nil { |
| 983 | c.path = apc.URLPathTxn.S |
| 984 | } else { |
| 985 | c.path = apc.URLPathTxn.Join(bck.Name) |
| 986 | query = bck.AddToQuery(query) |
| 987 | } |
| 988 | config := cmn.GCO.Get() |
| 989 | c.timeout.netw = 2 * config.Timeout.MaxKeepalive.D() |
| 990 | c.timeout.host = config.Timeout.MaxHostBusy.D() |
| 991 | if !waitmsync { // when commit does not block behind metasync |
| 992 | query.Set(apc.QparamNetwTimeout, cos.UnixNano2S(int64(c.timeout.netw))) |
| 993 | } |
| 994 | query.Set(apc.QparamHostTimeout, cos.UnixNano2S(int64(c.timeout.host))) |
| 995 | |
| 996 | c.req = cmn.HreqArgs{Method: http.MethodPost, Query: query, Body: body} |
| 997 | return c |
| 998 | } |
| 999 | |
| 1000 | // rollback create-bucket |
| 1001 | func (p *proxy) undoCreateBucket(msg *apc.ActionMsg, bck *cluster.Bck) { |
no test coverage detected