Documentation ¶
Index ¶
- Variables
- type Event
- type Sync
- type SyncHub
- func (sh *SyncHub) Ack(syncID interface{}, ack interface{}) bool
- func (sh *SyncHub) Add(syncID interface{}, opts ...SyncOption) Sync
- func (sh *SyncHub) Cancel(syncID interface{}, notify bool) bool
- func (sh *SyncHub) Close()
- func (sh *SyncHub) Done(syncID interface{}) bool
- func (sh *SyncHub) DoneSub(syncID interface{}, subSyncID interface{}) bool
- func (sh *SyncHub) Error(syncID interface{}, err error) bool
- func (sh *SyncHub) New(syncID interface{}, opts ...SyncOption) Sync
- type SyncHubOption
- type SyncOption
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrSyncTimeout = errors.New("timeout") ErrSyncHubForceClosed = errors.New("force closed") ErrSyncHubClosed = errors.New("synchub closed") ErrSyncCanceled = errors.New("sync canceled") ErrSyncIDResynced = errors.New("id resynced") ErrTimerNotWorking = errors.New("timer not working") )
Functions ¶
This section is empty.
Types ¶
type Sync ¶
type Sync interface { C() <-chan *Event Cancel(notify bool) bool Done() bool DoneSub(subSyncID interface{}) bool Ack(ack interface{}) bool Error(err error) bool }
A Sync presents the handler of a synchronize.
type SyncHub ¶
type SyncHub struct {
// contains filtered or unexported fields
}
func NewSyncHub ¶
func NewSyncHub(opts ...SyncHubOption) *SyncHub
func (*SyncHub) Add ¶ added in v0.2.2
func (sh *SyncHub) Add(syncID interface{}, opts ...SyncOption) Sync
func (*SyncHub) DoneSub ¶ added in v0.2.4
DoneSubSyncID finish the partial Sync if other subSyncID exists or else to finish the complete Sync return false means syncID or subSyncID not found
func (*SyncHub) New ¶
func (sh *SyncHub) New(syncID interface{}, opts ...SyncOption) Sync
deprecated
type SyncHubOption ¶
type SyncHubOption func(*SyncHub)
func OptionTimer ¶
func OptionTimer(tmr timer.Timer) SyncHubOption
type SyncOption ¶
type SyncOption func(*synchronize)
Options for Sync
func WithContext ¶ added in v0.2.2
func WithContext(ctx context.Context) SyncOption
bad design, but still I want keep the capability
func WithData ¶
func WithData(data interface{}) SyncOption
func WithEventChan ¶
func WithEventChan(ch chan *Event) SyncOption
func WithSub ¶ added in v0.2.4
func WithSub(subSyncIDs ...interface{}) SyncOption
func WithTimeout ¶
func WithTimeout(d time.Duration) SyncOption
Click to show internal directories.
Click to hide internal directories.