Skip to content

Commit c726283

Browse files
committed
v2
1 parent 3fe6df7 commit c726283

10 files changed

+597
-577
lines changed

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2021 CoderMe.com
1+
Copyright (c) 2022 CoderMe.com
22
Permission to use, copy, modify, and distribute this software for any
33
purpose with or without fee is hereby granted, provided that the above
44
copyright notice and this permission notice appear in all copies.

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717

1818
## Installation
1919
* The usal way, get it:
20-
```go get github.com/coderme/oneid```
20+
```go get github.com/coderme/oneid/v2```
2121

2222

2323
## Usage
24-
* Generation of int64 Id on a simple server with single process is as simple as:
24+
* Generation of uint32 Id on a simple server with single process is as simple as:
2525
```
26-
id := oneid.Int64(1,1 &oneid.DefaultInt64Config)
26+
id := oneid.Uint32(1,1 &oneid.DefaultUint32Config)
2727
```
2828
* or better an uint64 if your database supports it
2929
```

doc.go

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2021 CoderMe.com
1+
// Copyright (c) 2022 CoderMe.com
22
// Permission to use, copy, modify, and distribute this software for any
33
// purpose with or without fee is hereby granted, provided that the above
44
// copyright notice and this permission notice appear in all copies.
@@ -19,15 +19,15 @@
1919
2020
Generating IDs:
2121
22-
IDs generated are partially time-sortable, guranteed to be unique only if the program is running by one
22+
IDs generated are partially time-sortable, guaranteed to be unique only if the program is running by one
2323
process and on a single server. On cluster of servers or multiple processes per server, further configuration
2424
is needed.
2525
26-
Int64(serverID, processID, Config) and Uint64(serverID, processID, config) can be used to generate IDS with
26+
Uint32(serverID, processID, Config) and Uint64(serverID, processID, config) can be used to generate IDS with
2727
fixed serverID and processID on simple setups.
2828
2929
For more two servers or more, there are os nviroment depenedant which lookup up serverID is environment
30-
SERVER_ID and processID in enviroment variable PROCESS_ID
30+
SERVER_ID and processID in environment variable PROCESS_ID
3131
3232
3333
Arguments:
@@ -42,7 +42,7 @@
4242
The default configration supports upto 1024 servers and upto 32 processes per each one.
4343
4444
To support more than 1024 servers, or more than 32 processes, consider customizing processBits and serverBits
45-
by using NewInt64Config() and NewUint64Config() for Int64(), EnvInt64() and its uint equivelent Uint64()
45+
by using NewUint32Config() and NewUint64Config() for Uint32(), EnvUint32() and its uint64 equivalent Uint64()
4646
EnvUint64() functions respectively.
4747
4848
Configurations are thread-safe and should be reused across multiple goroutines.
@@ -56,11 +56,11 @@
5656
5757
5858
* One server with multiple processes:
59-
= Consider using processes manager like systemd, in order to decrease the os dynamic proces sid
59+
= Consider using processes manager like systemd, in order to decrease the os dynamic process sid
6060
aka (pid) gap, large gaps between pid increase the likelihood of exhasting processbits.
6161
6262
= A better solution would be use static processID as environment variable available for a single
63-
process each. Then use EnvInt64 and EnvUint64.
63+
process each. Then use EnvUint32 and EnvUint64.
6464
6565
6666
* Multiple servers with multiple processe:
@@ -70,4 +70,3 @@
7070
7171
*/
7272
package oneid
73-

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
module github.com/coderme/oneid
1+
module github.com/coderme/oneid/v2
22

3-
go 1.16
43

4+
go 1.17
55

int64.go

-169
This file was deleted.

0 commit comments

Comments
 (0)