Skip to content

Commit

Permalink
Note outdated differences between awyeah-api and aws-api
Browse files Browse the repository at this point in the history
  • Loading branch information
grzm committed Dec 2, 2023
1 parent 300f091 commit d98a9f6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 37 deletions.
12 changes: 1 addition & 11 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

Cognitect's [aws-api][] and [babashka][]. Aw yeah.

**Alpha** Only gently tested.

awyeah-api is _another_ Clojure library which provides programmatic
access to AWS services from your Clojure **or babashka** program. Its
_raison d'être_ is to be a drop-in replacement for Cognitect's
Expand All @@ -26,7 +24,7 @@ Cognitect-distributed library.

## Requirements

Requires babashka 0.7.0 or later (clojure.spec.alpha support).
Requires babashka v1.0.170 or later (vjava.util.concurrent.ThreadFactory support).

## deps
``` clojure
Expand Down Expand Up @@ -80,14 +78,6 @@ Include [`org.babashka/spec.alpha`](https://github.com/babashka/spec.alpha)

## Differences from aws-api

The awyeah-api client does not auto-refresh AWS credentials. The
aws-api behavior relies on features that aren't present in babashka,
and I haven't figured out an alternative implementation of the
behavior. My use case is short-lived scripts, where JVM start-up time
can dwarf script execution time: credentials don't have much time to
get stale. If I had longer-lived processes, start-up time wouldn't be
an issue and I'd just use the Clojure.

The [com.cognitect/http-client][] used by aws-api automatically
uncompresses S3 objects if they have the appropriate content-type
metadata in S3. I've chosen _not_ to replicate this behavior with the
Expand Down
41 changes: 15 additions & 26 deletions docs/porting-decisions.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -18,43 +18,32 @@ Client][jetty-http-client].

### Missing classes

The following classes used in aws-api are not included in
babashka.

* `java.lang.Runnable`
* `java.lang.ThreadLocal`
* `java.util.concurrent.ThreadFactory`
* `java.util.concurrent.ScheduledFuture`
* `java.util.concurrent.ScheduledExecutorService`

These classes are referenced in two namespaces: `cognitect.aws.util`
and `cognitect.aws.credentials`. `ThreadLocal` is used in
`cognitect.aws.util` to make [`java.text.SimpleDateFormat`
thread-safe][simple-date-format-bug]. As I'm not concerned with
supporting pre-Java 8 versions, I've decided to use the thread-safe
`java.time.format.DateTimeFormatter` rather than drop thread-safety
workarounds for `SimpleDateFormat` or implement them in some other
way.
The `java.lang.ThreadLocal` class, used in aws-api, is not included in
babashka. `ThreadLocal` is used in `cognitect.aws.util` to make
[`java.text.SimpleDateFormat` thread-safe][simple-date-format-bug]. As
I'm not concerned with supporting pre-Java 8 versions, I've decided to
use the thread-safe `java.time.format.DateTimeFormatter` rather than
drop thread-safety workarounds for `SimpleDateFormat` or implement
them in some other way.

[simple-date-format-bug]: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4228335

The `cognitect.aws.util` namespace is used throughout the aws-api
library, either directly or transitively.

The balance of the unincluded classes are used in
`cognitect.aws.credentials` to provide auto-refreshing of AWS
credentials. As babashka is commonly used for short-lived scripts as
opposed to long-running server applications, rather than provide an
alternate implementation for credential refresh, I've chosen to omit
this functionality. If credential auto-refresh is something I find
_is_ useful in a babashka context some time in the future, a solution
can be explored at that time.

There are a few other compatiblity issues, such as the use of
`java.lang.ClassLoader::getResources` in
`cognitect.aws.http/configured-client`, and replacing `^int x` hinting
with explicit `(int x)` casts.

#### Babashka, forward always

At the time of the initial release of awyeah-api, babashka did not
include classes required to implement the auto-refresh credentials
functionality. Michiel is always improving babashka, and has since
included these classes so I've been able to implement credentials
auto-refresh as of v0.8.82/5ecad02.

### http-client

The aws-api library defines a protocol
Expand Down

0 comments on commit d98a9f6

Please sign in to comment.