tanker-core 2.6.1 → 2.6.2.alpha.6
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/lib/tanker/c_tanker/c_lib.rb +4 -9
- data/lib/tanker/core/stream.rb +23 -15
- data/lib/tanker/core/version.rb +1 -1
- data/vendor/{libctanker/linux64/tanker/lib → tanker/linux-x86_64}/libctanker.so +0 -0
- metadata +5 -6
- data/vendor/libctanker/mac64/tanker/lib/libctanker.dylib +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4030af33c99899c480fc62286362e26893bd25b4fa96f41050b40048c7acce81
|
4
|
+
data.tar.gz: d15b32bc587200da57320bbc455f70edc6b7982b3062c68b98dc0aedf5f310d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b387a24c5fe2fd478b49063eb96db6c8458aee6484604a3b50c928cee5d9ea05a70f7f57268da12eacd6dd01440490b9bc2eb3f06443462ce979c43cb8124769
|
7
|
+
data.tar.gz: 8c630b486af54f393a0a146a538a008fc38402a48dafc38795159499f5e413495abc38e0b1f37e428b9569ce77f8a7e27cbf0540130e8f641fb22c61406bdae7
|
@@ -1,15 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'ffi/platform'
|
4
|
+
|
3
5
|
module Tanker::CTanker
|
4
6
|
def self.get_path(name)
|
5
|
-
|
6
|
-
|
7
|
-
subdir = 'mac64'
|
8
|
-
else
|
9
|
-
ext = '.so'
|
10
|
-
subdir = 'linux64'
|
11
|
-
end
|
12
|
-
|
13
|
-
File.expand_path "../../../vendor/libctanker/#{subdir}/tanker/lib/lib#{name}#{ext}", __dir__
|
7
|
+
File.expand_path "../../../vendor/tanker/#{FFI::Platform::OS}-#{FFI::Platform::ARCH}/"\
|
8
|
+
"#{FFI::Platform::LIBPREFIX}#{name}.#{FFI::Platform::LIBSUFFIX}", __dir__
|
14
9
|
end
|
15
10
|
end
|
data/lib/tanker/core/stream.rb
CHANGED
@@ -3,6 +3,29 @@
|
|
3
3
|
require 'English'
|
4
4
|
require 'tanker/c_tanker'
|
5
5
|
|
6
|
+
# Because Ruby only has synchronous streams, we can't read them on Tanker's
|
7
|
+
# thread (in the read callback). To work around that, we start a new Thread for
|
8
|
+
# each read operation. This is not that bad because Ruby uses a thread pool
|
9
|
+
# behind the scenes and creating a Thread is usually just a work pushed on a
|
10
|
+
# queue.
|
11
|
+
#
|
12
|
+
# Also, there doesn't seem to easily create an IO object. The simplest way is to
|
13
|
+
# create a pipe. A pipe is a stream where you read everything you write into it.
|
14
|
+
# Tanker streams however are pull streams, so there must be something that pulls
|
15
|
+
# from the Tanker stream and pushes onto the IO stream. We start a long-running
|
16
|
+
# thread for that which just loops.
|
17
|
+
#
|
18
|
+
# Because so much is happening in parallel, synchronization is not trivial.
|
19
|
+
# There's one mutex per stream, and we lock that same mutex for every critical
|
20
|
+
# section. Here are some important constraints that must be held:
|
21
|
+
# - Do not copy data to the Tanker buffer if tanker_stream_close has been
|
22
|
+
# called
|
23
|
+
# - Do not call tanker_stream_read_operation_finish if tanker_stream_close has
|
24
|
+
# been called
|
25
|
+
# - On the output stream, do not call tanker_stream_read on a closed/closing
|
26
|
+
# stream. Though it is ok to close the stream after the call, but before the
|
27
|
+
# future is resolved.
|
28
|
+
|
6
29
|
module Tanker
|
7
30
|
class Core
|
8
31
|
def encrypt_stream(stream, encryption_options = nil)
|
@@ -95,21 +118,6 @@ module Tanker
|
|
95
118
|
end
|
96
119
|
end
|
97
120
|
|
98
|
-
# IMPORTANT: about synchronization
|
99
|
-
# Because of a design flaw in the Tanker C streaming API, it is difficult to
|
100
|
-
# handle cancelation. When canceling a read (closing the stream), Tanker
|
101
|
-
# doesn't forward the cancelation request to the input stream (there's no
|
102
|
-
# callback for that), which means that the callback maybe writing to a buffer
|
103
|
-
# that's being freed. We worked around that by adding a mutex and locking it
|
104
|
-
# in both the output stream and the input stream.
|
105
|
-
# Things to be careful about:
|
106
|
-
# - Do not copy data to the Tanker buffer if tanker_stream_close has been
|
107
|
-
# called
|
108
|
-
# - Do not call tanker_stream_read_operation_finish if tanker_stream_close has
|
109
|
-
# been called
|
110
|
-
# - On the output stream, do not call tanker_stream_read on a closed/closing
|
111
|
-
# stream. Though it is ok to close the stream after the call, but before the
|
112
|
-
# future is resolved.
|
113
121
|
class IoToTankerStreamWrapper
|
114
122
|
attr_reader :error
|
115
123
|
attr_reader :read_method
|
data/lib/tanker/core/version.rb
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tanker-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.2.alpha.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tanker team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -165,8 +165,7 @@ files:
|
|
165
165
|
- lib/tanker/encryption_options.rb
|
166
166
|
- lib/tanker/error.rb
|
167
167
|
- lib/tanker/sharing_options.rb
|
168
|
-
- vendor/
|
169
|
-
- vendor/libctanker/mac64/tanker/lib/libctanker.dylib
|
168
|
+
- vendor/tanker/linux-x86_64/libctanker.so
|
170
169
|
homepage: https://tanker.io
|
171
170
|
licenses:
|
172
171
|
- Apache-2.0
|
@@ -184,9 +183,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
184
183
|
version: 2.6.0
|
185
184
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
185
|
requirements:
|
187
|
-
- - "
|
186
|
+
- - ">"
|
188
187
|
- !ruby/object:Gem::Version
|
189
|
-
version:
|
188
|
+
version: 1.3.1
|
190
189
|
requirements: []
|
191
190
|
rubygems_version: 3.0.3
|
192
191
|
signing_key:
|
Binary file
|