github.com/diadata-org/diadata@v1.4.593/internal/pkg/stock-scrapers/interface.go (about)

     1  package stockscrapers
     2  
     3  import (
     4  	"sync"
     5  
     6  	models "github.com/diadata-org/diadata/pkg/model"
     7  )
     8  
     9  type nothing struct{}
    10  
    11  type StockScraperInterface interface {
    12  	GetStockQuotationChannel() chan models.StockQuotation
    13  	FetchQuotes() error
    14  }
    15  
    16  type StockScraper struct {
    17  	// signaling channels
    18  	shutdown     chan nothing
    19  	shutdownDone chan nothing
    20  
    21  	// error handling; to read error or closed, first acquire read lock
    22  	// only cleanup method should hold write lock
    23  	errorLock *sync.RWMutex
    24  	error     error
    25  	closed    bool
    26  	datastore models.Datastore
    27  	chanStock chan models.StockQuotation
    28  	source    string
    29  }