package main import ( "context" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/netmap" netmapClient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client/netmap" netmapSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap" ) type rawNetmapSource struct { client *netmapClient.Client } func newRawNetmapStorage(client *netmapClient.Client) netmap.Source { return &rawNetmapSource{ client: client, } } func (s *rawNetmapSource) GetNetMap(ctx context.Context, diff uint64) (*netmapSDK.NetMap, error) { nm, err := s.client.GetNetMap(ctx, diff) if err != nil { return nil, err } candidates, err := s.client.GetCandidates(ctx) if err != nil { return nil, err } updates := getNetMapNodesToUpdate(nm, candidates) if len(updates) > 0 { mergeNetmapWithCandidates(updates, nm) } return nm, nil } func (s *rawNetmapSource) GetNetMapByEpoch(ctx context.Context, epoch uint64) (*netmapSDK.NetMap, error) { nm, err := s.client.GetNetMapByEpoch(ctx, epoch) if err != nil { return nil, err } candidates, err := s.client.GetCandidates(ctx) if err != nil { return nil, err } updates := getNetMapNodesToUpdate(nm, candidates) if len(updates) > 0 { mergeNetmapWithCandidates(updates, nm) } return nm, nil } func (s *rawNetmapSource) Epoch(ctx context.Context) (uint64, error) { return s.client.Epoch(ctx) }