func StatusTableHandler(w http.ResponseWriter, req *http.Request) {
	if bbpd_runinfo.BBPDAbortIfClosed(w) {
		return
	}
	start := time.Now()
	if req.Method != "GET" {
		e := "describe_table_route.StatusTableHandler:method only supports GET"
		log.Printf(e)
		http.Error(w, e, http.StatusBadRequest)
		return
	}
	pathElts := strings.Split(req.URL.Path, "/")
	if len(pathElts) != 3 {
		e := "describe_table_route.StatusTableHandler:cannot parse path. try /status-table/TABLENAME"
		log.Printf(e)
		http.Error(w, e, http.StatusBadRequest)
		return
	}
	ue_tn, ue_err := url.QueryUnescape(string(pathElts[2]))
	if ue_err != nil {
		e := fmt.Sprintf("cannot unescape %s, %s",
			string(pathElts[2]), ue_err.Error())
		log.Printf(e)
		http.Error(w, e, http.StatusInternalServerError)
		return
	}

	status := "ACTIVE" // our default key
	if query_status, status_ok := req.URL.Query()["status"]; status_ok {
		status = query_status[0]
	}

	poll := false
	if query_poll, poll_ok := req.URL.Query()["poll"]; poll_ok {
		if query_poll[0] == "1" || query_poll[0] == "yes" {
			poll = true
		}
	}

	tries := 1
	if poll {
		tries = 50
	}
	is_status, status_err := desc.PollTableStatus(
		ue_tn,
		status,
		tries)

	if status_err != nil {
		e := fmt.Sprintf("describe_table_route.StatusTableHandler:cannot get status %s from %s, err %s", status, ue_tn, status_err.Error())
		log.Printf(e)
		http.Error(w, e, http.StatusInternalServerError)
		return
	}

	s := desc.StatusResult{StatusResult: is_status}
	sj, sjerr := json.Marshal(s)
	if sjerr != nil {
		e := fmt.Sprintf("describe_table_route.StatusTableHandler:cannot get convert status to json, err %s", sjerr.Error())
		log.Printf(e)
		http.Error(w, e, http.StatusInternalServerError)
		return
	}
	end := time.Now()
	duration := fmt.Sprintf("%v", end.Sub(start))
	w.Header().Set(bbpd_const.CONTENTTYPE, bbpd_const.JSONMIME)
	b, json_err := json.Marshal(bbpd_msg.Response{
		Name:       desc.ENDPOINT_NAME,
		StatusCode: http.StatusOK,
		Body:       sj,
		Run: bbpd_msg.RunInfo{Method: req.Method,
			Host:     bbpd_const.LOCALHOST,
			Duration: duration,
			Start:    start,
			End:      end}})
	if json_err != nil {
		e := fmt.Sprintf("describe_table_route.StatusTableHandler:desc marshal failure %s", json_err.Error())
		log.Printf(e)
		http.Error(w, e, http.StatusInternalServerError)
		return
	}
	io.WriteString(w, string(b))
}
// StatusTableHandler is not a standard endpoint. It can be used to poll a table for readiness
// after a CreateTable or UpdateTable request.
StatusTableHandler is not a standard endpoint. It can be used to poll a table for readiness
after a CreateTable or UpdateTable request.
// StatusTableHandler is not a standard endpoint . It can be used to poll a table for readiness // after a CreateTable or UpdateTable request .
func StatusTableHandler(w http.ResponseWriter, req *http.Request) {
	if bbpd_runinfo.BBPDAbortIfClosed(w) {
		return
	}
	start := time.Now()
	if req.Method != "GET" {
		e := "describe_table_route.StatusTableHandler:method only supports GET"
		log.Printf(e)
		http.Error(w, e, http.StatusBadRequest)
		return
	}
	pathElts := strings.Split(req.URL.Path, "/")
	if len(pathElts) != 3 {
		e := "describe_table_route.StatusTableHandler:cannot parse path. try /status-table/TABLENAME"
		log.Printf(e)
		http.Error(w, e, http.StatusBadRequest)
		return
	}
	ue_tn, ue_err := url.QueryUnescape(string(pathElts[2]))
	if ue_err != nil {
		e := fmt.Sprintf("cannot unescape %s, %s",
			string(pathElts[2]), ue_err.Error())
		log.Printf(e)
		http.Error(w, e, http.StatusInternalServerError)
		return
	}
	status := "ACTIVE" 
	if query_status, status_ok := req.URL.Query()["status"]; status_ok {
		status = query_status[0]
	}
	poll := false
	if query_poll, poll_ok := req.URL.Query()["poll"]; poll_ok {
		if query_poll[0] == "1" || query_poll[0] == "yes" {
			poll = true
		}
	}
	tries := 1
	if poll {
		tries = 50
	}
	is_status, status_err := desc.PollTableStatus(
		ue_tn,
		status,
		tries)
	if status_err != nil {
		e := fmt.Sprintf("describe_table_route.StatusTableHandler:cannot get status %s from %s, err %s", status, ue_tn, status_err.Error())
		log.Printf(e)
		http.Error(w, e, http.StatusInternalServerError)
		return
	}
	s := desc.StatusResult{StatusResult: is_status}
	sj, sjerr := json.Marshal(s)
	if sjerr != nil {
		e := fmt.Sprintf("describe_table_route.StatusTableHandler:cannot get convert status to json, err %s", sjerr.Error())
		log.Printf(e)
		http.Error(w, e, http.StatusInternalServerError)
		return
	}
	end := time.Now()
	duration := fmt.Sprintf("%v", end.Sub(start))
	w.Header().Set(bbpd_const.CONTENTTYPE, bbpd_const.JSONMIME)
	b, json_err := json.Marshal(bbpd_msg.Response{
		Name:       desc.ENDPOINT_NAME,
		StatusCode: http.StatusOK,
		Body:       sj,
		Run: bbpd_msg.RunInfo{Method: req.Method,
			Host:     bbpd_const.LOCALHOST,
			Duration: duration,
			Start:    start,
			End:      end}})
	if json_err != nil {
		e := fmt.Sprintf("describe_table_route.StatusTableHandler:desc marshal failure %s", json_err.Error())
		log.Printf(e)
		http.Error(w, e, http.StatusInternalServerError)
		return
	}
	io.WriteString(w, string(b))
}
func StatusTableHandler ( w http . ResponseWriter , req * http . Request ) { if bbpd_runinfo . BBPDAbortIfClosed ( w ) { return } start := time . Now ( ) if req . Method != " " { e := " " log . Printf ( e ) http . Error ( w , e , http . StatusBadRequest ) return } pathElts := strings . Split ( req . URL . Path , " " ) if len ( pathElts ) != 3 { e := " " log . Printf ( e ) http . Error ( w , e , http . StatusBadRequest ) return } ue_tn , ue_err := url . QueryUnescape ( string ( pathElts [ 2 ] ) ) if ue_err != nil { e := fmt . Sprintf ( " " , string ( pathElts [ 2 ] ) , ue_err . Error ( ) ) log . Printf ( e ) http . Error ( w , e , http . StatusInternalServerError ) return } status := " " if query_status , status_ok := req . URL . Query ( ) [ " " ] ; status_ok { status = query_status [ 0 ] } poll := false if query_poll , poll_ok := req . URL . Query ( ) [ " " ] ; poll_ok { if query_poll [ 0 ] == " " || query_poll [ 0 ] == " " { poll = true } } tries := 1 if poll { tries = 50 } is_status , status_err := desc . PollTableStatus ( ue_tn , status , tries ) if status_err != nil { e := fmt . Sprintf ( " " , status , ue_tn , status_err . Error ( ) ) log . Printf ( e ) http . Error ( w , e , http . StatusInternalServerError ) return } s := desc . StatusResult { StatusResult : is_status } sj , sjerr := json . Marshal ( s ) if sjerr != nil { e := fmt . Sprintf ( " " , sjerr . Error ( ) ) log . Printf ( e ) http . Error ( w , e , http . StatusInternalServerError ) return } end := time . Now ( ) duration := fmt . Sprintf ( " " , end . Sub ( start ) ) w . Header ( ) . Set ( bbpd_const . CONTENTTYPE , bbpd_const . JSONMIME ) b , json_err := json . Marshal ( bbpd_msg . Response { Name : desc . ENDPOINT_NAME , StatusCode : http . StatusOK , Body : sj , Run : bbpd_msg . RunInfo { Method : req . Method , Host : bbpd_const . LOCALHOST , Duration : duration , Start : start , End : end } } ) if json_err != nil { e := fmt . Sprintf ( " " , json_err . Error ( ) ) log . Printf ( e ) http . Error ( w , e , http . StatusInternalServerError ) return } io . WriteString ( w , string ( b ) ) }
StatusTableHandler is not a standard endpoint.
StatusTableHandler is not a standard endpoint .
// our default key