···7- added `Skyfall::Jetstream::CommitMessage#operation` (aliased as `op`) which returns the (always single) operation in the `operations` array
8- added `#kind` as alias for `#type` in both `Message` classes
9- added a base class for error types, `Skyfall::Error`
10-- added `#blocks` to `SyncMessage`
01112Deprecated & removed APIs:
13···15- removed deprecated `CommitMessage#prev`
16- deprecated `#path` in both `Operation` classes
1700000018Access level changes:
1920- restricted `Stream#start_heartbeat_timer` & `Stream#stop_heartbeat_timer` methods access to private
···23- restricted `#inspectable_variables` methods access to either private or protected
24- relaxed `Stream#build_websocket_url` & `Stream#build_websocket_client` methods access from private to protected
25- fixed private class method `Skyfall::Firehose::Message.decode_cbor_objects` which wasn't actually private
26-27-Optimizations:
28-29-- much faster `Skyfall::Firehose::Message#time` parsing on Ruby 3.2+
30-- lazy decoding of sections in `CarArchive` – saves quite a lot of work if sections are only accessed through `Operation#raw_record`
31-- added `frozen_string_literal: true` in all files to reduce garbage collection
3233Additional validations and other changes:
34
···7- added `Skyfall::Jetstream::CommitMessage#operation` (aliased as `op`) which returns the (always single) operation in the `operations` array
8- added `#kind` as alias for `#type` in both `Message` classes
9- added a base class for error types, `Skyfall::Error`
10+- added `#blocks` to `Skyfall::Firehose::SyncMessage`
11+- added `#rev`, `#since` and `#prev_data` to `Skyfall::Firehose::CommitMessage`
1213Deprecated & removed APIs:
14···16- removed deprecated `CommitMessage#prev`
17- deprecated `#path` in both `Operation` classes
1819+Optimizations:
20+21+- much faster `Skyfall::Firehose::Message#time` parsing on Ruby 3.2+
22+- lazy decoding of sections in `CarArchive` – saves quite a lot of work if sections are only accessed through `Operation#raw_record`
23+- added `frozen_string_literal: true` in all files to reduce garbage collection
24+25Access level changes:
2627- restricted `Stream#start_heartbeat_timer` & `Stream#stop_heartbeat_timer` methods access to private
···30- restricted `#inspectable_variables` methods access to either private or protected
31- relaxed `Stream#build_websocket_url` & `Stream#build_websocket_client` methods access from private to protected
32- fixed private class method `Skyfall::Firehose::Message.decode_cbor_objects` which wasn't actually private
0000003334Additional validations and other changes:
35
+16-1
lib/skyfall/firehose/commit_message.rb
···26 #
27 def initialize(type_object, data_object)
28 super
29- check_if_not_nil 'seq', 'repo', 'commit', 'blocks', 'ops', 'time'
00000000000000030 end
3132 # @return [CID] CID (Content Identifier) of the commit
···26 #
27 def initialize(type_object, data_object)
28 super
29+ check_if_not_nil 'seq', 'repo', 'commit', 'blocks', 'ops', 'time', 'rev'
30+ end
31+32+ # @return [String] current revision of the repo
33+ def rev
34+ @data_object['rev']
35+ end
36+37+ # @return [String, nil] revision of the previous commit in the repo
38+ def since
39+ @data_object['since']
40+ end
41+42+ # @return [CID, nil] CID (Content Identifier) of data of the previous commit in the repo
43+ def prev_data
44+ @prev_data ||= CID.from_cbor_tag(@data_object['prevData'])
45 end
4647 # @return [CID] CID (Content Identifier) of the commit
+3-2
lib/skyfall/firehose/message.rb
···156 private
157158 # Note: this method is written this way as an optimization
159- def check_if_not_nil(a, b = nil, c = nil, d = nil, e = nil, f = nil)
160 ok = @data_object.has_key?(a)
161 ok &&= @data_object.has_key?(b) if b
162 ok &&= @data_object.has_key?(c) if c
163 ok &&= @data_object.has_key?(d) if d
164 ok &&= @data_object.has_key?(e) if e
165 ok &&= @data_object.has_key?(f) if f
0166167 if !ok
168- expected_fields = [a, b, c, d, e, f].compact
169 missing_fields = expected_fields.select { |x| @data_object[x].nil? }
170 raise DecodeError.new("Missing event details (#{missing_fields.map(&:to_s).join(', ')})")
171 end
···156 private
157158 # Note: this method is written this way as an optimization
159+ def check_if_not_nil(a, b = nil, c = nil, d = nil, e = nil, f = nil, g = nil)
160 ok = @data_object.has_key?(a)
161 ok &&= @data_object.has_key?(b) if b
162 ok &&= @data_object.has_key?(c) if c
163 ok &&= @data_object.has_key?(d) if d
164 ok &&= @data_object.has_key?(e) if e
165 ok &&= @data_object.has_key?(f) if f
166+ ok &&= @data_object.has_key?(g) if g
167168 if !ok
169+ expected_fields = [a, b, c, d, e, f, g].compact
170 missing_fields = expected_fields.select { |x| @data_object[x].nil? }
171 raise DecodeError.new("Missing event details (#{missing_fields.map(&:to_s).join(', ')})")
172 end