Exemple #1
0
func (server *Server) depersistQueue(queue *queue.Queue, bindings []*binding.Binding) error {
	return server.db.Update(func(tx *bolt.Tx) error {
		for _, binding := range bindings {
			if err := binding.DepersistBoltTx(tx); err != nil {
				return err
			}
		}
		return queue.DepersistBoltTx(tx)
	})
}
Exemple #2
0
func (exchange *Exchange) Depersist(db *bolt.DB) error {
	return db.Update(func(tx *bolt.Tx) error {
		bucket := tx.Bucket(EXCHANGES_BUCKET_NAME)
		if bucket == nil {
			return fmt.Errorf("Bucket not found: '%s'", bucket)
		}
		for _, binding := range exchange.bindings {
			if err := binding.DepersistBoltTx(tx); err != nil { // pragma: nocover
				return err
			}
		}
		return persist.DepersistOneBoltTx(bucket, exchange.Name)
	})
}