skyfall 0.6.1 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +58 -10
- data/README.md +40 -34
- data/lib/skyfall/collection.rb +20 -0
- data/lib/skyfall/errors.rb +50 -5
- data/lib/skyfall/events.rb +19 -0
- data/lib/skyfall/firehose/account_message.rb +32 -4
- data/lib/skyfall/firehose/commit_message.rb +49 -8
- data/lib/skyfall/firehose/identity_message.rb +30 -2
- data/lib/skyfall/firehose/info_message.rb +35 -1
- data/lib/skyfall/firehose/labels_message.rb +28 -10
- data/lib/skyfall/firehose/message.rb +136 -27
- data/lib/skyfall/firehose/operation.rb +59 -6
- data/lib/skyfall/firehose/sync_message.rb +31 -0
- data/lib/skyfall/firehose/unknown_message.rb +8 -0
- data/lib/skyfall/firehose.rb +103 -5
- data/lib/skyfall/jetstream/account_message.rb +21 -1
- data/lib/skyfall/jetstream/commit_message.rb +35 -2
- data/lib/skyfall/jetstream/identity_message.rb +22 -1
- data/lib/skyfall/jetstream/message.rb +94 -7
- data/lib/skyfall/jetstream/operation.rb +58 -5
- data/lib/skyfall/jetstream/unknown_message.rb +8 -0
- data/lib/skyfall/jetstream.rb +94 -7
- data/lib/skyfall/label.rb +35 -1
- data/lib/skyfall/stream.rb +264 -47
- data/lib/skyfall/version.rb +1 -1
- metadata +21 -64
- data/lib/skyfall/car_archive.rb +0 -122
- data/lib/skyfall/cid.rb +0 -43
- data/lib/skyfall/extensions.rb +0 -32
- data/lib/skyfall/firehose/handle_message.rb +0 -14
- data/lib/skyfall/firehose/tombstone_message.rb +0 -11
data/lib/skyfall/cid.rb
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
require_relative 'errors'
|
|
2
|
-
|
|
3
|
-
require 'base32'
|
|
4
|
-
|
|
5
|
-
# CIDs in DAG-CBOR: https://ipld.io/specs/codecs/dag-cbor/spec/
|
|
6
|
-
# CIDs in JSON: https://ipld.io/specs/codecs/dag-json/spec/
|
|
7
|
-
# multibase: https://github.com/multiformats/multibase
|
|
8
|
-
|
|
9
|
-
module Skyfall
|
|
10
|
-
class CID
|
|
11
|
-
attr_reader :data
|
|
12
|
-
|
|
13
|
-
def self.from_cbor_tag(tag)
|
|
14
|
-
data = tag.value
|
|
15
|
-
raise DecodeError.new("Unexpected first byte of CID: #{data[0]}") unless data[0] == "\x00"
|
|
16
|
-
CID.new(data[1..-1])
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def self.from_json(string)
|
|
20
|
-
raise DecodeError.new("Unexpected CID length") unless string.length == 59
|
|
21
|
-
raise DecodeError.new("Unexpected CID prefix") unless string[0] == 'b'
|
|
22
|
-
|
|
23
|
-
data = Base32.decode(string[1..-1].upcase)
|
|
24
|
-
CID.new(data)
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def initialize(data)
|
|
28
|
-
@data = data
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def to_s
|
|
32
|
-
'b' + Base32.encode(@data).downcase.gsub(/=+$/, '')
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def inspect
|
|
36
|
-
"CID(\"#{to_s}\")"
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def ==(other)
|
|
40
|
-
other.is_a?(CID) && @data == other.data
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
data/lib/skyfall/extensions.rb
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
require 'cbor'
|
|
2
|
-
require 'stringio'
|
|
3
|
-
|
|
4
|
-
module Skyfall
|
|
5
|
-
module Extensions
|
|
6
|
-
|
|
7
|
-
refine StringIO do
|
|
8
|
-
# https://en.wikipedia.org/wiki/LEB128
|
|
9
|
-
def read_varint
|
|
10
|
-
shift = 1
|
|
11
|
-
value = 0
|
|
12
|
-
|
|
13
|
-
loop do
|
|
14
|
-
byte = self.readbyte
|
|
15
|
-
value += byte % 128 * shift
|
|
16
|
-
break if byte < 128
|
|
17
|
-
shift *= 128
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
value
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
refine CBOR.singleton_class do
|
|
25
|
-
def decode_sequence(data)
|
|
26
|
-
unpacker = CBOR::Unpacker.new(StringIO.new(data))
|
|
27
|
-
unpacker.each.to_a
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
end
|
|
32
|
-
end
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
require_relative '../firehose'
|
|
2
|
-
|
|
3
|
-
module Skyfall
|
|
4
|
-
|
|
5
|
-
#
|
|
6
|
-
# Note: this event type is deprecated and will stop being emitted at some point.
|
|
7
|
-
# You should instead listen for 'identity' events (Skyfall::Firehose::IdentityMessage).
|
|
8
|
-
#
|
|
9
|
-
class Firehose::HandleMessage < Firehose::Message
|
|
10
|
-
def handle
|
|
11
|
-
@data_object['handle']
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
require_relative '../firehose'
|
|
2
|
-
|
|
3
|
-
module Skyfall
|
|
4
|
-
|
|
5
|
-
#
|
|
6
|
-
# Note: this event type is deprecated and will stop being emitted at some point.
|
|
7
|
-
# You should instead listen for 'account' events (Skyfall::Firehose::AccountMessage).
|
|
8
|
-
#
|
|
9
|
-
class Firehose::TombstoneMessage < Firehose::Message
|
|
10
|
-
end
|
|
11
|
-
end
|