// QueueSize implements Storage.QueueSize() function
16368
func (q *InMemoryQueueStorage) QueueSize() (int, error) {
	q.lock.Lock()
	defer q.lock.Unlock()
	return q.size, nil
}
1090560
func PublishQSizeOption(v uint) workManagerOption {
	return func(w *workManager) workManagerOption {
		previous := w.publishQSize
		w.publishQSize = v
		return PublishQSizeOption(previous)
	}
}
581023
func (writer *ConsoleWriter) RotateSize() int64 {
	writer.lock.RLock()
	defer writer.lock.RUnlock()

	return 0
}
347526
func NewEvictingStringQueue(size int) *EvictingStringQueue {
	return &EvictingStringQueue{size: size, set: make(map[string]bool)}
}
296744
func NewQueue(handler Handler, concurrencyLimit int) *Queue {

	q := &Queue{
		&queue{
			Handler:          handler,
			ConcurrencyLimit: concurrencyLimit,
			push:             make(chan interface{}),
			pop:              make(chan struct{}),
			suspend:          make(chan bool),
			stop:             make(chan struct{}),
		},
	}

	go q.run()
	runtime.SetFinalizer(q, (*Queue).Stop)
	return q
}
71971
func (e *Engine) DiskSize() int64 {
	walDiskSizeBytes := e.WAL.DiskSizeBytes()
	return e.FileStore.DiskSizeBytes() + walDiskSizeBytes
}
965658
func (engine *Engine) BufferSize(size int) *Session {
	session := engine.NewSession()
	session.isAutoClose = true
	return session.BufferSize(size)
}
462047
func BufferSize(size int) FileStoreOption {
	return func(o *FileStoreOptions) error {
		if size < 0 {
			return fmt.Errorf("buffer size value must be a positive number")
		}
		o.BufferSize = size
		return nil
	}
}
1035776
func NewQueueStore(directory string, limit uint16) *QueueStore {
	if limit == 0 {
		limit = maxLimit
	}
	queueStore := &QueueStore{
		directory: directory,
		limit:     limit,
	}
	return queueStore
}
1263779
func (q *execQueue) queue(f func()) bool {
	q.mu.Lock()
	ok := !q.isClosed() && len(q.funcs) < cap(q.funcs)
	if ok {
		q.funcs = append(q.funcs, f)
		q.cond.Signal()
	}
	q.mu.Unlock()
	return ok
}
477690
func (tsv *TabletServer) TxPoolSize() int {
	return int(tsv.te.txPool.conns.Capacity())
}
87222
func (s *RateLimitedStorage) Flush() error {
	s.wait()
	defer s.signal()

	return s.storage.Flush()
}
66059
func (q *BytesQueue) Push(data []byte) (int, error) {
	dataLen := len(data)

	if q.availableSpaceAfterTail() < dataLen+headerEntrySize {
		if q.availableSpaceBeforeHead() >= dataLen+headerEntrySize {
			q.tail = leftMarginIndex
		} else if q.capacity+headerEntrySize+dataLen >= q.maxCapacity && q.maxCapacity > 0 {
			return -1, &queueError{"Full queue. Maximum size limit reached."}
		} else {
			q.allocateAdditionalMemory(dataLen + headerEntrySize)
		}
	}

	index := q.tail

	q.push(data, dataLen)

	return index, nil
}
981226
func (r *Cache) Capacity() int {
	if r.cacher == nil {
		return 0
	}
	return r.cacher.Capacity()
}
1197940
func (c *syncClient) Dbsize() (result int64, err Error) {
	var resp Response
	resp, err = c.conn.ServiceRequest(&DBSIZE, [][]byte{})
	if err == nil {
		result = resp.GetNumberValue()
	}
	return result, err

}
29453
func (q *Queue) Len() int {
	q.Lock()
	defer q.Unlock()
	return q.len()
}
998142
func (t *TTY) MonitorSize(initialSizes ...*remotecommand.TerminalSize) remotecommand.TerminalSizeQueue {
	outFd, isTerminal := term.GetFdInfo(t.Out)
	if !isTerminal {
		return nil
	}

	t.sizeQueue = &sizeQueue{
		t: *t,
		// make it buffered so we can send the initial terminal sizes without blocking, prior to starting
		// the streaming below
		resizeChan:   make(chan remotecommand.TerminalSize, len(initialSizes)),
		stopResizing: make(chan struct{}),
	}

	t.sizeQueue.monitorSize(outFd, initialSizes...)

	return t.sizeQueue
}