forked from TrueCloudLab/frostfs-node
[#645] placement/traverser: Extend Node type with public key
There is a need to process public keys of the placement result. Implement `Node.PublicKey` method which returns storage node's key announced in netmap. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
fe90456dcc
commit
22926e8f28
1 changed files with 9 additions and 0 deletions
|
@ -122,6 +122,8 @@ func flatNodes(ns []netmap.Nodes) []netmap.Nodes {
|
||||||
// Node is a descriptor of storage node with information required for intra-container communication.
|
// Node is a descriptor of storage node with information required for intra-container communication.
|
||||||
type Node struct {
|
type Node struct {
|
||||||
addresses network.AddressGroup
|
addresses network.AddressGroup
|
||||||
|
|
||||||
|
key []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
// Addresses returns group of network addresses.
|
// Addresses returns group of network addresses.
|
||||||
|
@ -129,6 +131,11 @@ func (x Node) Addresses() network.AddressGroup {
|
||||||
return x.addresses
|
return x.addresses
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Key returns public key in a binary format. Should not be mutated.
|
||||||
|
func (x Node) Key() []byte {
|
||||||
|
return x.key
|
||||||
|
}
|
||||||
|
|
||||||
// Next returns next unprocessed address of the object placement.
|
// Next returns next unprocessed address of the object placement.
|
||||||
//
|
//
|
||||||
// Returns nil if no nodes left or traversal operation succeeded.
|
// Returns nil if no nodes left or traversal operation succeeded.
|
||||||
|
@ -157,6 +164,8 @@ func (t *Traverser) Next() []Node {
|
||||||
// TODO: log error
|
// TODO: log error
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nodes[i].key = t.vectors[0][i].PublicKey()
|
||||||
}
|
}
|
||||||
|
|
||||||
t.vectors[0] = t.vectors[0][count:]
|
t.vectors[0] = t.vectors[0][count:]
|
||||||
|
|
Loading…
Reference in a new issue