github.com/ethersphere/bee/v2@v2.2.0/pkg/puller/export_test.go (about)

     1  // Copyright 2023 The Swarm Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package puller
     6  
     7  import "github.com/ethersphere/bee/v2/pkg/swarm"
     8  
     9  var PeerIntervalKey = peerIntervalKey
    10  
    11  func (p *Puller) IsSyncing(addr swarm.Address) bool {
    12  	p.syncPeersMtx.Lock()
    13  	defer p.syncPeersMtx.Unlock()
    14  	_, ok := p.syncPeers[addr.ByteString()]
    15  	return ok
    16  }
    17  
    18  func (p *Puller) IsBinSyncing(addr swarm.Address, bin uint8) bool {
    19  	p.syncPeersMtx.Lock()
    20  	defer p.syncPeersMtx.Unlock()
    21  	if peer, ok := p.syncPeers[addr.ByteString()]; ok {
    22  		return peer.isBinSyncing(bin)
    23  	}
    24  	return false
    25  }