forked from TrueCloudLab/frostfs-node
[#943] service/object: Refactor private key fetching during execution
`CommonPrm` structure has private key for remote operations. It obtained in the beginning of request processing. However, not every operation triggers remote calls. Therefore, key might not be used. It is important to avoid early key fetching because `TokenStore` now returns error if session token does not exist. This is valid case when container nodes receive request with session token (for ACL pass) and they should process request locally. Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
2fbdcbdee1
commit
c30aa20b04
7 changed files with 57 additions and 58 deletions
|
@ -88,12 +88,17 @@ func (c *clientWrapper) getObject(exec *execCtx, info coreclient.NodeInfo) (*obj
|
|||
return exec.prm.forwarder(info, c.client)
|
||||
}
|
||||
|
||||
opts, err := exec.callOptions()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if exec.headOnly() {
|
||||
return c.client.GetObjectHeader(exec.context(),
|
||||
new(client.ObjectHeaderParams).
|
||||
WithAddress(exec.address()).
|
||||
WithRawFlag(exec.isRaw()),
|
||||
exec.callOptions()...,
|
||||
opts...,
|
||||
)
|
||||
}
|
||||
// we don't specify payload writer because we accumulate
|
||||
|
@ -104,7 +109,7 @@ func (c *clientWrapper) getObject(exec *execCtx, info coreclient.NodeInfo) (*obj
|
|||
WithAddress(exec.address()).
|
||||
WithRange(rng).
|
||||
WithRaw(exec.isRaw()),
|
||||
exec.callOptions()...,
|
||||
opts...,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -115,7 +120,7 @@ func (c *clientWrapper) getObject(exec *execCtx, info coreclient.NodeInfo) (*obj
|
|||
|
||||
return c.client.GetObject(exec.context(),
|
||||
exec.remotePrm(),
|
||||
exec.callOptions()...,
|
||||
opts...,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue