func (s *StateStore) jobVersionByID(txn *memdb.Txn, ws *memdb.WatchSet, id string) ([]*structs.Job, error) {
	// Get all the historic jobs for this ID
	iter, err := txn.Get("job_version", "id_prefix", id)
	if err != nil {
		return nil, err
	}

	if ws != nil {
		ws.Add(iter.WatchCh())
	}

	var all []*structs.Job
	for {
		raw := iter.Next()
		if raw == nil {
			break
		}

		// Ensure the ID is an exact match
		j := raw.(*structs.Job)
		if j.ID != id {
			continue
		}

		all = append(all, j)
	}

	// Reverse so that highest versions first
	for i, j := 0, len(all)-1; i < j; i, j = i+1, j-1 {
		all[i], all[j] = all[j], all[i]
	}

	return all, nil
}
// jobVersionByID is the underlying implementation for retrieving all tracked
// versions of a job and is called under an existing transaction. A watch set
// can optionally be passed in to add the job histories to the watch set.
jobVersionByID is the underlying implementation for retrieving all tracked
versions of a job and is called under an existing transaction. A watch set
can optionally be passed in to add the job histories to the watch set.
// jobVersionByID is the underlying implementation for retrieving all tracked // versions of a job and is called under an existing transaction . A watch set // can optionally be passed in to add the job histories to the watch set .
func (s *StateStore) jobVersionByID(txn *memdb.Txn, ws *memdb.WatchSet, id string) ([]*structs.Job, error) {
	iter, err := txn.Get("job_version", "id_prefix", id)
	if err != nil {
		return nil, err
	}
	if ws != nil {
		ws.Add(iter.WatchCh())
	}
	var all []*structs.Job
	for {
		raw := iter.Next()
		if raw == nil {
			break
		}
		j := raw.(*structs.Job)
		if j.ID != id {
			continue
		}
		all = append(all, j)
	}
	for i, j := 0, len(all)-1; i < j; i, j = i+1, j-1 {
		all[i], all[j] = all[j], all[i]
	}
	return all, nil
}
func ( s * StateStore ) jobVersionByID ( txn * memdb . Txn , ws * memdb . WatchSet , id string ) ( [ ] * structs . Job , error ) { iter , err := txn . Get ( " " , " " , id ) if err != nil { return nil , err } if ws != nil { ws . Add ( iter . WatchCh ( ) ) } var all [ ] * structs . Job for { raw := iter . Next ( ) if raw == nil { break } j := raw . ( * structs . Job ) if j . ID != id { continue } all = append ( all , j ) } for i , j := 0 , len ( all ) - 1 ; i < j ; i , j = i + 1 , j - 1 { all [ i ] , all [ j ] = all [ j ] , all [ i ] } return all , nil }
jobVersionByID is the underlying implementation for retrieving all tracked
versions of a job and is called under an existing transaction.
jobVersionByID is the underlying implementation for retrieving all tracked versions of a job and is called under an existing transaction .
// Get all the historic jobs for this ID // Ensure the ID is an exact match // Reverse so that highest versions first