Ejemplo n.º 1
0
func (c Client) WatchStatus(ctx context.Context, podUniqueKey types.PodUniqueKey, waitIndex uint64) (<-chan PodStatusResult, error) {
	stream, err := c.client.WatchPodStatus(ctx, &podstore_protos.WatchPodStatusRequest{
		PodUniqueKey:    podUniqueKey.String(),
		StatusNamespace: kp.PreparerPodStatusNamespace.String(),
		WaitIndex:       waitIndex,
	})
	if err != nil {
		return nil, err
	}

	outCh := make(chan PodStatusResult)
	go func() {
		defer close(outCh)
		for {
			status, err := stream.Recv()
			select {
			case <-ctx.Done():
				return
			case outCh <- PodStatusResult{
				PodStatus: status,
				Error:     err,
			}:
			}
		}
	}()
	return outCh, nil
}
Ejemplo n.º 2
0
func (f sqliteFinishService) LastFinishForPodUniqueKey(podUniqueKey types.PodUniqueKey) (FinishOutput, error) {
	row := f.db.QueryRow(`
  SELECT id, date, pod_id, pod_unique_key, launchable_id, entry_point, exit_code, exit_status
  FROM finishes
  WHERE pod_unique_key = ?
  `, podUniqueKey.String())
	return scanRow(row)
}
Ejemplo n.º 3
0
Archivo: rm.go Proyecto: petertseng/p2
// Constructs a *P2RM configured to remove a pod identified by a PodUniqueKey (uuid)
func NewUUIDP2RM(client consulutil.ConsulClient, podUniqueKey types.PodUniqueKey, podID types.PodID, labeler labels.ApplicatorWithoutWatches) *P2RM {
	rm := &P2RM{}
	rm.LabelID = podUniqueKey.String()
	rm.PodID = podID
	rm.NodeName = "" // don't need node name to look up a uuid pod
	rm.PodUniqueKey = podUniqueKey
	rm.configureStorage(client, labeler)
	return rm
}
Ejemplo n.º 4
0
func computeRealityIndexPath(key types.PodUniqueKey, node types.NodeName) string {
	return path.Join("reality", node.String(), key.String())
}
Ejemplo n.º 5
0
func computeIntentIndexPath(key types.PodUniqueKey, node types.NodeName) string {
	return path.Join("intent", node.String(), key.String())
}
Ejemplo n.º 6
0
// Given a pod unique key and a node, compute the path to which the main pod
// should be written as well as the secondary index
func computePodPath(key types.PodUniqueKey) string {
	return path.Join(PodTree, key.String())
}