{"modulePath":"github.com/openimsdk/tools","version":"v0.0.50-alpha.127","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package task\n\n## Variables\n\n```go\nvar (\n\tErrGlobalQueueFull     = errors.New(\"global queue is full\")\n\tErrWaitingQueueFull    = errors.New(\"waiting queue is full\")\n\tErrProcessingQueueFull = errors.New(\"processing queue is full\")\n\tErrDataNotFound        = errors.New(\"data not found\")\n)\n```\n\n## Types\n\n```go\ntype QueueManager[T any, K comparable] interface {\n\t// AddKey adds a new key to the queue manager\n\tAddKey(ctx context.Context, key K) error\n\n\t// Insert inserts data into the queue, automatically assigning a key based on the strategy\n\t// Returns the assigned key (empty string if queued in global queue)\n\tInsert(ctx context.Context, data T) (K, error)\n\n\t// InsertByKey inserts data into the queue for a specific key\n\tInsertByKey(ctx context.Context, key K, data T) error\n\n\t// Delete removes data from the specified key's queue\n\tDelete(ctx context.Context, key K, data T) error\n\n\t// DeleteKey removes a key and its associated queue\n\tDeleteKey(ctx context.Context, key K) error\n\n\t// GetProcessingQueueLengths returns the length of processing queue for each key\n\tGetProcessingQueueLengths(ctx context.Context) (map[K]int, error)\n\n\t// TransformProcessingData moves data from one key's processing queue to another\n\tTransformProcessingData(ctx context.Context, fromKey, toKey K, data T) error\n\n\t// AutoTransformProcessingData moves data from one key's processing queue to another key selected by strategy\n\t// Returns the selected target key\n\tAutoTransformProcessingData(ctx context.Context, fromKey K, data T) (K, error)\n\n\t// GetGlobalQueuePosition returns the position of data in the global queue (0-based, -1 if not found)\n\tGetGlobalQueuePosition(ctx context.Context, data T) (int, error)\n}\n```\nQueueManager defines the interface for managing task queues\n\n","path":"github.com/openimsdk/tools/queue/task","name":"task","synopsis":"","isRedistributable":true}
