@@ 485,7 485,7 @@ define-handler 'PUT "/trust/" : put-trus
define changed-trustees
map second trust-per-id
define ownids : get-ownids-with-wotcache
- fold : lambda (trustee value wotstate) : add-trust-edge wotstate someid trustee value
+ fold : lambda (trustee value wotstate) : add-trust-edge! wotstate someid trustee value
. wotstate
. changed-trustees
map string->number : map first trust-per-id
@@ 544,7 544,7 @@ define-handler 'POST "/addtrust/" : post
define ownids : get-ownids-with-wotcache
fold
lambda : trustee increment wotstate
- add-trust-edge wotstate someid trustee
+ add-trust-edge! wotstate someid trustee
addtrust increment : get-trust-edge wotstate someid trustee
. wotstate
. changed-trustees
@@ 778,7 778,7 @@ define-handler 'PUT "/subscription-updat
;; Ensure that there is at least one trust relationship to the
;; other ID, so it is in the WoT.
unless : and otherkey : get-score wotstate ownkey otherkey
- add-trust-edge wotstate ownid otherid 0
+ add-trust-edge! wotstate ownid otherid 0
let : : body-string : bytevector->string body "UTF-8"
define body-decoded : uri-decode body-string
define metadata
@@ 173,7 173,7 @@ define-handler 'PUT "/trust/" : put-trus
define ownkey : string-drop path : string-length "/trust/"
define empty-line : read-line port
define trust-per-id : read-csv port
- fold : lambda (trustee value wotstate) : add-trust-edge wotstate ownkey trustee value
+ fold : lambda (trustee value wotstate) : add-trust-edge! wotstate ownkey trustee value
. wotstate
map second trust-per-id
map string->number : map first trust-per-id
@@ 27,7 27,7 @@
define-module : wispwot wispwot
- . #:export : wispwot-read-trustfile wispwot-get-score read-known-identities make-wotstate wotstate-known-ids wotstate-trustlists trustlists-empty wotstate-ranks wotstate-scores read-all-trust calculate-ranks calculate-scores import-trust-csv get-trust-edge add-trust-edge ids-max ids->list id->key key->index index->identity write-store update-ranks-and-scores-from-trust-edge! update-ranks-and-scores-from-trust-identity-edges! ranks->list list->ranks ranks-ref set-wotstate-known-ids! set-wotstate-trustlists! make-id-to-index-map
+ . #:export : wispwot-read-trustfile wispwot-get-score read-known-identities make-wotstate wotstate-known-ids wotstate-trustlists trustlists-empty wotstate-ranks wotstate-scores read-all-trust calculate-ranks calculate-scores import-trust-csv get-trust-edge add-trust-edge! ids-max ids->list id->key key->index index->identity write-store update-ranks-and-scores-from-trust-edge! update-ranks-and-scores-from-trust-identity-edges! ranks->list list->ranks ranks-ref set-wotstate-known-ids! set-wotstate-trustlists! make-id-to-index-map
import : wispwot doctests
srfi srfi-1 ; lists
@@ 277,7 277,7 @@ define* : load-testing-wotstate #:option
define : make-testing-wotstate
define wotstate
- fold : λ (id1 id2 trust wotstate) : add-trust-edge wotstate id1 id2 trust
+ fold : λ (id1 id2 trust wotstate) : add-trust-edge! wotstate id1 id2 trust
make-empty-wotstate
' "ZERO" "ONE" "ZERO" "TWO" "BAD" "BAD" "SOMEID"
' "ONE" "TWO" "BAD" "BAD" "TWO" "OUT" "OTHERID"
@@ 324,7 324,7 @@ define : update-ranks-from-trustee! wots
delete-duplicates
sort
update-ranks-from-trustee!
- add-trust-edge wotstate
+ add-trust-edge! wotstate
vector-ref (wotstate-known-ids wotstate) 1
vector-ref (wotstate-known-ids wotstate) 2
. -10
@@ 335,7 335,7 @@ define : update-ranks-from-trustee! wots
delete-duplicates
sort
update-ranks-from-trustee!
- add-trust-edge wotstate
+ add-trust-edge! wotstate
vector-ref (wotstate-known-ids wotstate) 0
vector-ref (wotstate-known-ids wotstate) 1
. -10
@@ 350,7 350,7 @@ define : update-ranks-from-trustee! wots
delete-duplicates
sort
update-ranks-from-trustee!
- add-trust-edge wotstate
+ add-trust-edge! wotstate
vector-ref (wotstate-known-ids wotstate) 0
vector-ref (wotstate-known-ids wotstate) 2
. 30
@@ 359,7 359,7 @@ define : update-ranks-from-trustee! wots
test-equal : ` (4 4 ,ranks--inf) ;; cut the only trust path to 4
let : : wotstate : make-testing-wotstate
update-ranks-from-trustee!
- add-trust-edge wotstate
+ add-trust-edge! wotstate
vector-ref (wotstate-known-ids wotstate) 3
vector-ref (wotstate-known-ids wotstate) 4
. -10
@@ 367,7 367,7 @@ define : update-ranks-from-trustee! wots
test-equal : ` (7 ,ranks--inf 1) ;; cut the only trust path to 4
let : : wotstate : make-testing-wotstate
update-ranks-from-trustee!
- add-trust-edge wotstate
+ add-trust-edge! wotstate
vector-ref (wotstate-known-ids wotstate) 0
. "ABRAXAS"
. 10
@@ 375,7 375,7 @@ define : update-ranks-from-trustee! wots
test-equal : list ;; no trust from ownid => no change
let : : wotstate : make-testing-wotstate
update-ranks-from-trustee!
- add-trust-edge wotstate
+ add-trust-edge! wotstate
. "UNKNOWN"
. "UNSEEN"
. 100
@@ 642,7 642,7 @@ define : update-scores-from-changed-rank
test-equal : ' (1 2 4 0) (2 3 -2 -5) (3 4 6 0)
let : : wotstate : load-testing-wotstate
update-scores-from-changed-ranks!
- add-trust-edge wotstate
+ add-trust-edge! wotstate
vector-ref (wotstate-known-ids wotstate) 0
vector-ref (wotstate-known-ids wotstate) 1
. -10
@@ 650,7 650,7 @@ define : update-scores-from-changed-rank
test-equal : ' (2 3 -2 -5) (3 4 6 0)
let : : wotstate : load-testing-wotstate
update-scores-from-changed-ranks!
- add-trust-edge wotstate
+ add-trust-edge! wotstate
vector-ref (wotstate-known-ids wotstate) 1
vector-ref (wotstate-known-ids wotstate) 2
. -30
@@ 891,7 891,7 @@ define : get-trust-edge wotstate truster
trusts-ref (cdr truster-trustvalues) trustee-index
-define : add-trust-edge wotstate truster-id trustee-id value
+define : add-trust-edge! wotstate truster-id trustee-id value
. "Add a trust-edge using identities (not indizes).
returns the changed wotstate."
@@ 900,20 900,20 @@ define : add-trust-edge wotstate truster
test-equal #("ZERO" "ONE" "TWO" "BAD" "OUT" "SOMEID" "OTHERID" "ONEMOREID" "ONEOTHERID" "BADID" "long\\nlong\\nlinebreaks" "ANTANS")
wotstate-known-ids
let : : wotstate : make-wotstate (read-known-identities identities-default-file) #f #f #f
- add-trust-edge wotstate "ONE" "ANTANS" 100
+ add-trust-edge! wotstate "ONE" "ANTANS" 100
test-equal : cons #u16(11) #s8(100)
vector-ref
wotstate-trustlists
let : : wotstate : make-wotstate (read-known-identities identities-default-file) #f #f #f
- add-trust-edge wotstate "ONE" "ANTANS" 100
+ add-trust-edge! wotstate "ONE" "ANTANS" 100
. 1
test-equal : cons #u16(2 11) #s8(5 100)
vector-ref
wotstate-trustlists
let*
: wotstate : make-wotstate (read-known-identities identities-default-file) #f #f #f
- wotstate2 : add-trust-edge wotstate "ONE" "ANTANS" 100
- add-trust-edge wotstate2 "ONE" "TWO" 5
+ wotstate2 : add-trust-edge! wotstate "ONE" "ANTANS" 100
+ add-trust-edge! wotstate2 "ONE" "TWO" 5
. 1
;; adding the same edge again but with different value updates the value
test-equal : cons #u16(11) #s8(50)
@@ 921,16 921,16 @@ define : add-trust-edge wotstate truster
wotstate-trustlists
let*
: wotstate : make-wotstate (read-known-identities identities-default-file) #f #f #f
- wotstate2 : add-trust-edge wotstate "ONE" "ANTANS" 100
- add-trust-edge wotstate2 "ONE" "ANTANS" 50
+ wotstate2 : add-trust-edge! wotstate "ONE" "ANTANS" 100
+ add-trust-edge! wotstate2 "ONE" "ANTANS" 50
. 1
test-equal : cons #u16(11) #s8(10)
vector-ref
wotstate-trustlists
let*
: wotstate : make-wotstate (read-known-identities identities-default-file) #f #f #f
- wotstate2 : add-trust-edge wotstate "ZERO" "TWO" 100
- add-trust-edge wotstate2 "TWO" "ANTANS" 10
+ wotstate2 : add-trust-edge! wotstate "ZERO" "TWO" 100
+ add-trust-edge! wotstate2 "TWO" "ANTANS" 10
. 2
define id-to-index-map : make-id-to-index-map wotstate
;; add known-identity entries for not yet known IDs
@@ 976,7 976,7 @@ define : update-ranks-and-scores-from-tr
##
tests
test-equal : ' (1 11 #f 40)
- let : : wotstate : add-trust-edge (load-testing-wotstate) "ONE" "ANTANS" 100
+ let : : wotstate : add-trust-edge! (load-testing-wotstate) "ONE" "ANTANS" 100
update-ranks-and-scores-from-trust-identity-edges! wotstate "ZERO" '(("ONE" . "ANTANS"))
define id-to-index-map : make-id-to-index-map wotstate
;; add known-identity entries for not yet known IDs
@@ 996,7 996,7 @@ define* : update-ranks-and-scores-from-t
##
tests
test-equal : ' (1 11 #f 40)
- let : : wotstate : add-trust-edge (load-testing-wotstate) "ONE" "ANTANS" 100
+ let : : wotstate : add-trust-edge! (load-testing-wotstate) "ONE" "ANTANS" 100
update-ranks-and-scores-from-trust-edge! wotstate 0 1 11
if {truster-index = trustee-index}
. '() ;; self-trust change cannot cause changes