{"modulePath":"github.com/flant/shell-operator","version":"v1.0.0-beta.5","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package queue\n\n## Types\n\n```go\ntype IterateOperation func(task interface{}, index int) string\n```\n\n```go\ntype Queue struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewQueue() *Queue\n```\nNewQueue creates a new queue.\n\n```go\nfunc (q *Queue) Add(task interface{})\n```\nAdd adds the last element.\n\n```go\nfunc (q *Queue) AddWatcher(queueWatcher QueueWatcher)\n```\nAddWatcher adds queue watcher.\n\n```go\nfunc (q *Queue) ChangesDisable()\n```\n\n```go\nfunc (q *Queue) ChangesEnable(runCallbackOnPreviousChanges bool)\n```\nВключить вызов QueueChangeCallback при каждом изменении В паре с ChangesDisabled могут быть использованы, чтобы производить массовые изменения. Если runCallbackOnPreviousChanges true, то будет вызвана QueueChangeCallback\n\n```go\nfunc (q *Queue) IsEmpty() bool\n```\n\n```go\nfunc (q *Queue) IterateWithLock(operation IterateOperation) io.Reader\n```\nIterateWithLock executes operation on all elements of the queue with a queue lock.\n\n```go\nfunc (q *Queue) Length() int\n```\n\n```go\nfunc (q *Queue) Peek() (task interface{}, err error)\n```\nPeek examines the first element (get without delete).\n\n```go\nfunc (q *Queue) Pop() (task interface{})\n```\nPop pops the first element (delete).\n\n```go\nfunc (q *Queue) Push(task interface{})\n```\nPush pushes the element as the first element.\n\n```go\nfunc (q *Queue) WithLock(operation TaskOperation) string\n```\nWithLock executes operation on the first element of the queue with a queue lock.\n\n```go\ntype QueueWatcher interface {\n\tQueueChangeCallback()\n}\n```\n\n```go\ntype TaskOperation func(topTask interface{}) string\n```\nТип метода — операция над первым элементом очереди\n\n","path":"github.com/flant/shell-operator/pkg/queue","name":"queue","synopsis":"","isRedistributable":true}
