;;======================================================================
;; Copyright 2006-2017, Matthew Welland.
;; 
;; This file is part of Megatest.
;; 
;;     Megatest is free software: you can redistribute it and/or modify
;;     it under the terms of the GNU General Public License as published by
;;     the Free Software Foundation, either version 3 of the License, or
;;     (at your option) any later version.
;; 
;;     Megatest is distributed in the hope that it will be useful,
;;     but WITHOUT ANY WARRANTY; without even the implied warranty of
;;     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;     GNU General Public License for more details.
;; 
;;     You should have received a copy of the GNU General Public License
;;     along with Megatest.  If not, see <http://www.gnu.org/licenses/>.
;;
;;======================================================================

(use format typed-records) ;; RADT => purpose of json format??

(declare (unit rmt))
(declare (uses api))
(include "common_records.scm")

(use (prefix pkts pkts:) srfi-18)

(defstruct cmdrec
  cmd
  (host    #f)
  (run-ids #f)
  params)

;; call cmd on remote host (#f for any host)
;;
;; example: (rmt:run 'get-runs target run-name test-patt state status)
;;
(define (rmt:run cmd . params)
  (let ((server (rmt:get-server cmdrec))) ;; look up server 
    #f))
  
(define (rmt:get-connection-info . args) #t)
(define (rmt:send-receive . args) #t)
(define (rmt:print-db-stats . args) #t)
(define (rmt:get-max-query-average . args) #t)
(define (rmt:open-qry-close-locally . args) #t)
(define (rmt:send-receive-no-auto-client-setup . args) #t)
(define (rmt:kill-server . args) #t)
(define (rmt:start-server . args) #t)
(define (rmt:login . args) #t)
(define (rmt:login-no-auto-client-setup . args) #t)
(define (rmt:general-call . args) #t)
(define (rmt:get-latest-host-load . args) #t)
(define (rmt:sdb-qry . args) #t)
(define (rmt:runtests . args) #t)
(define (rmt:get-run-record-ids . args) #t)
(define (rmt:get-changed-record-ids . args) #t)
(define (rmt:get-tests-tags . args) #t)
(define (rmt:get-key-val-pairs . args) #t)
(define (rmt:get-keys . args) #t)
(define (rmt:get-keys-write . args) #t)
(define (rmt:get-key-vals . args) #t)
(define (rmt:get-targets . args) #t)
(define (rmt:get-target . args) #t)
(define (rmt:get-run-times . args) #t)
(define (rmt:register-test . args) #t)
(define (rmt:get-test-id . args) #t)
(define (rmt:get-test-info-by-id . args) #t)
(define (rmt:test-get-rundir-from-test-id . args) #t)
(define (rmt:open-test-db-by-test-id . args) #t)
(define (rmt:test-set-state-status-by-id . args) #t)
(define (rmt:set-tests-state-status . args) #t)
(define (rmt:get-tests-for-run . args) #t)
(define (rmt:synchash-get . args) #t)
(define (rmt:get-tests-for-run-mindata . args) #t)
(define (rmt:get-tests-for-runs-mindata . args) #t)
(define (rmt:delete-test-records . args) #t)
(define (rmt:test-set-state-status . args) #t)
(define (rmt:test-toplevel-num-items . args) #t)
(define (rmt:get-matching-previous-test-run-records . args) #t)
(define (rmt:test-get-logfile-info . args) #t)
(define (rmt:test-get-records-for-index-file . args) #t)
(define (rmt:get-testinfo-state-status . args) #t)
(define (rmt:test-set-log! . args) #t)
(define (rmt:test-set-top-process-pid . args) #t)
(define (rmt:test-get-top-process-pid . args) #t)
(define (rmt:get-run-ids-matching-target . args) #t)
(define (rmt:test-get-paths-matching-keynames-target-new . args) #t)
(define (rmt:get-prereqs-not-met . args) #t)
(define (rmt:get-count-tests-running-for-run-id . args) #t)
(define (rmt:get-count-tests-running . args) #t)
(define (rmt:get-count-tests-running-for-testname . args) #t)
(define (rmt:get-count-tests-running-in-jobgroup . args) #t)
(define (rmt:set-state-status-and-roll-up-items . args) #t)
(define (rmt:update-pass-fail-counts . args) #t)
(define (rmt:top-test-set-per-pf-counts . args) #t)
(define (rmt:get-raw-run-stats . args) #t)
(define (rmt:get-test-times . args) #t)
(define (rmt:get-run-info . args) #t)
(define (rmt:get-num-runs . args) #t)
(define (rmt:get-runs-cnt-by-patt . args) #t)
(define (rmt:register-run . args) #t)
(define (rmt:get-run-name-from-id . args) #t)
(define (rmt:delete-run . args) #t)
(define (rmt:update-run-stats . args) #t)
(define (rmt:delete-old-deleted-test-records . args) #t)
(define (rmt:get-runs . args) #t)
(define (rmt:simple-get-runs . args) #t)
(define (rmt:get-all-run-ids . args) #t)
(define (rmt:get-prev-run-ids . args) #t)
(define (rmt:lock/unlock-run . args) #t)
(define (rmt:get-run-status . args) #t)
(define (rmt:set-run-status . args) #t)
(define (rmt:update-run-event_time . args) #t)
(define (rmt:get-runs-by-patt . args) #t)
(define (rmt:find-and-mark-incomplete . args) #t)
(define (rmt:get-main-run-stats . args) #t)
(define (rmt:get-var . args) #t)
(define (rmt:del-var . args) #t)
(define (rmt:set-var . args) #t)
(define (rmt:find-and-mark-incomplete-all-runs . args) #t)
(define (rmt:get-previous-test-run-record . args) #t)
(define (rmt:get-run-stats . args) #t)
(define (rmt:teststep-set-status! . args) #t)
(define (rmt:get-steps-for-test . args) #t)
(define (rmt:get-steps-info-by-id . args) #t)
(define (rmt:read-test-data . args) #t)
(define (rmt:read-test-data* . args) #t)
(define (rmt:get-data-info-by-id . args) #t)
(define (rmt:testmeta-add-record . args) #t)
(define (rmt:testmeta-get-record . args) #t)
(define (rmt:testmeta-update-field . args) #t)
(define (rmt:test-data-rollup . args) #t)
(define (rmt:csv->test-data . args) #t)
(define (rmt:tasks-find-task-queue-records . args) #t)
(define (rmt:tasks-add . args) #t)
(define (rmt:tasks-set-state-given-param-key . args) #t)
(define (rmt:tasks-get-last . args) #t)
(define (rmt:no-sync-set . args) #t)
(define (rmt:no-sync-get/default . args) #t)
(define (rmt:no-sync-del! . args) #t)
(define (rmt:no-sync-get-lock . args) #t)
(define (rmt:archive-get-allocations . args) #t)
(define (rmt:archive-register-block-name . args) #t)
(define (rmt:archive-allocate-testsuite/area-to-block . args) #t)
(define (rmt:archive-register-disk . args) #t)
(define (rmt:test-set-archive-block-id . args) #t)
(define (rmt:test-get-archive-block-info . args) #t)
