dogtag 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -3
- data/lib/dogtag/mixins/redis.rb +1 -1
- data/lib/dogtag/request.rb +1 -1
- data/lib/dogtag/version.rb +1 -1
- metadata +12 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b6c81c67e8ff11a656633eebeb2677e2b7bfd77
|
4
|
+
data.tar.gz: 73a06d852bac9ac5cbda1755422e0820c341d210
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e30da8fd34c6891f341b871d2bc791c79959c4072307e7eebe4d85f1b568d8a837856fe16bb4a12728f840ace00b840895d26d399435a6dd03570369ae7ff67
|
7
|
+
data.tar.gz: 52f52d6a11de81bf2b3e3ebbc8f1eaf0928cf877e09547c6fad61ee89dd8c0f8ebc4d40e21a344a28061fdbb5c76b1899c6bbb9b3adff1158529aed1fe135971
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
Dogtag
|
2
|
-
|
1
|
+
Dogtag [![Code Climate](https://codeclimate.com/repos/5942bc55a2d69c025b00037d/badges/9f08a12606fdc4e23360/gpa.svg)](https://codeclimate.com/repos/5942bc55a2d69c025b00037d/feed) [![Build Status](https://travis-ci.com/zillyinc/dogtag.svg?token=zLzTcsQJDEyJnTYpWzNq&branch=master)](https://travis-ci.com/zillyinc/dogtag)
|
2
|
+
============
|
3
3
|
|
4
4
|
A Redis-powered Ruby client for generating unique IDs with Redis for use in distributed systems. Based heavily off of [Icicle](https://github.com/intenthq/icicle/) and [Twitter Snowflake](https://github.com/intenthq/icicle/)
|
5
5
|
|
@@ -16,7 +16,7 @@ Simply add `gem 'dogtag'` to your `Gemfile` and run `bundle`
|
|
16
16
|
Configuration
|
17
17
|
-------------
|
18
18
|
|
19
|
-
To configure the connection to your Redis server simply set a `DOGTAG_REDIS_URL` or `REDIS_URL` environment variable. Dogtag will first look for the `DOGTAG_REDIS_URL`, then `REDIS_URL`. If neither are found it will default to `redis://
|
19
|
+
To configure the connection to your Redis server simply set a `DOGTAG_REDIS_URL` or `REDIS_URL` environment variable. Dogtag will first look for the `DOGTAG_REDIS_URL`, then `REDIS_URL`. If neither are found it will default to `redis://127.0.01:6379`.
|
20
20
|
|
21
21
|
To set the range of logical shard IDs this server should manage, run the command below replacing the number range with a range of numbers, of which none can be shared with another Redis server. If a logical shard ID is shared a separate Redis instance, you may get ID collisions.
|
22
22
|
|
@@ -40,6 +40,18 @@ count = 100
|
|
40
40
|
Dogtag.generate_ids data_type, count
|
41
41
|
```
|
42
42
|
|
43
|
+
```ruby
|
44
|
+
id_number = Dogtag.generate_id 42
|
45
|
+
id = Dogtag::Id.new(id_number)
|
46
|
+
id.data_type #=> 42
|
47
|
+
id.sequence #=> 1
|
48
|
+
id.logical_shard_id #=> 12
|
49
|
+
id.custom_timestamp # time since custom epoch
|
50
|
+
id.timestamp.to_i #=> 28146773761 # Unix timestamp
|
51
|
+
id.timestamp.to_time # Ruby Time object
|
52
|
+
id.timestamp.epoch #=> 1483228800000
|
53
|
+
```
|
54
|
+
|
43
55
|
*Note: The available data type ID numbers are current 0 - 255.*
|
44
56
|
|
45
57
|
Gotchas
|
data/lib/dogtag/mixins/redis.rb
CHANGED
data/lib/dogtag/request.rb
CHANGED
data/lib/dogtag/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dogtag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Crownoble
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.2'
|
20
|
+
- - "<"
|
18
21
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
22
|
+
version: '5'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.2'
|
30
|
+
- - "<"
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
32
|
+
version: '5'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: rspec
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|