snowflaked 0.1.2-arm-linux → 0.1.3-arm-linux

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb1dd6a3950cc0242946bac7dfddf806e1454da172dfdf0193daccb063f92cdc
4
- data.tar.gz: 5244e202ea6f11bb808740d59efcadd8ec6bcb47d6c24db48c2d8e2f2f88a012
3
+ metadata.gz: 38fc2352d02dd80016be6d3998758807ce1a4ccb38d1d023cc6162b08cbf9d1a
4
+ data.tar.gz: 0ae9a58b29de3bef02ce745d4e8fe6d53f7e4320403d392316b8ea87a357f675
5
5
  SHA512:
6
- metadata.gz: 543cbffc4cd826b4fcce19f773c28754d94182af765c646313a209a62bb5c17703ce13379974441b2c79bf1f52ec5f0ccbce902e22b3c694e17bf820600d3479
7
- data.tar.gz: de0823150ce2a96d82e745a6d0758f4b3a6d1deda6738ca536ac4b2f1e95ac21aeb8ea9f0477a3d75dce6416b350479cbc058d0228cfb56e7d60a6fd2b62680c
6
+ metadata.gz: 9861a1d5b31bb0089bdbd7099bfa22e18d37f6079e0e7e03394686ef874575547d4bfc214c2baa02001e18afa1356667a23c9e2efb64dee06e3778aaa14f7a8f
7
+ data.tar.gz: b588edc1d663adf0e6a59c6ef6c5c7b0ccff64450838d95b4d17ae27372f4cd621c08e70811bb437312c56cfc789e2d5fda21fb19c8e99686e3ad04988767da3
data/README.md CHANGED
@@ -87,6 +87,13 @@ Snowflaked.configure do |config|
87
87
  end
88
88
  ```
89
89
 
90
+ ### Machine ID
91
+
92
+ > [!TIP]
93
+ > For multi-process servers like Puma, it is recommended to **not** configure `machine_id` explicitly. The gem automatically calculates a unique machine ID using `(hostname.hash ^ pid) % 1024`, which ensures each forked worker process gets a different ID and avoids duplicate Snowflake IDs.
94
+
95
+ If you must set `machine_id` explicitly, use environment variables that differ per worker process.
96
+
90
97
  ### Machine ID Resolution
91
98
 
92
99
  If `machine_id` is not explicitly configured, it resolves in this order:
@@ -151,6 +158,10 @@ bundle install
151
158
  bundle exec rake
152
159
  ```
153
160
 
161
+ ## Acknowledgments
162
+
163
+ - [snowflaked-rs](https://github.com/MrGunflame/snowflaked-rs) - the Rust implementation of Snowflake IDs
164
+
154
165
  ## License
155
166
 
156
167
  MIT
Binary file
Binary file
Binary file
Binary file
@@ -5,7 +5,7 @@ module Snowflaked
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  included do
8
- class_attribute :_snowflake_attributes, instance_writer: false, default: [:id] # rubocop:disable ThreadSafety/ClassAndModuleAttributes -- false positive
8
+ class_attribute :_snowflake_attributes, instance_writer: false, default: [:id]
9
9
  before_validation :_generate_snowflake_ids, on: :create
10
10
  end
11
11
 
@@ -17,9 +17,13 @@ module Snowflaked
17
17
  end
18
18
 
19
19
  def _snowflake_columns_from_comments
20
- return [] unless table_exists?
20
+ return @_snowflake_columns_from_comments if defined?(@_snowflake_columns_from_comments)
21
21
 
22
- columns.filter_map { |col| col.name.to_sym if col.comment == Snowflaked::SchemaDefinitions::COMMENT }
22
+ @_snowflake_columns_from_comments = if table_exists?
23
+ columns.filter_map { |col| col.name.to_sym if col.comment == Snowflaked::SchemaDefinitions::COMMENT }
24
+ else
25
+ []
26
+ end
23
27
  end
24
28
  end
25
29
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Snowflaked
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
data/lib/snowflaked.rb CHANGED
@@ -57,7 +57,7 @@ module Snowflaked
57
57
 
58
58
  class << self
59
59
  def configuration
60
- @configuration ||= Configuration.new # rubocop:disable ThreadSafety/ClassInstanceVariable -- not changed after initialization
60
+ @configuration ||= Configuration.new
61
61
  end
62
62
 
63
63
  def configure
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snowflaked
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: arm-linux
6
6
  authors:
7
7
  - Luiz Eduardo Kowalski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-01-10 00:00:00.000000000 Z
11
+ date: 2026-01-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A Ruby gem for generating Twitter Snowflake IDs using a high-performance
14
14
  Rust backend. Thread-safe with configurable machine ID and custom epoch support.