code: func (store *LimitedStore) ensureSpace(size int64) error {
  	if (store.usedSize + size) <= store.StoreSize {
  		// Enough space is available to store the new upload
  		return nil
  	}
  
  	sortedUploads := make(pairlist, len(store.uploads))
  	i := 0
  	for u, h := range store.uploads {
  		sortedUploads[i] = pair{u, h}
  		i++
  	}
  	sort.Sort(sort.Reverse(sortedUploads))
  
  	// Forward traversal through the uploads in terms of size, biggest upload first
  	for _, k := range sortedUploads {
  		id := k.key
  
  		if err := store.terminate(id); err != nil {
  			return err
  		}
  
  		if (store.usedSize + size) <= store.StoreSize {
  			// Enough space has been freed to store the new upload
  			return nil
  		}
  	}
  
  	return nil
  }
docs: // Ensure enough space is available to store an upload of the specified size.
  // It will terminate uploads until enough space is freed.