Documentation ¶
Overview ¶
Package worker implements various workers to process requests sent by the user
Index ¶
- type NameWorker
- func (nw *NameWorker) AddNames(n map[string]map[string]bool) (dbErr error, stgErr error)
- func (nw *NameWorker) FetchAndAddNames() (names map[string]map[string]bool, err error)
- func (nw *NameWorker) FetchNames() (map[string]map[string]bool, error)
- func (nw *NameWorker) FetchNamespaceNames(namespace string, out chan<- NamespaceNames, errCh chan<- error, ...)
- func (nw *NameWorker) GetNames() (map[string]map[string]bool, error)
- func (nw *NameWorker) GetNamesAt(date time.Time) (map[string]map[string]bool, error)
- func (nw *NameWorker) RetrieveNames() (result map[string]map[string]bool, err error)
- func (nw *NameWorker) RetrieveNewNames(since time.Time) (map[string]map[string]bool, error)
- func (nw *NameWorker) Shutdown() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NameWorker ¶
type NameWorker struct {
// contains filtered or unexported fields
}
NameWorker processes name related requests By first checking database and storage before making remote calls for information.
func NewNameWorker ¶
func NewNameWorker() (*NameWorker, error)
NewNameWorker initializes a worker with new storage and database based on configuration variables specified. The worker can perform name-related operations using Blockstack API and persist any relevant data into database and storage.
func (*NameWorker) AddNames ¶
AddNames persists the set of names for each namespace into the database and storage.
func (*NameWorker) FetchAndAddNames ¶
func (nw *NameWorker) FetchAndAddNames() (names map[string]map[string]bool, err error)
FetchAndAddNames attempts to query the remote API for the set of names for each namespace at the current date. If successful, the results are persisted to underlying database and storage.
func (*NameWorker) FetchNames ¶
func (nw *NameWorker) FetchNames() (map[string]map[string]bool, error)
func (*NameWorker) FetchNamespaceNames ¶
func (nw *NameWorker) FetchNamespaceNames(namespace string, out chan<- NamespaceNames, errCh chan<- error, wg *sync.WaitGroup)
fetch asynchronously inserts results to database
func (*NameWorker) GetNames ¶
func (nw *NameWorker) GetNames() (map[string]map[string]bool, error)
GetNames returns the set of all names at current day
func (*NameWorker) GetNamesAt ¶
GetNamesAt attempts to find and return the set of names for each namespace at the given date
func (*NameWorker) RetrieveNames ¶
func (nw *NameWorker) RetrieveNames() (result map[string]map[string]bool, err error)
RetrieveNames attempts to return the set of names at current date. If the names don't exist in database or storage, they are fetch from remote API.
func (*NameWorker) RetrieveNewNames ¶
RetrieveNewNames attempts to compare the latest set of names for each namespace to the set found at the provided time. If no previous data exists at the specified time, an error is returned. Otherwise a set of new names is returned.
func (*NameWorker) Shutdown ¶
func (nw *NameWorker) Shutdown() error