Skip to content

Commit d8dd12d

Browse files
committed
[mod] Remove *write-legacy-pack-format?*
1 parent 63b2044 commit d8dd12d

File tree

2 files changed

+7
-53
lines changed

2 files changed

+7
-53
lines changed

src/taoensso/sente.cljc

Lines changed: 6 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -240,60 +240,18 @@
240240

241241
[clj ?cb-uuid]))
242242

243-
(def ^:dynamic *write-legacy-pack-format?*
244-
"Advanced option, most users can ignore this var. Only necessary
245-
for those that want to use Sente < v1.18 with a non-standard
246-
IPacker that deals with non-string payloads.
247-
248-
Details:
249-
Sente uses a private message format as an implementation detail
250-
for client<->server comms.
251-
252-
As part of [#398], this format is being updated to support
253-
non-string (e.g. binary) payloads.
254-
255-
Unfortunately updating the format is non-trivial because:
256-
1. Both the client & server need to support the same format.
257-
2. Clients are often served as cached cl/js.
258-
259-
To help ease migration, the new pack format is being rolled out
260-
in stages:
261-
262-
Sente <= v1.16: reads v1 format only
263-
writes v1 format only
264-
265-
Sente v1.17: reads v1 and v2 formats
266-
writes v1 and v2 formats (v1 default)
267-
268-
Sente v1.18: reads v1 and v2 formats
269-
writes v1 and v2 formats (v2 default) <- Currently here
270-
271-
Sente >= v1.19: reads v2 format only
272-
writes v2 format only
273-
274-
This var controls which format to use for writing.
275-
Override default with `alter-var-root` or `binding`."
276-
277-
false)
278-
279243
(defn- pack "[clj ?cb-uuid]->packed"
280244
([packer clj ] (pack packer clj nil))
281245
([packer clj ?cb-uuid]
282-
(let [?cb-uuid (if (= ?cb-uuid :ajax-cb) 0 ?cb-uuid)
283-
packed
284-
(interfaces/pack packer
285-
(if-some [cb-uuid ?cb-uuid]
286-
[clj cb-uuid]
287-
[clj ]))]
288-
289-
(if *write-legacy-pack-format?*
290-
(str "+" (have string? packed))
291-
(do packed)))))
246+
(let [?cb-uuid (if (= ?cb-uuid :ajax-cb) 0 ?cb-uuid)]
247+
(interfaces/pack packer
248+
(if-some [cb-uuid ?cb-uuid]
249+
[clj cb-uuid]
250+
[clj ])))))
292251

293252
(comment
294253
(unpack default-edn-packer
295-
(binding [*write-legacy-pack-format?* true]
296-
(pack default-edn-packer [:foo]))))
254+
(pack default-edn-packer [:foo])))
297255

298256
(deftype EdnPacker []
299257
interfaces/IPacker

src/taoensso/sente/interfaces.cljc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@
5454

5555
(defprotocol IPacker
5656
"Extension pt. for client<->server comms data un/packers:
57-
arbitrary Clojure data <-> serialized payloads.
58-
59-
NB if dealing with non-string payloads, see also
60-
`taoensso.sente/*write-legacy-pack-format?*`."
61-
57+
arbitrary Clojure data <-> serialized payloads."
6258
(pack [_ x])
6359
(unpack [_ x]))

0 commit comments

Comments
 (0)