jobutils

package
v1.0.22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WaitByChan

func WaitByChan(f func()) chan struct{}

Types

type JobGroup

type JobGroup struct {
	// contains filtered or unexported fields
}

func NewJobGroup

func NewJobGroup(tokens int, enterTimeout time.Duration) *JobGroup

func (*JobGroup) Enter

func (group *JobGroup) Enter(ctx context.Context) bool

func (*JobGroup) EnterPro

func (group *JobGroup) EnterPro(ctx context.Context, enterTimeout time.Duration) bool

func (*JobGroup) Exit

func (group *JobGroup) Exit()

func (*JobGroup) Tokens

func (group *JobGroup) Tokens() JobTokens

func (*JobGroup) Wait

func (group *JobGroup) Wait()

type JobTokens

type JobTokens chan struct{}

func NewJobTokens

func NewJobTokens(n int) JobTokens

func (JobTokens) Acquire

func (tokens JobTokens) Acquire(ctx context.Context, timeout time.Duration) bool

func (JobTokens) Lefts

func (tokens JobTokens) Lefts() int

func (JobTokens) Release

func (tokens JobTokens) Release()

func (JobTokens) Totals

func (tokens JobTokens) Totals() int

func (JobTokens) Useds

func (tokens JobTokens) Useds() int

type SmartHandler

type SmartHandler struct {
	// contains filtered or unexported fields
}

func (*SmartHandler) Call

func (handler *SmartHandler) Call()

func (*SmartHandler) Dup

func (handler *SmartHandler) Dup() *SmartHandler

func (*SmartHandler) WithAsync

func (handler *SmartHandler) WithAsync(async bool) *SmartHandler

func (*SmartHandler) WithConcurrentcy

func (handler *SmartHandler) WithConcurrentcy(n int) *SmartHandler

func (*SmartHandler) WithCtx

func (handler *SmartHandler) WithCtx(ctx context.Context) *SmartHandler

func (*SmartHandler) WithDeadline

func (handler *SmartHandler) WithDeadline(deadline time.Duration) *SmartHandler

func (*SmartHandler) WithDelay

func (handler *SmartHandler) WithDelay(delay time.Duration) *SmartHandler

func (*SmartHandler) WithIdent

func (handler *SmartHandler) WithIdent(ident string) *SmartHandler

func (*SmartHandler) WithInterval

func (handler *SmartHandler) WithInterval(interval time.Duration) *SmartHandler

func (*SmartHandler) WithMerge

func (handler *SmartHandler) WithMerge(merge bool) *SmartHandler

type SmartHandlerPtr

type SmartHandlerPtr = *SmartHandler

type SmartHandlers

type SmartHandlers []*SmartHandler

func (SmartHandlers) Append

func (handlers SmartHandlers) Append(more ...*SmartHandler) SmartHandlers

func (SmartHandlers) Call

func (handlers SmartHandlers) Call()

func (SmartHandlers) Purge

func (handlers SmartHandlers) Purge(f func(*SmartHandler) bool) SmartHandlers

func (SmartHandlers) PurgeByIdent

func (handlers SmartHandlers) PurgeByIdent(ident string) SmartHandlers

type SmartHandlersMappingByString

type SmartHandlersMappingByString map[string]SmartHandlers

type TopicBroker

type TopicBroker struct {
	// contains filtered or unexported fields
}

func NewTopicBroker added in v1.0.9

func NewTopicBroker() *TopicBroker

func (*TopicBroker) Publish

func (broker *TopicBroker) Publish(topic string)

func (*TopicBroker) Subscribe

func (broker *TopicBroker) Subscribe(topic string, callback func()) *TopicBrokerSubscribing

func (*TopicBroker) Unsubscribe

func (broker *TopicBroker) Unsubscribe(topic string)

func (*TopicBroker) UnsubscribeByIdent

func (broker *TopicBroker) UnsubscribeByIdent(topic string, ident string)

type TopicBrokerSubscribing

type TopicBrokerSubscribing struct {
	// contains filtered or unexported fields
}

func (*TopicBrokerSubscribing) Done

func (subscribing *TopicBrokerSubscribing) Done() *TopicBroker

func (*TopicBrokerSubscribing) WithAsync added in v1.0.9

func (subscribing *TopicBrokerSubscribing) WithAsync(async bool) *TopicBrokerSubscribing

func (*TopicBrokerSubscribing) WithConcurrentcy added in v1.0.9

func (subscribing *TopicBrokerSubscribing) WithConcurrentcy(n int) *TopicBrokerSubscribing

func (*TopicBrokerSubscribing) WithCtx added in v1.0.9

func (subscribing *TopicBrokerSubscribing) WithCtx(ctx context.Context) *TopicBrokerSubscribing

func (*TopicBrokerSubscribing) WithDeadline added in v1.0.9

func (subscribing *TopicBrokerSubscribing) WithDeadline(deadline time.Duration) *TopicBrokerSubscribing

func (*TopicBrokerSubscribing) WithDelay added in v1.0.9

func (subscribing *TopicBrokerSubscribing) WithDelay(delay time.Duration) *TopicBrokerSubscribing

func (*TopicBrokerSubscribing) WithIdent added in v1.0.9

func (subscribing *TopicBrokerSubscribing) WithIdent(ident string) *TopicBrokerSubscribing

func (*TopicBrokerSubscribing) WithInterval added in v1.0.9

func (subscribing *TopicBrokerSubscribing) WithInterval(interval time.Duration) *TopicBrokerSubscribing

func (*TopicBrokerSubscribing) WithMerge added in v1.0.9

func (subscribing *TopicBrokerSubscribing) WithMerge(merge bool) *TopicBrokerSubscribing

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL