Skip to content

Commit

Permalink
Release v0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
v-kolesnikov committed Jul 4, 2023
1 parent 42fca3f commit 8a96e3a
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 63 deletions.
42 changes: 31 additions & 11 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,39 @@ name: Ruby

on: [push]

jobs:
build:
permissions:
contents: read

jobs:
tests:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
ruby: [
"1.9.3",
"2.0.0",
2.1,
2.3,
2.4,
2.5,
2.6,
2.7,
"3.0",
3.1,
3.2,
jruby-9.1,
jruby-9.2,
jruby-9.3,
jruby-9.4,
truffleruby-head
]
name: ${{ matrix.ruby }}
steps:
- uses: actions/checkout@v1
- name: Set up Ruby 2.6
uses: actions/setup-ruby@v1
- uses: actions/checkout@v3
- uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Build and test with Rake
run: |
gem install bundler
bundle install --jobs 4 --retry 3
bundle exec rake
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: bundle exec rake
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@

# rspec failure tracking
.rspec_status
Gemfile.lock
8 changes: 0 additions & 8 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
# frozen_string_literal: true

source 'https://rubygems.org'

# Specify your gem's dependencies in uuid_v6.gemspec
gemspec

gem 'rake'

group :test do
gem 'rspec'
end
40 changes: 0 additions & 40 deletions Gemfile.lock

This file was deleted.

31 changes: 28 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,32 @@
[![Gem Version](https://badge.fury.io/rb/uuid_v6.svg)](https://badge.fury.io/rb/uuid_v6)

# UUIDv6

[![Build Status](https://travis-ci.org/v-kolesnikov/uuid_v6.svg?branch=master)](https://travis-ci.org/v-kolesnikov/uuid_v6)
[![Gem Version](https://badge.fury.io/rb/uuid_v6.svg)](https://badge.fury.io/rb/uuid_v6)
**UUID v6** pure Ruby implementation. See http://gh.peabody.io/uuidv6/ for details.

The expected[^1] use case for UUIDv6 is as a drop-in replacement for UUIDv1 which offers improved DB locality. If you don’t have the requirement to keep compatibility with UUIDv1 the suggestion is to use UUIDv7 instead. The only real difference between UUIDv6 and UUIDv1 is the order of the timestamp bits. Starting with the 60-bit timestamp, the first 48 bits of the timestamp come first in the UUID (the specification splits this between time_high, and time_mid likely to keep the same terms as RFC 4122). The next 4 bits contain the version (0110 in this case for v6) and then the final 12 bits of the timestamp can be found. This leads to the following difference:

**UUIDv1**

```
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| time_low |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| time_mid | time_hi_and_version |
```

**UUIDv6**

UUID version 6 implementation in Ruby. See http://gh.peabody.io/uuidv6/ for details.
```
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| time_high |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| time_mid | time_low_and_version |
```

## Installation

Expand Down Expand Up @@ -62,3 +85,5 @@ The gem is available as open source under the terms of the [MIT License](https:/
## Code of Conduct

Everyone interacting in the UUIDv6 project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/v-kolesnikov/uuid_v6/blob/master/CODE_OF_CONDUCT.md).

[^1]: https://blog.devgenius.io/analyzing-new-unique-identifier-formats-uuidv6-uuidv7-and-uuidv8-d6cc5cd7391a
9 changes: 9 additions & 0 deletions lib/uuid_v6.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,14 @@
require 'uuid_v6/sequence'
require 'uuid_v6/version'

# Usage:
#
# UUIDv6.uuid
# => "13bfc94b-6e81-6070-51da-2683e7d73645"
module UUIDv6
extend self

def uuid
Sequence.new.()
end
end
2 changes: 1 addition & 1 deletion lib/uuid_v6/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module UUIDv6
VERSION = "0.1.0"
VERSION = "0.1.1"
end
1 change: 1 addition & 0 deletions uuid_v6.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]

spec.add_dependency 'uuid'
spec.add_development_dependency 'rspec'
end

0 comments on commit 8a96e3a

Please sign in to comment.