aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex/repository.lux
diff options
context:
space:
mode:
authorEduardo Julian2020-12-25 09:22:38 -0400
committerEduardo Julian2020-12-25 09:22:38 -0400
commit4ca397765805eda5ddee393901ed3a02001a960a (patch)
tree2ab184a1a4e244f3a69e86c8a7bb3ad49c22b4a3 /stdlib/source/program/aedifex/repository.lux
parentd29e091e98dabb8dfcf816899ada480ecbf7e357 (diff)
Replaced kebab-case with snake_case for naming convention.
Diffstat (limited to 'stdlib/source/program/aedifex/repository.lux')
-rw-r--r--stdlib/source/program/aedifex/repository.lux34
1 files changed, 17 insertions, 17 deletions
diff --git a/stdlib/source/program/aedifex/repository.lux b/stdlib/source/program/aedifex/repository.lux
index 351d1c066..582144ad4 100644
--- a/stdlib/source/program/aedifex/repository.lux
+++ b/stdlib/source/program/aedifex/repository.lux
@@ -52,9 +52,9 @@
(signature: #export (Simulation s)
(: (-> URI s (Try [s Binary]))
- on-download)
+ on_download)
(: (-> URI Binary s (Try s))
- on-upload))
+ on_upload))
(def: #export (mock simulation init)
(All [s] (-> (Simulation s) s (Repository Promise)))
@@ -64,7 +64,7 @@
(stm.commit
(do {! stm.monad}
[|state| (stm.read state)]
- (case (\ simulation on-download uri |state|)
+ (case (\ simulation on_download uri |state|)
(#try.Success [|state| output])
(do !
[_ (stm.write |state| state)]
@@ -77,7 +77,7 @@
(stm.commit
(do {! stm.monad}
[|state| (stm.read state)]
- (case (\ simulation on-upload uri content |state|)
+ (case (\ simulation on_upload uri content |state|)
(#try.Success |state|)
(do !
[_ (stm.write |state| state)]
@@ -122,11 +122,11 @@
(new [java/io/InputStream])
(read [[byte] int int] #io #try int)])
-(exception: #export (no-credentials {address Address})
+(exception: #export (no_credentials {address Address})
(exception.report
["Address" (%.text address)]))
-(exception: #export (deployment-failure {code Int})
+(exception: #export (deployment_failure {code Int})
(exception.report
["Code" (%.int code)]))
@@ -134,10 +134,10 @@
(-> Artifact Extension URI)
(format (//artifact.uri artifact) extension))
-(def: buffer-size
+(def: buffer_size
(n.* 512 1,024))
-(def: user-agent
+(def: user_agent
(format "LuxAedifex/" (version.format language/lux.version)))
(structure: #export (remote identity address)
@@ -150,28 +150,28 @@
java/net/URL::openConnection)
#let [connection (:coerce java/net/HttpURLConnection connection)]
_ (java/net/HttpURLConnection::setRequestMethod "GET" connection)
- _ (java/net/URLConnection::setRequestProperty "User-Agent" ..user-agent connection)
+ _ (java/net/URLConnection::setRequestProperty "User-Agent" ..user_agent connection)
input (|> connection
java/net/URLConnection::getInputStream
(\ ! map (|>> java/io/BufferedInputStream::new)))
- #let [buffer (binary.create ..buffer-size)]]
+ #let [buffer (binary.create ..buffer_size)]]
(loop [output (\ binary.monoid identity)]
(do !
- [bytes-read (java/io/BufferedInputStream::read buffer +0 (.int ..buffer-size) input)]
- (case bytes-read
+ [bytes_read (java/io/BufferedInputStream::read buffer +0 (.int ..buffer_size) input)]
+ (case bytes_read
-1 (do !
[_ (java/lang/AutoCloseable::close input)]
(wrap output))
- _ (if (n.= ..buffer-size bytes-read)
+ _ (if (n.= ..buffer_size bytes_read)
(recur (\ binary.monoid compose output buffer))
(do !
- [chunk (\ io.monad wrap (binary.slice 0 (.nat bytes-read) buffer))]
+ [chunk (\ io.monad wrap (binary.slice 0 (.nat bytes_read) buffer))]
(recur (\ binary.monoid compose output chunk)))))))))
(def: (upload uri content)
(case identity
#.None
- (\ io.monad wrap (exception.throw ..no-credentials [address]))
+ (\ io.monad wrap (exception.throw ..no_credentials [address]))
(#.Some [user password])
(do (try.with io.monad)
@@ -181,7 +181,7 @@
#let [connection (:coerce java/net/HttpURLConnection connection)]
_ (java/net/HttpURLConnection::setRequestMethod "PUT" connection)
_ (java/net/URLConnection::setDoOutput true connection)
- _ (java/net/URLConnection::setRequestProperty "Authorization" (/identity.basic-auth user password) connection)
+ _ (java/net/URLConnection::setRequestProperty "Authorization" (/identity.basic_auth user password) connection)
stream (java/net/URLConnection::getOutputStream connection)
_ (java/io/OutputStream::write content stream)
_ (java/io/OutputStream::flush stream)
@@ -189,5 +189,5 @@
code (java/net/HttpURLConnection::getResponseCode connection)]
(case code
+201 (wrap [])
- _ (\ io.monad wrap (exception.throw ..deployment-failure [code]))))))
+ _ (\ io.monad wrap (exception.throw ..deployment_failure [code]))))))
)