Documentation
¶
Index ¶
- func UpdateSubscription(subscription *xsqlite.Subscription, db *gorm.DB, downloader downloader) (int, []string, error)
- type FetchSubscriptionResult
- type SubscriptionManager
- func (s *SubscriptionManager) Close() error
- func (s *SubscriptionManager) GetLastUpdate() time.Time
- func (s *SubscriptionManager) SetAutoUpdate(autoUpdate bool)
- func (s *SubscriptionManager) SetInterval(interval time.Duration)
- func (s *SubscriptionManager) Start() error
- func (s *SubscriptionManager) UpdateSubscriptions() error
- type SubscriptionManagerConfig
- type SubscriptionOption
- type UpdateSubscriptionResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UpdateSubscription ¶
func UpdateSubscription(subscription *xsqlite.Subscription, db *gorm.DB, downloader downloader) (int, []string, error)
return success parsed nodes, failed parsed nodes, error error means cannot get data from server
Types ¶
type FetchSubscriptionResult ¶ added in v1.2.1
type FetchSubscriptionResult struct {
Configs []*outbound.OutboundHandlerConfig
FailedNodes []string
Description string
}
func FetchSubscription ¶ added in v1.2.1
func FetchSubscription(ctx context.Context, link string, downloader downloader) (*FetchSubscriptionResult, error)
type SubscriptionManager ¶
type SubscriptionManager struct {
Running bool
Timer *time.Timer
Interval time.Duration
Downloader downloader
Db *gorm.DB
OnUpdatedCallback func()
AutoUpdate bool
}
func NewSubscriptionManager ¶
func NewSubscriptionManager(config *SubscriptionManagerConfig) *SubscriptionManager
func (*SubscriptionManager) Close ¶
func (s *SubscriptionManager) Close() error
func (*SubscriptionManager) GetLastUpdate ¶
func (s *SubscriptionManager) GetLastUpdate() time.Time
func (*SubscriptionManager) SetAutoUpdate ¶
func (s *SubscriptionManager) SetAutoUpdate(autoUpdate bool)
func (*SubscriptionManager) SetInterval ¶
func (s *SubscriptionManager) SetInterval(interval time.Duration)
just set interval, not start or stop
func (*SubscriptionManager) Start ¶
func (s *SubscriptionManager) Start() error
func (*SubscriptionManager) UpdateSubscriptions ¶
func (s *SubscriptionManager) UpdateSubscriptions() error
type SubscriptionManagerConfig ¶ added in v1.2.1
type SubscriptionOption ¶
type SubscriptionOption func(*SubscriptionManager)
type UpdateSubscriptionResult ¶
type UpdateSubscriptionResult struct {
SuccessSub int
SuccessNodes int
FailedSub int
FailedNodes []string
ErrorReasons map[string]string
}
func UpdateSubscriptions ¶
func UpdateSubscriptions(db *gorm.DB, downloader downloader) UpdateSubscriptionResult
Click to show internal directories.
Click to hide internal directories.