github.com/diadata-org/diadata@v1.4.593/pkg/dia/scraper/blockchain-scrapers/block-scrapers/interface.go (about) 1 package blockscrapers 2 3 import ( 4 "sync" 5 "time" 6 7 "github.com/diadata-org/diadata/pkg/dia" 8 models "github.com/diadata-org/diadata/pkg/model" 9 ) 10 11 const ( 12 refreshDelay = time.Minute * 2 13 ) 14 15 type nothing struct{} 16 type BlockScraperInterface interface { 17 // NFT data should be streamed through dia.NFT channel. 18 GetDataChannel() chan dia.BlockData 19 // Should fetch nft data and send it to the channel. 20 FetchData() error 21 } 22 23 type BlockScraper struct { 24 // signaling channels 25 shutdown chan nothing 26 shutdownDone chan nothing 27 28 // error handling; to read error or closed, first acquire read lock 29 // only cleanup method should hold write lock 30 errorLock *sync.RWMutex 31 error error 32 closed bool 33 relDB models.RelDatastore 34 chanData chan dia.BlockData 35 }