Browse Source

docs

master
boB Rudis 5 years ago
parent
commit
2b8edfe79a
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 11
      R/ulid-package.R
  2. 8
      README.Rmd
  3. 71
      README.md
  4. 5
      man/ulid.Rd

11
R/ulid-package.R

@ -4,14 +4,14 @@
#'
#' UUID can be suboptimal for many uses-cases because:
#'
#' - It isn't the most character efficient way of encoding 128 bits of randomness
#' - It isn't the most character efficient way of encoding 128 bits of randomness
#' - UUID v1/v2 is impractical in many environments, as it requires access to a unique, stable MAC address
#' - UUID v3/v5 requires a unique seed and produces randomly distributed IDs, which can cause fragmentation in many data structures
#' - UUID v4 provides no other information than randomness which can cause fragmentation in many data structures
#'
#' Instead, herein is proposed ULID:
#'
#' ```javascript
#' ```
#' ulid() // 01ARZ3NDEKTSV4RRFFQ69G5FAV
#' ```
#'
@ -29,13 +29,13 @@
#'
#' |----------| |----------------|
#' Timestamp Randomness
#' 48bits 80bits
#' 48bits 80bits
#' ```
#'
#' **Components**
#'
#' _Timestamp_
#' - 48 bit integer
#' - 48 bit integer
#' - UNIX-time in milliseconds
#' - Won't run out of space till the year 10889 AD.
#'
@ -45,7 +45,8 @@
#'
#' **Sorting**
#'
#' The left-most character must be sorted first, and the right-most character sorted last (lexical order). The default ASCII character set must be used. Within the same millisecond, sort order is not guaranteed
#' The left-most character must be sorted first, and the right-most character sorted last (lexical order).
#' The default ASCII character set must be used. Within the same millisecond, sort order is not guaranteed.
#'
#' - URL: <https://gitlab.com/hrbrmstr/ulid>
#' - BugReports: <https://gitlab.com/hrbrmstr/ulid/issues>

8
README.Rmd

