|
23 | 23 | (defn deflate-encoder ^OutputStream [^OutputStream out] |
24 | 24 | (DeflaterOutputStream. out)) |
25 | 25 |
|
26 | | -(defn zstandard-encoder ^OutputStream [^OutputStream out] |
27 | | - (ZstdOutputStream. out)) |
| 26 | +(defn zstandard-encoder |
| 27 | + ([] (zstandard-encoder {})) |
| 28 | + ([{:keys [chain-log hash-log job-size level long min-match overlap-log |
| 29 | + search-log strategy target-length window-log workers]}] |
| 30 | + (fn [^OutputStream out] |
| 31 | + (-> (ZstdOutputStream. out) |
| 32 | + (cond-> level (.setLevel level)) |
| 33 | + (cond-> long (.setLong long)) |
| 34 | + (cond-> workers (.setWorkers workers)) |
| 35 | + (cond-> overlap-log (.setOverlapLog overlap-log)) |
| 36 | + (cond-> job-size (.setJobSize job-size)) |
| 37 | + (cond-> target-length (.setTargetLength target-length)) |
| 38 | + (cond-> min-match (.setMinMatch min-match)) |
| 39 | + (cond-> search-log (.setSearchLog search-log)) |
| 40 | + (cond-> chain-log (.setChainLog chain-log)) |
| 41 | + (cond-> hash-log (.setHashLog hash-log)) |
| 42 | + (cond-> window-log (.setWindowLog window-log)) |
| 43 | + (cond-> strategy (.setStrategy strategy)))))) |
28 | 44 |
|
29 | 45 | (def default-encoder-weights |
30 | 46 | {"zstd" 5 |
|
44 | 60 | "deflate" deflate-encoder |
45 | 61 | "gzip" gzip-encoder |
46 | 62 | "identity" identity |
47 | | - "zstd" zstandard-encoder}) |
| 63 | + "zstd" (zstandard-encoder)}) |
48 | 64 |
|
49 | 65 | (def default-status-codes #{200 404 403}) |
50 | 66 |
|
|
0 commit comments