{"repo":"sony/sonyflake","free":true,"listed":false,"github":"https://github.com/sony/sonyflake","clone":"git clone https://github.com/sony/sonyflake.git","description":"A distributed unique ID generator inspired by Twitter's Snowflake","language":"Go","stars":4397,"topics":["golang","id-generator"],"license":"MIT","category":"dev-tools","readme_excerpt":"Sonyflake Sonyflake is a distributed unique ID generator inspired by Twitter's Snowflake. Sonyflake focuses on lifetime and performance on many host/core environment. So it has a different bit assignment from Snowflake. By default, a Sonyflake ID is composed of 39 bits for time in units of 10 msec 8 bits for a sequence number 16 bits for a machine id As a result, Sonyflake has the following advantages and disadvantages: - The lifetime (174 years) is longer than that of Snowflake (69 years) - It can work in more distributed machines (2^16) than Snowflake (2^10) - It can generate 2^8 IDs per 10 msec at most in a single instance (fewer than Snowflake) However, if you want more generation rate in a single host, you can easily run multiple Sonyflake instances parallelly using goroutines. In addition, you can adjust the lifetime and generation rate of Sonyflake by customizing the bit assignment and the time unit. Installation Usage The function New creates a new Sonyflake instance. You can configure Sonyflake by the struct Settings: - BitsSequence is the bit length of a sequence number. If BitsSequence is 0, the default bit length is used, which is 8. If BitsSequence is 31 or more, an error is returned. - BitsMachineID is the bit length of a machine ID. If BitsMachineID is 0, the default bit length is used, which is 16. If BitsMachineID is 31 or more, an error is returned. - TimeUnit is the time unit of Sonyflake. If TimeUnit is 0, the default time unit is used, which is 10 msec. T","default_branch":null,"files":null,"tree":[],"storefront":"/r/sony","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/sony/sonyflake/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}