@ -53,7 +53,7 @@ ulid() // 01ARZ3NDEKTSV4RRFFQ69G5FAV
### Sorting
The left-most character must be sorted first, and the right-most character sorted last (lexical order). The default ASCII character set must be used. Within the same millisecond, sort order is not guaranteed
The left-most character must be sorted first, and the right-most character sorted last (lexical order). The default ASCII character set must be used. Within the same millisecond, sort order is not guaranteed.
## What's Inside The Tin
@ -107,4 +107,10 @@ unmarshal(u)
(ut <- ts_generate(as.POSIXct("2017-11-01 15:00:00", origin="1970-01-01")))
unmarshal(ut)
```
## Package Code Metrics
```{r}
cloc::cloc_pkg_md()
```

71
README.md

@ -58,7 +58,7 @@ randomness, if possible
The left-most character must be sorted first, and the right-most
character sorted last (lexical order). The default ASCII character set
must be used. Within the same millisecond, sort order is not guaranteed
must be used. Within the same millisecond, sort order is not guaranteed.
## What’s Inside The Tin
@ -93,7 +93,7 @@ packageVersion("ulid")
ulid::ULIDgenerate()
```
## [1] "0001E2D1EVWTN5G7C2244Q8SJ8"
## [1] "0001E2ERKHVPKZJ6FA6ZWHH1KS"
### Many
@ -101,11 +101,11 @@ ulid::ULIDgenerate()
(u <- ulid::ULIDgenerate(20))
```
## [1] "0001E2D1EV54P4DCS24WSYX2R1" "0001E2D1EV0D75WQ55XQ9TQ3RS" "0001E2D1EVPZVD2W626E49GHT6" "0001E2D1EVZCCD9DNH3SSTQN3K"
## [5] "0001E2D1EV6B8SYC81KSMVMM80" "0001E2D1EV5CT6Q9JB5H1SA5RF" "0001E2D1EVZEBD1J5RMGJ9B23S" "0001E2D1EVTX25KJGVGDJ61X5J"
## [9] "0001E2D1EVAT8T7V54G6ZQCX0F" "0001E2D1EVKRPHHANAZ5A070HN" "0001E2D1EVPZJ1NDV7M27TQBH0" "0001E2D1EVVZ0PAJVS3WY08QA4"
## [13] "0001E2D1EVZRQGQV0MEK65DKRA" "0001E2D1EVV1KP7XEKSEQDV8XQ" "0001E2D1EVZH19KNXG6GVEKKHP" "0001E2D1EVB7D31MKZQTRQP0S1"
## [17] "0001E2D1EVTPGNFEYW4MKGHZA1" "0001E2D1EV8SG2BCSFS3G7SXFV" "0001E2D1EV22JE3JZYF8P33PGS" "0001E2D1EVC6X98C3TT0N9B75C"
## [1] "0001E2ERKHVX5QF5D59SX2E65T" "0001E2ERKHKD6MHKYB1G8JHN5X" "0001E2ERKHTK0XEHVV2G5877K9" "0001E2ERKHKFGG5NPN24PC1N0W"
## [5] "0001E2ERKH3F48CAKJCVMSCBKS" "0001E2ERKHF3N0B94VK05GTXCW" "0001E2ERKH24GCJ2CT3Z5WM1FD" "0001E2ERKH381RJ232KK7SMWQW"
## [9] "0001E2ERKH7NAZ1T4HR4ZRQRND" "0001E2ERKHSATC17G2QAPYXE0C" "0001E2ERKH76R83NFST3MZNW84" "0001E2ERKHFKS52SD8WJ8FHXMV"
## [13] "0001E2ERKHQM6VBM5JB235JJ1W" "0001E2ERKHXG2KNYWHHFS8X69Z" "0001E2ERKHQW821KPRM4GQFANJ" "0001E2ERKHD5KWTM5S345A3RP4"
## [17] "0001E2ERKH0D901W6KX66B1BHE" "0001E2ERKHKPHZBFSC16FC7FFC" "0001E2ERKHQQH7315GMY8HRYXV" "0001E2ERKH016YBAJAB7K9777T"
### Unmarshal
@ -114,26 +114,26 @@ unmarshal(u)
```
## ts rnd
## 1 2018-12-28 15:21:47 54P4DCS24WSYX2R1
## 2 2018-12-28 15:21:47 0D75WQ55XQ9TQ3RS
## 3 2018-12-28 15:21:47 PZVD2W626E49GHT6
## 4 2018-12-28 15:21:47 ZCCD9DNH3SSTQN3K
## 5 2018-12-28 15:21:47 6B8SYC81KSMVMM80
## 6 2018-12-28 15:21:47 5CT6Q9JB5H1SA5RF
## 7 2018-12-28 15:21:47 ZEBD1J5RMGJ9B23S
## 8 2018-12-28 15:21:47 TX25KJGVGDJ61X5J
## 9 2018-12-28 15:21:47 AT8T7V54G6ZQCX0F
## 10 2018-12-28 15:21:47 KRPHHANAZ5A070HN
## 11 2018-12-28 15:21:47 PZJ1NDV7M27TQBH0
## 12 2018-12-28 15:21:47 VZ0PAJVS3WY08QA4
## 13 2018-12-28 15:21:47 ZRQGQV0MEK65DKRA
## 14 2018-12-28 15:21:47 V1KP7XEKSEQDV8XQ
## 15 2018-12-28 15:21:47 ZH19KNXG6GVEKKHP
## 16 2018-12-28 15:21:47 B7D31MKZQTRQP0S1
## 17 2018-12-28 15:21:47 TPGNFEYW4MKGHZA1
## 18 2018-12-28 15:21:47 8SG2BCSFS3G7SXFV
## 19 2018-12-28 15:21:47 22JE3JZYF8P33PGS
## 20 2018-12-28 15:21:47 C6X98C3TT0N9B75C
## 1 2018-12-29 07:02:57 VX5QF5D59SX2E65T
## 2 2018-12-29 07:02:57 KD6MHKYB1G8JHN5X
## 3 2018-12-29 07:02:57 TK0XEHVV2G5877K9
## 4 2018-12-29 07:02:57 KFGG5NPN24PC1N0W
## 5 2018-12-29 07:02:57 3F48CAKJCVMSCBKS
## 6 2018-12-29 07:02:57 F3N0B94VK05GTXCW
## 7 2018-12-29 07:02:57 24GCJ2CT3Z5WM1FD
## 8 2018-12-29 07:02:57 381RJ232KK7SMWQW
## 9 2018-12-29 07:02:57 7NAZ1T4HR4ZRQRND
## 10 2018-12-29 07:02:57 SATC17G2QAPYXE0C
## 11 2018-12-29 07:02:57 76R83NFST3MZNW84
## 12 2018-12-29 07:02:57 FKS52SD8WJ8FHXMV
## 13 2018-12-29 07:02:57 QM6VBM5JB235JJ1W
## 14 2018-12-29 07:02:57 XG2KNYWHHFS8X69Z
## 15 2018-12-29 07:02:57 QW821KPRM4GQFANJ
## 16 2018-12-29 07:02:57 D5KWTM5S345A3RP4
## 17 2018-12-29 07:02:57 0D901W6KX66B1BHE
## 18 2018-12-29 07:02:57 KPHZBFSC16FC7FFC
## 19 2018-12-29 07:02:57 QQH7315GMY8HRYXV
## 20 2018-12-29 07:02:57 016YBAJAB7K9777T
### Use defined timestamps
@ -141,11 +141,24 @@ unmarshal(u)
(ut <- ts_generate(as.POSIXct("2017-11-01 15:00:00", origin="1970-01-01")))
```
## [1] "0001CZM6DG91GGPEZMYZ1TNKH3"
## [1] "0001CZM6DGE66RJEY4N05F5R95"
``` r
unmarshal(ut)
```
## ts rnd
## 1 2017-11-01 15:00:00 91GGPEZMYZ1TNKH3
## 1 2017-11-01 15:00:00 E66RJEY4N05F5R95
## Package Code Metrics
``` r
cloc::cloc_pkg_md()
```
| Lang | \# Files | (%) | LoC | (%) | Blank lines | (%) | \# Lines | (%) |
| :----------- | -------: | ---: | --: | ---: | ----------: | ---: | -------: | ---: |
| C/C++ Header | 3 | 0.27 | 755 | 0.87 | 231 | 0.78 | 264 | 0.57 |
| C++ | 2 | 0.18 | 81 | 0.09 | 22 | 0.07 | 37 | 0.08 |
| R | 5 | 0.45 | 17 | 0.02 | 7 | 0.02 | 95 | 0.20 |
| Rmd | 1 | 0.09 | 10 | 0.01 | 37 | 0.12 | 69 | 0.15 |

5
man/ulid.Rd

@ -32,7 +32,7 @@ Instead, herein is proposed ULID:\preformatted{ulid() // 01ARZ3NDEKTSV4RRFFQ69G5
|----------| |----------------|
Timestamp Randomness
48bits 80bits
48bits 80bits
}
\strong{Components}
@ -52,7 +52,8 @@ Instead, herein is proposed ULID:\preformatted{ulid() // 01ARZ3NDEKTSV4RRFFQ69G5
\strong{Sorting}
The left-most character must be sorted first, and the right-most character sorted last (lexical order). The default ASCII character set must be used. Within the same millisecond, sort order is not guaranteed
The left-most character must be sorted first, and the right-most character sorted last (lexical order).
The default ASCII character set must be used. Within the same millisecond, sort order is not guaranteed.
\itemize{
\item URL: \url{https://gitlab.com/hrbrmstr/ulid}
\item BugReports: \url{https://gitlab.com/hrbrmstr/ulid/issues}

Loading…
Cancel
Save