func (s *BoltStore) PipelineGetRunByPipelineIDAndID(pipelineid int, runid int) (*gaia.PipelineRun, error) {
	var pipelineRun *gaia.PipelineRun
	return pipelineRun, s.db.View(func(tx *bolt.Tx) error {
		b := tx.Bucket(pipelineRunBucket)
		return b.ForEach(func(k, v []byte) error {
			r := &gaia.PipelineRun{}
			err := json.Unmarshal(v, r)
			if err != nil {
				return err
			}
			if r.PipelineID == pipelineid && r.ID == runid {
				pipelineRun = r
			}
			return nil
		})
	})
}
PipelineGetRunByPipelineIDAndID looks for pipeline run by given pipeline id and run id.
package store
import (
	"encoding/json"
	bolt "go.etcd.io/bbolt"
	"github.com/gaia-pipeline/gaia"
)
func (s *BoltStore) CreatePipelinePut(p *gaia.CreatePipeline) error {
	return s.db.Update(func(tx *bolt.Tx) error {
		b := tx.Bucket(createPipelineBucket)
		m, err := json.Marshal(p)
		if err != nil {
			return err
		}
		return b.Put([]byte(p.ID), m)
	})
}
func (s *BoltStore) CreatePipelineGet() ([]gaia.CreatePipeline, error) {
	var pipelineList []gaia.CreatePipeline
	return pipelineList, s.db.View(func(tx *bolt.Tx) error {
		b := tx.Bucket(createPipelineBucket)
		return b.ForEach(func(k, v []byte) error {
			p := &gaia.CreatePipeline{}
			err := json.Unmarshal(v, p)
			if err != nil {
				return err
			}
			pipelineList = append(pipelineList, *p)
			return nil
		})
	})
}
func (s *BoltStore) PipelinePut(p *gaia.Pipeline) error {
	return s.db.Update(func(tx *bolt.Tx) error {
		b := tx.Bucket(pipelineBucket)
		if p.ID == 0 {
			id, err := b.NextSequence()
			if err != nil {
				return err
			}
			p.ID = int(id)
		}
		buf, err := json.Marshal(p)
		if err != nil {
			return err
		}
		return b.Put(itob(p.ID), buf)
	})
}
func (s *BoltStore) PipelineGet(id int) (*gaia.Pipeline, error) {
	var pipeline *gaia.Pipeline
	return pipeline, s.db.View(func(tx *bolt.Tx) error {
		b := tx.Bucket(pipelineBucket)
		v := b.Get(itob(id))
		if v == nil {
			return nil
		}
		pipeline = &gaia.Pipeline{}
		err := json.Unmarshal(v, pipeline)
		if err != nil {
			return err
		}
		return nil
	})
}
func (s *BoltStore) PipelineGetByName(n string) (*gaia.Pipeline, error) {
	var pipeline *gaia.Pipeline
	return pipeline, s.db.View(func(tx *bolt.Tx) error {
		b := tx.Bucket(pipelineBucket)
		return b.ForEach(func(k, v []byte) error {
			p := &gaia.Pipeline{}
			err := json.Unmarshal(v, p)
			if err != nil {
				return err
			}
			if p.Name == n {
				pipeline = p
			}
			return nil
		})
	})
}
func (s *BoltStore) PipelineGetRunHighestID(p *gaia.Pipeline) (int, error) {
	var highestID int
	return highestID, s.db.View(func(tx *bolt.Tx) error {
		b := tx.Bucket(pipelineRunBucket)
		return b.ForEach(func(k, v []byte) error {
			r := &gaia.PipelineRun{}
			err := json.Unmarshal(v, r)
			if err != nil {
				return err
			}
			if r.PipelineID == p.ID {
				if r.ID > highestID {
					highestID = r.ID
				}
			}
			return nil
		})
	})
}
func (s *BoltStore) PipelinePutRun(r *gaia.PipelineRun) error {
	return s.db.Update(func(tx *bolt.Tx) error {
		b := tx.Bucket(pipelineRunBucket)
		buf, err := json.Marshal(r)
		if err != nil {
			return err
		}
		return b.Put([]byte(r.UniqueID), buf)
	})
}
func (s *BoltStore) PipelineGetScheduled(limit int) ([]*gaia.PipelineRun, error) {
	var runList []*gaia.PipelineRun
	return runList, s.db.View(func(tx *bolt.Tx) error {
		b := tx.Bucket(pipelineRunBucket)
		return b.ForEach(func(k, v []byte) error {
			if len(runList) >= limit {
				return nil
			}
			r := &gaia.PipelineRun{}
			err := json.Unmarshal(v, r)
			if err != nil {
				return err
			}
			if r.Status == gaia.RunNotScheduled {
				runList = append(runList, r)
			}
			return nil
		})
	})
}