forked from TrueCloudLab/frostfs-node
[#607] network: Accept value instead of pointer in IsLocalAddress
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
fdd123ad98
commit
95ccbbc2f9
4 changed files with 7 additions and 7 deletions
|
@ -128,8 +128,8 @@ func multiaddrStringFromHostAddr(host string) (string, error) {
|
||||||
|
|
||||||
// IsLocalAddress returns true if network endpoint from local address
|
// IsLocalAddress returns true if network endpoint from local address
|
||||||
// source is equal to network endpoint of passed address.
|
// source is equal to network endpoint of passed address.
|
||||||
func IsLocalAddress(src LocalAddressSource, addr *Address) bool {
|
func IsLocalAddress(src LocalAddressSource, addr Address) bool {
|
||||||
return src.LocalAddress().Equal(*addr)
|
return src.LocalAddress().Equal(addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// HostAddrFromMultiaddr converts "/dns4/localhost/tcp/8080" to "localhost:8080".
|
// HostAddrFromMultiaddr converts "/dns4/localhost/tcp/8080" to "localhost:8080".
|
||||||
|
|
|
@ -150,7 +150,7 @@ func (p *Streamer) newCommonTarget(prm *PutInitPrm) transformer.ObjectTarget {
|
||||||
var relay func(*network.Address) error
|
var relay func(*network.Address) error
|
||||||
if p.relay != nil {
|
if p.relay != nil {
|
||||||
relay = func(addr *network.Address) error {
|
relay = func(addr *network.Address) error {
|
||||||
if network.IsLocalAddress(p.localAddrSrc, addr) {
|
if network.IsLocalAddress(p.localAddrSrc, *addr) {
|
||||||
return errLocalAddress
|
return errLocalAddress
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ func (p *Streamer) newCommonTarget(prm *PutInitPrm) transformer.ObjectTarget {
|
||||||
traverseOpts: prm.traverseOpts,
|
traverseOpts: prm.traverseOpts,
|
||||||
workerPool: p.workerPool,
|
workerPool: p.workerPool,
|
||||||
nodeTargetInitializer: func(addr *network.Address) transformer.ObjectTarget {
|
nodeTargetInitializer: func(addr *network.Address) transformer.ObjectTarget {
|
||||||
if network.IsLocalAddress(p.localAddrSrc, addr) {
|
if network.IsLocalAddress(p.localAddrSrc, *addr) {
|
||||||
return &localTarget{
|
return &localTarget{
|
||||||
storage: p.localStore,
|
storage: p.localStore,
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ func (p *localPlacement) BuildPlacement(addr *object.Address, policy *netmapSDK.
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if network.IsLocalAddress(p.localAddrSrc, addr) {
|
if network.IsLocalAddress(p.localAddrSrc, *addr) {
|
||||||
return []netmapSDK.Nodes{{vs[i][j]}}, nil
|
return []netmapSDK.Nodes{{vs[i][j]}}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ func (p *remotePlacement) BuildPlacement(addr *object.Address, policy *netmapSDK
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if network.IsLocalAddress(p.localAddrSrc, addr) {
|
if network.IsLocalAddress(p.localAddrSrc, *addr) {
|
||||||
vs[i] = append(vs[i][:j], vs[i][j+1:]...)
|
vs[i] = append(vs[i][:j], vs[i][j+1:]...)
|
||||||
j--
|
j--
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ func (p *Policer) processNodes(ctx context.Context, addr *object.Address, nodes
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if network.IsLocalAddress(p.localAddrSrc, node) {
|
if network.IsLocalAddress(p.localAddrSrc, *node) {
|
||||||
if shortage == 0 {
|
if shortage == 0 {
|
||||||
// we can call the redundant copy callback
|
// we can call the redundant copy callback
|
||||||
// here to slightly improve the performance
|
// here to slightly improve the performance
|
||||||
|
|
Loading…
Reference in a new issue