···77- added `Skyfall::Jetstream::CommitMessage#operation` (aliased as `op`) which returns the (always single) operation in the `operations` array
88- added `#kind` as alias for `#type` in both `Message` classes
99- added a base class for error types, `Skyfall::Error`
1010-- added `#blocks` to `SyncMessage`
1010+- added `#blocks` to `Skyfall::Firehose::SyncMessage`
1111+- added `#rev`, `#since` and `#prev_data` to `Skyfall::Firehose::CommitMessage`
11121213Deprecated & removed APIs:
1314···1516- removed deprecated `CommitMessage#prev`
1617- deprecated `#path` in both `Operation` classes
17181919+Optimizations:
2020+2121+- much faster `Skyfall::Firehose::Message#time` parsing on Ruby 3.2+
2222+- lazy decoding of sections in `CarArchive` – saves quite a lot of work if sections are only accessed through `Operation#raw_record`
2323+- added `frozen_string_literal: true` in all files to reduce garbage collection
2424+1825Access level changes:
19262027- restricted `Stream#start_heartbeat_timer` & `Stream#stop_heartbeat_timer` methods access to private
···2330- restricted `#inspectable_variables` methods access to either private or protected
2431- relaxed `Stream#build_websocket_url` & `Stream#build_websocket_client` methods access from private to protected
2532- fixed private class method `Skyfall::Firehose::Message.decode_cbor_objects` which wasn't actually private
2626-2727-Optimizations:
2828-2929-- much faster `Skyfall::Firehose::Message#time` parsing on Ruby 3.2+
3030-- lazy decoding of sections in `CarArchive` – saves quite a lot of work if sections are only accessed through `Operation#raw_record`
3131-- added `frozen_string_literal: true` in all files to reduce garbage collection
32333334Additional validations and other changes:
3435
+16-1
lib/skyfall/firehose/commit_message.rb
···2626 #
2727 def initialize(type_object, data_object)
2828 super
2929- check_if_not_nil 'seq', 'repo', 'commit', 'blocks', 'ops', 'time'
2929+ check_if_not_nil 'seq', 'repo', 'commit', 'blocks', 'ops', 'time', 'rev'
3030+ end
3131+3232+ # @return [String] current revision of the repo
3333+ def rev
3434+ @data_object['rev']
3535+ end
3636+3737+ # @return [String, nil] revision of the previous commit in the repo
3838+ def since
3939+ @data_object['since']
4040+ end
4141+4242+ # @return [CID, nil] CID (Content Identifier) of data of the previous commit in the repo
4343+ def prev_data
4444+ @prev_data ||= CID.from_cbor_tag(@data_object['prevData'])
3045 end
31463247 # @return [CID] CID (Content Identifier) of the commit
+3-2
lib/skyfall/firehose/message.rb
···156156 private
157157158158 # Note: this method is written this way as an optimization
159159- def check_if_not_nil(a, b = nil, c = nil, d = nil, e = nil, f = nil)
159159+ def check_if_not_nil(a, b = nil, c = nil, d = nil, e = nil, f = nil, g = nil)
160160 ok = @data_object.has_key?(a)
161161 ok &&= @data_object.has_key?(b) if b
162162 ok &&= @data_object.has_key?(c) if c
163163 ok &&= @data_object.has_key?(d) if d
164164 ok &&= @data_object.has_key?(e) if e
165165 ok &&= @data_object.has_key?(f) if f
166166+ ok &&= @data_object.has_key?(g) if g
166167167168 if !ok
168168- expected_fields = [a, b, c, d, e, f].compact
169169+ expected_fields = [a, b, c, d, e, f, g].compact
169170 missing_fields = expected_fields.select { |x| @data_object[x].nil? }
170171 raise DecodeError.new("Missing event details (#{missing_fields.map(&:to_s).join(', ')})")
171172 end