Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
citizen-science
symbai
Commits
5d06f28b
Commit
5d06f28b
authored
May 15, 2014
by
Dave Griffiths
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync dirtify fixes
parent
8dd940f8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
10 deletions
+21
-10
android/assets/dbsync.scm
android/assets/dbsync.scm
+4
-3
eavdb/entity-sync.ss
eavdb/entity-sync.ss
+2
-3
eavdb/entity-update.ss
eavdb/entity-update.ss
+12
-0
eavdb/entity-values.ss
eavdb/entity-values.ss
+3
-4
No files found.
android/assets/dbsync.scm
View file @
5d06f28b
...
...
@@ -243,8 +243,9 @@
(
define
(
start-sync-files
)
(
http-request
(
string-append
"file-list"
)
(
string-append
"http://192.168.2.1:8889/"
)
(
string-append
url
"fn=file-list"
)
(
lambda
(
file-list
)
(
sync-files
file-list
))))
;; spit all dirty entities to server
(
define
(
spit
db
table
entities
)
...
...
@@ -361,7 +362,7 @@
(
when
((
not
(
find
id
server-ids
)))
(
msg
"can't find "
id
" in server data, marking dirty"
)
;; mark those not present as dirty for next spit cycle
(
update-entity-dirty
db
table
id
)))
(
update-entity-dirt
if
y
db
table
id
)))
ids
)))
;; repeatedly read version and request updates
...
...
eavdb/entity-sync.ss
View file @
5d06f28b
...
...
@@ -47,12 +47,11 @@
(
clean-entity-values
db
table
(
entity-id-from-unique
db
table
unique-id
))
)
;; for when remote entities don't exist for whatever reason
(
define
(
update-entity-dirty
db
table
unique-id
)
(
define
(
update-entity-dirt
if
y
db
table
unique-id
)
(
db-exec
db
(
string-append
"update "
table
"_entity set dirty=? where unique_id = ?"
)
1
unique-id
)
;; simpler path than cleaning - should use the same as this???
(
dirty-all-values
db
table
(
entity-id-from-unique
db
table
unique-id
)))
(
dirtify-entity-values
db
table
(
entity-id-from-unique
db
table
unique-id
))
)
(
define
(
have-dirty?
db
table
)
(
not
(
zero?
...
...
eavdb/entity-update.ss
View file @
5d06f28b
...
...
@@ -64,6 +64,18 @@
(
clean-value
db
table
entity-id
(
list
(
ktv-key
kt
)
(
ktv-type
kt
))))
(
get-attribute-ids/types
db
table
entity-type
))))))
(
define
(
dirtify-entity-values
db
table
entity-id
)
;;(msg "clean-entity-values")
(
let*
((
entity-type
(
get-entity-type
db
table
entity-id
)))
(
cond
((
null?
entity-type
)
(
msg
"dirtify-entity-values: entity"
entity-id
"not found!"
)
'
())
(
else
(
for-each
(
lambda
(
kt
)
(
dirtify-value
db
table
entity-id
(
list
(
ktv-key
kt
)
(
ktv-type
kt
))))
(
get-attribute-ids/types
db
table
entity-type
))))))
;; update an entity, via a (possibly partial) list of key/value pairs
;; if dirty is not true, this is coming from a sync
(
define
(
update-entity-values
db
table
entity-id
ktvlist
dirty
)
...
...
eavdb/entity-values.ss
View file @
5d06f28b
...
...
@@ -122,8 +122,7 @@
" set dirty=0 where entity_id = ? and attribute_id = ?"
)
entity-id
(
ktv-key
kt
)))
;; simpler path than cleaning - should use the same as this???
(
define
(
dirty-all-values
db
table
entity-id
)
(
define
(
dirtify-value
db
table
entity-id
kt
)
(
db-exec
db
(
string-append
"update "
table
"_value_"
(
ktv-type
kt
)
" set dirty=1 where entity_id = ?"
)
entity-id
))
" set dirty=1
where entity_id =
? and attribute_id =
?"
)
entity-id
(
ktv-key
kt
)
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment