// shardSize return the size of a single shard.
// The first non-zero size is returned,
// or 0 if all shards are size 0.
339925
func shardSize(shards [][]byte) int {
	for _, shard := range shards {
		if len(shard) != 0 {
			return len(shard)
		}
	}
	return 0
}
1032527
func (s *DeleteByQueryService) Size(size int) *DeleteByQueryService {
	s.size = &size
	return s
}
501111
func (s *ExpDecaySample) Size() int {
	s.mutex.Lock()
	defer s.mutex.Unlock()
	return s.values.Size()
}
1243334
func (sra ShardReferenceArray) Less(i, j int) bool {
	if sra[i].KeyRange == nil || len(sra[i].KeyRange.Start) == 0 {
		return true
	}
	if sra[j].KeyRange == nil || len(sra[j].KeyRange.Start) == 0 {
		return false
	}
	return bytes.Compare(sra[i].KeyRange.Start, sra[j].KeyRange.Start) < 0
}
692469
func (r *RepositoryContent) GetSize() int {
	if r == nil || r.Size == nil {
		return 0
	}
	return *r.Size
}
242842
func (s *ReindexService) Size(size int) *ReindexService {
	s.size = &size
	return s
}
1231044
func (d *Failstore) GetSize(k ds.Key) (int, error) {
	err := d.errfunc("getsize")
	if err != nil {
		return -1, err
	}

	return d.child.GetSize(k)
}
1031900
func (db *Database) Size() (common.StorageSize, common.StorageSize) {
	db.lock.RLock()
	defer db.lock.RUnlock()

	// db.dirtiesSize only contains the useful data in the cache, but when reporting
	// the total memory consumption, the maintenance metadata is also needed to be
	// counted.
	var metadataSize = common.StorageSize((len(db.dirties) - 1) * cachedNodeSize)
	var metarootRefs = common.StorageSize(len(db.dirties[common.Hash{}].children) * (common.HashLength + 2))
	return db.dirtiesSize + db.childrenSize + metadataSize - metarootRefs, db.preimagesSize
}
45038
func (s *shard) Len() int {
	s.RLock()
	l := len(s.items)
	s.RUnlock()
	return l
}
881193
func (w *BatchedFileWriter) Size() int64 {
	stats, err := w.getStats()
	if err != nil {
		return 0
	}
	return stats.Size()
}
924507
func (d *Dependency) Normalize() error {
	if d.Shards == 0 {
		d.Shards = 1
	}
	if err := d.GetAttempts().Normalize(); err != nil {
		return err
	}
	return d.Phrase.Normalize()
}
610556
func (d *Datastore) GetSize(k ds.Key) (int, error) {
	var size int
	err := d.runOp(func() error {
		var err error
		size, err = d.Batching.GetSize(k)
		return err
	})
	return size, err
}
60333
func (b *Bucket) GetSize(refresh bool) (size int64, err error) {
	if refresh {
		b.Refresh()
	}

	var sz int64
	for _, gs := range b.GatherStats("") {
		if len(gs.Stats) > 0 {
			sz, err = strconv.ParseInt(gs.Stats["ep_value_size"], 10, 64)
			if err != nil {
				return 0, err
			}
			size += sz
		}
	}

	return size, nil
}
792417
func (ix *Reindexer) Size(size int) *Reindexer {
	ix.size = size
	return ix
}
1252191
func WindowSize() (w, h int) {
	w = int(WindowWidth())
	h = int(WindowHeight())
	return
}
572606
func (d *MutexDatastore) GetSize(key ds.Key) (size int, err error) {
	d.RLock()
	defer d.RUnlock()
	return d.child.GetSize(key)
}
536781
func (s *UpdateByQueryService) ScrollSize(scrollSize int) *UpdateByQueryService {
	s.scrollSize = &scrollSize
	return s
}