Example #1
0
func (c *consulStore) CAS(key types.PodUniqueKey, status PodStatus, modifyIndex uint64) error {
	if key == "" {
		return util.Errorf("Could not set status for pod with empty uuid")
	}

	rawStatus, err := podStatusToStatus(status)
	if err != nil {
		return err
	}

	return c.statusStore.CASStatus(statusstore.POD, statusstore.ResourceID(key), c.namespace, rawStatus, modifyIndex)
}
Example #2
0
func (c *consulStore) Set(key types.PodUniqueKey, status PodStatus) error {
	if key.ID == "" {
		return util.Errorf("Could not set status for pod with empty uuid")
	}

	rawStatus, err := podStatusToStatus(status)
	if err != nil {
		return err
	}

	return c.statusStore.SetStatus(statusstore.POD, statusstore.ResourceID(key.ID), c.namespace, rawStatus)
}
Example #3
0
func (c *consulStore) Get(key types.PodUniqueKey) (PodStatus, error) {
	if key.ID == "" {
		return PodStatus{}, util.Errorf("Cannot retrieve status for a pod with an empty uuid")
	}

	status, err := c.statusStore.GetStatus(statusstore.POD, statusstore.ResourceID(key.ID), c.namespace)
	if err != nil {
		return PodStatus{}, err
	}

	return statusToPodStatus(status)
}
Example #4
0
func (c *consulStore) WaitForStatus(key types.PodUniqueKey, waitIndex uint64) (PodStatus, *api.QueryMeta, error) {
	if key == "" {
		return PodStatus{}, nil, util.Errorf("Cannot retrieve status for a pod with an empty uuid")
	}

	status, queryMeta, err := c.statusStore.WatchStatus(statusstore.POD, statusstore.ResourceID(key), c.namespace, waitIndex)
	if err != nil {
		return PodStatus{}, queryMeta, err
	}

	podStatus, err := statusToPodStatus(status)
	if err != nil {
		return PodStatus{}, queryMeta, err
	}

	return podStatus, queryMeta, nil
}