Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DaemonFetcher ¶
type DaemonFetcher interface { Start(context.Context) // Stop the fetcher // TODO using ch to stop Stop() // Notify is used to notify fetcher to fetch data now. // isHardRefresh is used to indicate whether to clean cache. // return a chan to notify whether fetch success. Notify(isHardRefresh bool) (chan bool, error) Fetch(isHardRefresh bool) error // UIRefresh is used to notify ui app to refresh UIRefresh() chan bool }
DaemonFetcher is a interface for one fetcher it runs in background and fetch data from remote.
func NewSimpleFetcher ¶
func NewSimpleFetcher( log logrus.FieldLogger, interval time.Duration, fn FetchFn, statusDescriber StatusDescriber, ) DaemonFetcher
type FetchFn ¶
type FetchFn func(sd StatusDescriber, isHardRefresh bool) error
FetchFn fetch data.
func NewToodledoFetchFnPartial ¶
func NewToodledoFetchFnPartial( log logrus.FieldLogger, folderSvc services.FolderPersistenceService, contextSvc services.ContextPersistenceService, goalSvc services.GoalPersistenceService, taskSvc services.TaskPersistenceExtService, accountSvc services.AccountExtService, ) FetchFn
type FetchPromise ¶
type StatusDescriber ¶
type StatusDescriber interface { Progress() (int, int) SetProgress(current int, total int) OnSyncing(func() error) OnSuccess(func() error) OnError(func(err error) error) Error(err error) Success() Syncing() }
StatusDescriber is a interface for describe the status of fetcher it gets progress from syncer, and invoke registered callback.
func NewNoOpStatusDescriber ¶
func NewNoOpStatusDescriber() StatusDescriber
func NewStatusDescriber ¶
func NewStatusDescriber(onSyncing, onSuccess func() error, onError func(err error) error) StatusDescriber
type ToodledoFetchFunc ¶
type ToodledoFetchFunc struct {
// contains filtered or unexported fields
}
func NewToodledoFetchFunc ¶
func NewToodledoFetchFunc( log logrus.FieldLogger, folderPstSvc services.FolderPersistenceService, contextPstSvc services.ContextPersistenceService, goalPstSvc services.GoalPersistenceService, taskPstSvc services.TaskPersistenceExtService, accountSvc services.AccountExtService, ) *ToodledoFetchFunc
func (*ToodledoFetchFunc) Fetch ¶
func (s *ToodledoFetchFunc) Fetch(statusDescriber StatusDescriber, isHardRefresh bool) error
Click to show internal directories.
Click to hide internal directories.