// deleteFromPending prepares a batch of messages and deletes them
961734
func (dq *deleteQueue) deleteFromPending() {
	dq.Lock()
	defer dq.Unlock()

	n := len(dq.entries)
	if n > awsBatchSizeLimit {
		n = awsBatchSizeLimit
	}
	fails, err := dq.deleteBatch(dq.entries[:n])
	if err != nil {
		dq.svc.Logger("Error deleting batch: %s", err)
		return
	}

	dq.entries = dq.entries[n:]

	if len(fails) > 0 {
		dq.entries = append(dq.entries, fails...)
	}
}
45833
func (c cacheObjects) DeleteObject(ctx context.Context, bucket, object string) (err error) {
	if err = c.DeleteObjectFn(ctx, bucket, object); err != nil {
		return
	}
	if c.isCacheExclude(bucket, object) {
		return
	}
	dcache, cerr := c.cache.getCachedFSLoc(ctx, bucket, object)
	if cerr == nil {
		_ = dcache.DeleteObject(ctx, bucket, object)
	}
	return
}
144480
func (iter *s3DeleteVersionListIterator) DeleteObject() s3manager.BatchDeleteObject {
	return s3manager.BatchDeleteObject{
		Object: &s3.DeleteObjectInput{
			Bucket:    iter.Bucket,
			Key:       iter.objects[0].Key,
			VersionId: iter.objects[0].VersionId,
		},
	}
}
441527
func DeleterFromJSON(js json.RawMessage) (rw.Deleter, error) {
	tmp := struct {
		Type string `json:"type"`
	}{}
	var res rw.Deleter
	if err := json.Unmarshal(js, &tmp); err != nil {
		return nil, err
	} else if tmp.Type == "" {
		return nil, errors.New("a deleter should define it's type")
	} else if res = RWDFromString(tmp.Type); res == nil {
		return nil, fmt.Errorf("deleter of type '%s' is not supported", tmp.Type)
	}
	return res, UnmarshalAndStart(res, js)
}
153479
func DeleteBuildsWithProjectId(projectId int64) error {
	o := orm.NewOrm()

	_, err := o.Delete(&Build{ProjectId: projectId})

	return err
}
94157
func (ds *datastore) DeleteObject(kvObject KVObject) error {
	if ds.sequential {
		ds.Lock()
		defer ds.Unlock()
	}

	// cleanup the cache first
	if ds.cache != nil {
		// If persistent store is skipped, sequencing needs to
		// happen in cache.
		ds.cache.del(kvObject, kvObject.Skip())
	}

	if kvObject.Skip() {
		return nil
	}

	return ds.store.Delete(Key(kvObject.Key()...))
}
561845
func (r *TSMReader) BatchDelete() BatchDeleter {
	r.deleteMu.Lock()
	return &batchDelete{r: r}
}
543018
func (c *Client) DeleteServiceOffering(p *DeleteServiceOfferingParameter) (*Result, error) {
	obj, err := c.Request("deleteServiceOffering", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.(*Result), err
}
1101570
func (b *tableBatch) Delete(key []byte) error {
	return b.batch.Delete(append([]byte(b.prefix), key...))
}
433494
func (m Message) Delete() (err error) {
	return m.q.DeleteMessage(m.Id)
}
1110067
func (f *Factory) recursiveDelete(n *node) {
	parent := n.parent
	if parent == nil {
		return
	}
	delete(parent.children, n.name)
	if len(parent.children) == 0 {
		f.recursiveDelete(parent)
	}
}
981022
func (pm *PortMapper) DeleteForwardingTableEntry(proto string, sourceIP net.IP, sourcePort int, containerIP string, containerPort int) error {
	return pm.forward(iptables.Delete, proto, sourceIP, sourcePort, containerIP, containerPort)
}
1260538
func (api *PublicWhisperAPI) DeleteMessageFilter(id string) (bool, error) {
	api.mu.Lock()
	defer api.mu.Unlock()

	delete(api.lastUsed, id)
	return true, api.w.Unsubscribe(id)
}
500547
func (m *DummyMailbox) DeleteFlaggedMessages() ([]Message, error) {
	var delIDs []int
	var delMsgs []Message

	// Find messages to be deleted.
	for i, msg := range m.messages {
		if msg.Flags().HasFlags(types.FlagDeleted) {
			delIDs = append(delIDs, i)
			delMsgs = append(delMsgs, msg)
		}
	}

	// Delete message from slice. Run this backward because otherwise it would
	// fail if we have multiple items to remove.
	for x := len(delIDs) - 1; x >= 0; x-- {
		i := delIDs[x]
		// From: https://github.com/golang/go/wiki/SliceTricks
		m.messages, m.messages[len(m.messages)-1] = append(m.messages[:i],
			m.messages[i+1:]...), nil
	}

	// Update sequence numbers.
	for i, msg := range m.messages {
		dmsg := msg.(*DummyMessage)
		dmsg.sequenceNumber = uint32(i) + 1
	}

	return delMsgs, nil
}
1043138
func (i *Index) DeleteObjects(objectIDs []string, opts ...interface{}) (res BatchRes, err error) {
	objects := make([]interface{}, len(objectIDs))

	for j, id := range objectIDs {
		objects[j] = map[string]string{"objectID": id}
	}

	var operations []BatchOperation
	if operations, err = newOperationBatch(objects, DeleteObject); err == nil {
		res, err = i.Batch(operations, opts...)
	} else {
		res.wait = noWait
	}
	return
}
1054774
func (c *ApiController) DeleteProjectAndBuilds() {
	log.Info("Delete project and the builds")

	projectId, _ := c.GetInt64(":projectId")
	models.DeleteProject(projectId)
	models.DeleteBuildsWithProjectId(projectId)

	return
}
1372573
func (client *Client) DeleteLIFF(liffID string) *DeleteLIFFCall {
	return &DeleteLIFFCall{
		c:      client,
		liffID: liffID,
	}
}