github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/module/id/filtered_provider.go (about)

     1  package id
     2  
     3  import (
     4  	"github.com/onflow/flow-go/model/flow"
     5  	"github.com/onflow/flow-go/module"
     6  )
     7  
     8  // IdentityFilterIdentifierProvider implements an IdentifierProvider which provides the identifiers
     9  // resulting from applying a filter to an IdentityProvider.
    10  type IdentityFilterIdentifierProvider struct {
    11  	filter           flow.IdentityFilter[flow.Identity]
    12  	identityProvider module.IdentityProvider
    13  }
    14  
    15  func NewIdentityFilterIdentifierProvider(filter flow.IdentityFilter[flow.Identity], identityProvider module.IdentityProvider) *IdentityFilterIdentifierProvider {
    16  	return &IdentityFilterIdentifierProvider{filter, identityProvider}
    17  }
    18  
    19  func (p *IdentityFilterIdentifierProvider) Identifiers() flow.IdentifierList {
    20  	return p.identityProvider.Identities(p.filter).NodeIDs()
    21  }