lz4_flex 0.1.1-aarch64-linux-musl

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f737efd9d0b2b0445b04c2c179f1b90ee7c6b276ecba78056e3503497bf28f17
4
+ data.tar.gz: 6bf2895f50eec31841f33ab52d520a86b07b633054f094a2341ab529f64341c1
5
+ SHA512:
6
+ metadata.gz: 65e5c4e5ff17ba9ecd573d416912f5e5f91be1064c9098fb51f7ca4510744165c6870dbbac26c6c7fd9f231f25e83705e23b78554139efc48f6da446c7e1b08c
7
+ data.tar.gz: b9e920ffc5f826fa6e891b43fbea00c8fcf7901eab835e02517ba21b9a933940d82ea0af5e7d4784dc2eb09c6ec8db549328d7c4fb2d6ea9e2c194a00ab9bfcf
data/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Shopify
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,99 @@
1
+ # `lz4-flex-rb`
2
+
3
+ ## About this library
4
+
5
+ **Introduction:**
6
+ `lz4-flex-rb` is a modern LZ4 compression library for Ruby, leveraging the
7
+ power of the [`lz4_flex`](https://github.com/PSeitz/lz4_flex) Rust crate. This
8
+ library provides a pure Rust implementation of the LZ4 algorithm, ensuring high
9
+ performance and safety. One of the standout features of `lz4_flex-rb` is its
10
+ ability to conditionally unlock the Global VM Lock (GVL) for threaded web
11
+ servers, enhancing concurrency and performance in multi-threaded environments.
12
+
13
+ ## How to install this library
14
+
15
+ ### Requirements
16
+ - Ruby 3.0 or higher
17
+ - Rust (for building the native extension)
18
+
19
+ ### Setup
20
+ Add this line to your application's Gemfile:
21
+
22
+ ```ruby
23
+ gem 'lz4_flex'
24
+ ```
25
+
26
+ And then execute:
27
+
28
+ ```sh
29
+ bundle install
30
+ ```
31
+
32
+ ### Troubleshooting
33
+
34
+ If you encounter issues during installation, ensure that Rust is correctly installed and available in your PATH. You can install Rust from [rustup.rs](https://rustup.rs/).
35
+
36
+ ## How to use this library
37
+
38
+ There are two methods provided, `LZ4Flex.compress` and `Lz4Flex.decompress`.
39
+ Both of these methods utilize the lz4 block format, with a small header to
40
+ record the string's size and encoding.
41
+
42
+ ### Basic Usage
43
+
44
+ ```ruby
45
+ require 'lz4_flex'
46
+
47
+ # Compress data
48
+ compressed = LZ4Flex.compress("Hello, World!")
49
+
50
+ # Decompress data
51
+ decompressed = LZ4Flex.decompress(compressed)
52
+
53
+ puts decompressed # => "Hello, World!"
54
+ puts decompressed.encoding # => Encoding::UTF_8
55
+ ```
56
+
57
+ The header used in these methods will not be recognizable from other lz4 block
58
+ parsers. If you need that, it's best to use the Frame API (which is currently a
59
+ WIP).
60
+
61
+ ### Migrating from `lz4-ruby`
62
+
63
+ The [`lz4-ruby`](https://github.com/komiya-atsushi/lz4-ruby) gem uses a slighty
64
+ different header format, which keeps track of string size but not the string's
65
+ encoding.
66
+
67
+ To make it easy to migrate to `lz4_flex`, we provide a parser for the
68
+ `lz4-ruby` format:
69
+
70
+ ```ruby
71
+ # Say you have a string that was compressed with lz4-ruby...
72
+ lz4_ruby_compressed = LZ4.compress("Yo!")
73
+
74
+ # You can decode it with lz4_flex:
75
+ decompressed = Lz4Flex::VarInt.decompress(lz4_ruby_compressed)
76
+
77
+ puts decompressed #=> "Yo!"
78
+ puts decompressed.encoding #=> Encoding::BINARY
79
+ ```
80
+
81
+ Combine
82
+
83
+ ### Running Tests
84
+ To run the tests, execute:
85
+
86
+ ```sh
87
+ bundle exec rake
88
+ ```
89
+
90
+ ## Contribute to this library (optional)
91
+
92
+ 1. Fork the repository.
93
+ 2. Create a new branch (`git checkout -b my-feature-branch`).
94
+ 3. Make your changes.
95
+ 4. Commit your changes (`git commit -am 'Add new feature'`).
96
+ 5. Push to the branch (`git push origin my-feature-branch`).
97
+ 6. Create a new Pull Request.
98
+
99
+ Please ensure your code adheres to the project's coding standards and includes appropriate tests.
Binary file
Binary file
@@ -0,0 +1,6 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module Lz4Flex
5
+ VERSION = "0.1.1"
6
+ end
data/lib/lz4_flex.rb ADDED
@@ -0,0 +1,10 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ # Tries to require the precompiled extension for the given Ruby version first
5
+ begin
6
+ RUBY_VERSION =~ /(\d+\.\d+)/
7
+ require "lz4_flex/#{Regexp.last_match(1)}/lz4_flex_ext"
8
+ rescue LoadError
9
+ require_relative "lz4_flex/lz4_flex_ext"
10
+ end
metadata ADDED
@@ -0,0 +1,59 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lz4_flex
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: aarch64-linux-musl
6
+ authors:
7
+ - Shopify Engineering
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2024-08-19 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A modern LZ4 compression library for Ruby, leveraging the power of the
14
+ [`lz4_flex`](https://github.com/PSeitz/lz4_flex) Rust crate. This library provides
15
+ a pure Rust implementation of the LZ4 algorithm, ensuring high performance and safety.
16
+ email:
17
+ - gems@shopify.com
18
+ executables: []
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - LICENSE.md
23
+ - README.md
24
+ - lib/lz4_flex.rb
25
+ - lib/lz4_flex/3.2/lz4_flex_ext.so
26
+ - lib/lz4_flex/3.3/lz4_flex_ext.so
27
+ - lib/lz4_flex/version.rb
28
+ homepage: https://github.com/Shopify/lz4-flex-rb
29
+ licenses:
30
+ - MIT
31
+ metadata:
32
+ allowed_push_host: https://rubygems.org
33
+ homepage_uri: https://github.com/Shopify/lz4-flex-rb
34
+ source_code_uri: https://github.com/Shopify/lz4-flex-rb
35
+ changelog_uri: https://github.com/Shopify/lz4-flex-rb/releases
36
+ post_install_message:
37
+ rdoc_options: []
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: '3.2'
45
+ - - "<"
46
+ - !ruby/object:Gem::Version
47
+ version: 3.4.dev
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 3.3.22
53
+ requirements: []
54
+ rubygems_version: 3.4.4
55
+ signing_key:
56
+ specification_version: 4
57
+ summary: A modern LZ4 compression library for Ruby, leveraging the `lz4_flex` Rust
58
+ crate.
59
+ test_files: []