Commit 423b9918 authored by Dave Griffiths's avatar Dave Griffiths
Browse files

docs

parent 0611b540
| ktv | ktv-list | sql
| | racket-fix
| entity-values | entity-insert | entity-get |
| entity-update |
| entity-sync | entity-filter |
| eavdb |
......@@ -13,7 +13,6 @@
;; You should have received a copy of the GNU Affero General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;; abstractions for synced databased
(msg "dbsync.scm")
......@@ -173,6 +172,9 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; syncing code
;; todo - separate logic from gui and stick this in common code
;; then we can unit test this stuff...
(define url "http://192.168.2.1:8889/symbai?")
(define (build-url-from-ktv ktv)
......@@ -195,6 +197,7 @@
"&version=" (number->string (list-ref (car e) 3))
(build-url-from-ktvlist (cadr e))))
;; todo fix all hardcoded paths here
(define (send-files ktvlist)
(msg "send-files" ktvlist)
......@@ -270,7 +273,6 @@
(msg "suck ent")
(define (suck-entity-from-server db table unique-id)
;; ask for the current version
(http-request
......@@ -301,18 +303,8 @@
(update-widget 'text-view (get-id "sync-dirty") 'text (build-dirty db))
(request-files ktvlist))))))
;; repeatedly read version and request updates
(define (suck-new db table)
(msg "suck-new")
(debug! "Requesting new entities")
(list
(http-request
"new-entities-req"
(string-append url "fn=entity-versions&table=" table)
(lambda (data)
(msg "entity-versions:" data)
(let ((r (foldl
(define (build-entity-requests db table version-data)
(foldl
(lambda (i r)
(let* ((unique-id (car i))
(version (cadr i))
......@@ -331,23 +323,35 @@
(cons (suck-entity-from-server db table unique-id) r)
r)))
'()
data)))
version-data))
;; repeatedly read version and request updates
(define (suck-new db table)
(msg "suck-new")
(debug! "Requesting new entities")
(list
(http-request
"new-entities-req"
(string-append url "fn=entity-versions&table=" table)
(lambda (data)
(msg "entity-versions:" data)
(let ((new-entity-requests (build-entity-requests db table data)))
(cond
((null? r)
((null? new-entities)
(debug! "No new data to download")
(set-current! 'download 1)
(append
(if (eqv? (get-current 'upload 0) 1)
(list (play-sound "ping")) '())
(list
(toast "No new data to download")) r))
(toast "No new data to download"))))
(else
(debug! (string-append
"Requesting "
(number->string (length r)) " entities"))
(number->string (length new-entities)) " entities"))
(cons
(play-sound "active")
r))))))))
new-entities))))))))
(msg "build-dirty defined...")
......@@ -392,8 +396,6 @@
))))))
(define i18n-lang 0)
(define i18n-text
......@@ -702,14 +704,12 @@
;; pull db data into list of button widgets
(define (update-list-widget db table entity-type edit-activity parent)
(msg "ulw")
(let ((search-results
(if parent
(db-filter-only db table entity-type
(list (list "parent" "varchar" "=" parent))
(list (list "name" "varchar")))
(db-all db table entity-type))))
(msg "ulw search results " search-results)
(update-widget
'linear-layout
(get-id (string-append entity-type "-list"))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment