// RemoveFull removes the full document, including metadata.
779095
func (spec MutateInSpec) RemoveFull() (*MutateInOp, error) {
	op := gocbcore.SubDocOp{
		Op:    gocbcore.SubDocOpDeleteDoc,
		Flags: gocbcore.SubdocFlag(SubdocFlagNone),
	}

	return &MutateInOp{op: op}, nil
}
1236716
func (c *modelStateCollection) RemoveAll(query interface{}) (*mgo.ChangeInfo, error) {
	return c.WriteCollection.RemoveAll(c.mungeQuery(query))
}
146102
func GetFull(full uint32, lsb uint16) uint32 {
	if int(lsb)-int(full) > 0 {
		return uint32(lsb)
	}
	if uint16(full%maxUint16) <= lsb {
		return uint32(lsb) + (full/maxUint16)*maxUint16
	}
	return uint32(lsb) + ((full/maxUint16)+1)*maxUint16
}
723090
func removeMetadataUpdated(metadataBytes []byte) (string, error) {
	var metadata map[string]interface{}
	err := json.Unmarshal(metadataBytes, &metadata)
	if err != nil {
		return "", err
	}
	delete(metadata, "updated")

	metadataJson, err := json.Marshal(metadata)
	if err != nil {
		return "", err
	}
	return string(metadataJson), nil
}
737587
func RemoveEmpty(items []string) []string {
	if len(items) == 0 {
		return items
	}
	itemsSlice := make([]string, 0, len(items))
	for _, item := range items {
		if item == "" {
			continue
		}
		itemsSlice = append(itemsSlice, item)
	}
	return itemsSlice
}
142545
func (o *PetDeleteURL) BuildFull(scheme, host string) (*url.URL, error) {
	if scheme == "" {
		return nil, errors.New("scheme is required for a full url on PetDeleteURL")
	}
	if host == "" {
		return nil, errors.New("host is required for a full url on PetDeleteURL")
	}

	base, err := o.Build()
	if err != nil {
		return nil, err
	}

	base.Scheme = scheme
	base.Host = host
	return base, nil
}
1248952
func removeEmptyTree(path string, shouldCheck func(string) bool) (deleted bool, err error) {
	if !shouldCheck(path) {
		return false, nil
	}

	// 'Remove' will delete the directory if it is already empty.
	if err := os.Remove(path); err == nil || os.IsNotExist(err) {
		return true, nil
	}

	// Otherwise need to recurse into it.
	fd, err := os.Open(path)
	if err != nil {
		if os.IsNotExist(err) {
			return true, nil // someone deleted it already, this is OK
		}
		return false, err
	}

	closed := false
	defer func() {
		if !closed {
			fd.Close()
		}
	}()

	total := 0
	removed := 0
	for {
		infos, err := fd.Readdir(100)
		if err == io.EOF || len(infos) == 0 {
			break
		}
		if err != nil {
			return false, err
		}
		total += len(infos)
		for _, info := range infos {
			if info.IsDir() {
				abs := filepath.Join(path, info.Name())
				switch rmed, err := removeEmptyTree(abs, shouldCheck); {
				case err != nil:
					return false, err
				case rmed:
					removed++
				}
			}
		}
	}

	// Close directory, because windows won't remove opened directory.
	fd.Close()
	closed = true

	// The directory is definitely not empty, since we skipped some stuff.
	if total != removed {
		return false, nil
	}

	// The directory is most likely empty now, unless someone concurrently put
	// files there. Unfortunately it is not trivial to detect this specific
	// condition in a cross-platform way. So assume Remove() errors (other than
	// IsNotExit) are due to that.
	err = os.Remove(path)
	return err == nil || os.IsNotExist(err), nil
}
900432
func removeCells(cells, toRemove, fullList []string) ([]string, bool) {
	// The assumption here is we already migrated something,
	// and we're reverting that part. So we're gonna remove
	// records only.
	leftoverCells := make([]string, 0, len(cells))
	if len(cells) == 0 {
		// we migrated all the cells already, take the full list
		// and remove all the ones we're not reverting
		for _, cell := range fullList {
			if !InCellList(cell, toRemove) {
				leftoverCells = append(leftoverCells, cell)
			}
		}
	} else {
		// we migrated a subset of the cells,
		// remove the ones we're reverting
		for _, cell := range cells {
			if !InCellList(cell, toRemove) {
				leftoverCells = append(leftoverCells, cell)
			}
		}
	}

	if len(leftoverCells) == 0 {
		// we don't have any cell left, we need to clear this record
		return nil, true
	}

	return leftoverCells, false
}
50428
func removeAll(path string) error {
	// Only need special handling for windows
	if runtime.GOOS != "windows" {
		return os.RemoveAll(path)
	}

	// Simple case: if Remove works, we're done.
	err := os.Remove(path)
	if err == nil || os.IsNotExist(err) {
		return nil
	}

	// make sure all files are writable so we can delete them
	err = filepath.Walk(path, func(path string, info os.FileInfo, err error) error {
		if err != nil && err != filepath.SkipDir {
			// walk gave us some error, give it back.
			return err
		}
		mode := info.Mode()
		if mode|0200 == mode {
			return nil
		}

		return os.Chmod(path, mode|0200)
	})
	if err != nil {
		return err
	}

	return os.Remove(path)
}
881382
func (r *Reader) ReadFull(b []byte) (int, error) {
	var n int  // read into b
	var nn int // scratch
	l := len(b)
	// either read buffered data,
	// or read directly for the underlying
	// buffer, or fetch more buffered data.
	for n < l && r.state == nil {
		if r.buffered() != 0 {
			nn = copy(b[n:], r.data[r.n:])
			n += nn
			r.n += nn
		} else if l-n > cap(r.data) {
			nn, r.state = r.r.Read(b[n:])
			n += nn
		} else {
			r.more()
		}
	}
	if n < l {
		return n, r.noEOF()
	}
	return n, nil
}
565562
func (p *Polygon) IsFull() bool {
	return len(p.loops) == 1 && p.loops[0].IsFull()
}
64236
func (m *Meta) RemoveDDLReorgHandle(job *model.Job) error {
	err := m.txn.HDel(mDDLJobReorgKey, m.reorgJobStartHandle(job.ID))
	if err != nil {
		return errors.Trace(err)
	}
	if err = m.txn.HDel(mDDLJobReorgKey, m.reorgJobEndHandle(job.ID)); err != nil {
		logutil.Logger(context.Background()).Warn("remove DDL reorg end handle", zap.Error(err))
	}
	if err = m.txn.HDel(mDDLJobReorgKey, m.reorgJobPhysicalTableID(job.ID)); err != nil {
		logutil.Logger(context.Background()).Warn("remove DDL reorg physical ID", zap.Error(err))
	}
	return nil
}
669839
func writeFull(w io.Writer, buf []byte) (n int, err error) {
	var i int
	for n < len(buf) {
		i, err = w.Write(buf[n:])
		n += i
		if err != nil {
			break
		}
	}
	return
}
922922
func (sto *Storage) removeOldest() bool {
	ctx := context.TODO()
	k, v := sto.lru.RemoveOldest()
	if v == nil {
		return false
	}
	sb := v.(blob.SizedRef)
	// TODO: run these without sto.mu held in background
	// goroutine? at least pass a context?
	err := sto.cache.RemoveBlobs(ctx, []blob.Ref{sb.Ref})
	if err != nil {
		log.Printf("proxycache: could not remove oldest blob %v (%d bytes): %v", sb.Ref, sb.Size, err)
		sto.lru.Add(k, v)
		return false
	}
	if sto.debug {
		log.Printf("proxycache: removed blob %v (%d bytes)", sb.Ref, sb.Size)
	}
	sto.cacheBytes -= int64(sb.Size)
	return true
}
813487
func removeContents(dir string) error {
	debug.Println("removing all files in", dir)
	files, err := ioutil.ReadDir(dir)
	if err != nil {
		if os.IsNotExist(err) {
			return nil
		}
		return err
	}
	for _, f := range files {
		if f.IsDir() {
			continue
		}
		err = os.Remove(filepath.Join(dir, f.Name()))
		if err != nil {
			return err
		}
	}
	return nil

}
1249668
func (b *Bulk) Remove(selectors ...interface{}) {
	action := b.action(bulkRemove)
	for _, selector := range selectors {
		if selector == nil {
			selector = bson.D{}
		}
		action.docs = append(action.docs, &deleteOp{
			Collection: b.c.FullName,
			Selector:   selector,
			Flags:      1,
			Limit:      1,
		})
	}
}
1112669
func GetsizeFull(t *os.File) (size *Winsize, err error) {
	var ws Winsize
	err = windowRectCall(&ws, t.Fd(), syscall.TIOCGWINSZ)
	return &ws, err
}