Improvements to interceptors
This commit is contained in:
parent
63b9ad6753
commit
0f6744ad30
15 changed files with 203 additions and 347 deletions
|
@ -1,30 +1,32 @@
|
|||
(use-modules
|
||||
(ice-9 filesystem)
|
||||
(srfi srfi-2)
|
||||
(srfi srfi-71)
|
||||
(logging logger)
|
||||
(ordo connection)
|
||||
(ordo interceptor)
|
||||
(ordo interceptor tmp-dir)
|
||||
(ordo interceptor install-file)
|
||||
(ordo interceptor create-tmp-dir)
|
||||
(ordo interceptor stat-file)
|
||||
(ordo interceptor user-info)
|
||||
(ordo interceptor debug)
|
||||
(ordo action filesystem)
|
||||
(ordo logger))
|
||||
|
||||
(define chain
|
||||
(list (connection-interceptor (local-connection))
|
||||
(tmp-dir-interceptor #:tmp-dir)
|
||||
(interceptor
|
||||
"install hello"
|
||||
#:enter (lambda (ctx)
|
||||
(fs:install-file (context-connection ctx)
|
||||
(file-name-join* (var-ref ctx #:tmp-dir) "hello.txt")
|
||||
#:content "Hello, world!\n"))
|
||||
#:register #:hello)
|
||||
(interceptor
|
||||
"stat hello"
|
||||
#:enter (lambda (ctx)
|
||||
(fs:stat (context-connection ctx) (var-ref ctx #:hello)))
|
||||
#:register #:hello-stat)
|
||||
(debug-vars-interceptor #:hello #:hello-stat)
|
||||
(debug-vars-interceptor)))
|
||||
(create-tmp-dir #:register 'tmp-dir)
|
||||
(user-info)
|
||||
(debug-vars 'user-info)
|
||||
(install-file
|
||||
"install-hello"
|
||||
#:path (let-vars (tmp-dir) (file-name-join* tmp-dir "hello.txt"))
|
||||
#:content "Hello, world!\n"
|
||||
#:register 'hello)
|
||||
(stat-file
|
||||
"stat-hello"
|
||||
#:path (let-vars (hello) hello)
|
||||
#:register 'hello-stat)
|
||||
(debug-vars 'hello 'hello-stat)))
|
||||
|
||||
(setup-logging #:level 'INFO)
|
||||
(execute (init-context) chain)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue