Added a method for listing jobs whose id matches a prefix

This commit is contained in:
Diptanu Choudhury
2016-07-11 12:23:10 -06:00
parent e1fc445b4d
commit e191c3185a

View File

@@ -492,6 +492,18 @@ func (s *StateStore) JobSummaries() (memdb.ResultIterator, error) {
return iter, nil
}
// JobSummaryByPrefix is used to look up Job Summary by id prefix
func (s *StateStore) JobSummaryByPrefix(id string) (memdb.ResultIterator, error) {
txn := s.db.Txn(false)
iter, err := txn.Get("jobsummary", "id_prefix", id)
if err != nil {
return nil, fmt.Errorf("eval lookup failed: %v", err)
}
return iter, nil
}
// UpsertPeriodicLaunch is used to register a launch or update it.
func (s *StateStore) UpsertPeriodicLaunch(index uint64, launch *structs.PeriodicLaunch) error {
txn := s.db.Txn(true)