Name | atomic-counter JSON |
Version |
0.1.3
JSON |
| download |
home_page | None |
Summary | Atomic Counters |
upload_time | 2024-09-17 14:41:33 |
maintainer | None |
docs_url | None |
author | Tim Paine |
requires_python | >=3.8 |
license | None |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Atomic Counter
[![Build Status](https://github.com/timkpaine/atomic-counter/workflows/Build%20Status/badge.svg?branch=main)](https://github.com/timkpaine/atomic-counter/actions?query=workflow%3A%22Build+Status%22)
[![Coverage](https://codecov.io/gh/timkpaine/atomic-counter/branch/main/graph/badge.svg)](https://codecov.io/gh/timkpaine/atomic-counter)
[![License](https://img.shields.io/github/license/timkpaine/atomic-counter.svg)](https://pypi.python.org/pypi/atomic-counter)
[![PyPI](https://img.shields.io/pypi/v/atomic-counter.svg)](https://pypi.python.org/pypi/atomic-counter)
## Overview
`atomic-counter` is a rust library for generating a monotonically increasing sequence of integers. Depending on the particular configuration of the counter, the generated sequence will be produce unique numbers down to the nanosecond, regardless of memory state.
E.g. if you quit the process and recreate a new counter `>1ns` later, your sequence is guaranteed to still be monotonically increasing (but with a gap).
## Usage
```python
from atomic_counter import Counter
c = Counter(offset_in_nanos, base_in_nanos)
c.next() # generate next number in sequence
```
Here, `base` is the counter's `0` value (e.g. a epoch in nanos to consider the `0` point, to keep numbers as small as possible if you do not need to go back to 1970). `offset` is the number of nanos since `base` at which to start.
If unset, `base` will be `2010-01-01` in nanos, `offset` will be `0`, which means the counter will start at `(now - 2010/01/01) as nanos`.
To create e.g. a daily counter, pass in `base=today in nanos`. As this is a common occurrence for sequences that reset daily, a convenience function `def daily() -> Counter:` is provided.
Raw data
{
"_id": null,
"home_page": null,
"name": "atomic-counter",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Tim Paine",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/d2/88/334a44d65150068d5b6d013f9067f1e432e8e92f92bc411a826f61c8c30c/atomic_counter-0.1.3.tar.gz",
"platform": null,
"description": "# Atomic Counter\n\n[![Build Status](https://github.com/timkpaine/atomic-counter/workflows/Build%20Status/badge.svg?branch=main)](https://github.com/timkpaine/atomic-counter/actions?query=workflow%3A%22Build+Status%22)\n[![Coverage](https://codecov.io/gh/timkpaine/atomic-counter/branch/main/graph/badge.svg)](https://codecov.io/gh/timkpaine/atomic-counter)\n[![License](https://img.shields.io/github/license/timkpaine/atomic-counter.svg)](https://pypi.python.org/pypi/atomic-counter)\n[![PyPI](https://img.shields.io/pypi/v/atomic-counter.svg)](https://pypi.python.org/pypi/atomic-counter)\n\n## Overview\n`atomic-counter` is a rust library for generating a monotonically increasing sequence of integers. Depending on the particular configuration of the counter, the generated sequence will be produce unique numbers down to the nanosecond, regardless of memory state.\nE.g. if you quit the process and recreate a new counter `>1ns` later, your sequence is guaranteed to still be monotonically increasing (but with a gap).\n\n## Usage\n\n```python\nfrom atomic_counter import Counter\n\nc = Counter(offset_in_nanos, base_in_nanos)\n\nc.next() # generate next number in sequence\n```\n\nHere, `base` is the counter's `0` value (e.g. a epoch in nanos to consider the `0` point, to keep numbers as small as possible if you do not need to go back to 1970). `offset` is the number of nanos since `base` at which to start.\n\nIf unset, `base` will be `2010-01-01` in nanos, `offset` will be `0`, which means the counter will start at `(now - 2010/01/01) as nanos`.\n\nTo create e.g. a daily counter, pass in `base=today in nanos`. As this is a common occurrence for sequences that reset daily, a convenience function `def daily() -> Counter:` is provided.\n\n\n\n\n",
"bugtrack_url": null,
"license": null,
"summary": "Atomic Counters",
"version": "0.1.3",
"project_urls": {
"homepage": "https://github.com/timkpaine/atomic-counter",
"repository": "https://github.com/timkpaine/atomic-counter"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "74384e873209a419f665431287c961c0da4bc0c1799c44f4add208ee2d34004b",
"md5": "56d7b3b784687a688d965839e3512ce2",
"sha256": "65679c35ddc098b0ed66887bee59aac8c17748ee0d84de8b23baba34836141aa"
},
"downloads": -1,
"filename": "atomic_counter-0.1.3-cp37-abi3-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "56d7b3b784687a688d965839e3512ce2",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": ">=3.8",
"size": 201779,
"upload_time": "2024-09-17T14:59:17",
"upload_time_iso_8601": "2024-09-17T14:59:17.486443Z",
"url": "https://files.pythonhosted.org/packages/74/38/4e873209a419f665431287c961c0da4bc0c1799c44f4add208ee2d34004b/atomic_counter-0.1.3-cp37-abi3-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0c599d57538dd257688ab1453e0ea436784c6ba15c35e0229e7e65d5415d5654",
"md5": "cdcd2294fa6115ae5fa4b37ee8b8bca9",
"sha256": "680c44a9a8b33f5cfb9481e54816029550394da097a2fa43c3f6cbc9d85c08f7"
},
"downloads": -1,
"filename": "atomic_counter-0.1.3-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "cdcd2294fa6115ae5fa4b37ee8b8bca9",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": ">=3.8",
"size": 234100,
"upload_time": "2024-09-17T14:41:28",
"upload_time_iso_8601": "2024-09-17T14:41:28.830929Z",
"url": "https://files.pythonhosted.org/packages/0c/59/9d57538dd257688ab1453e0ea436784c6ba15c35e0229e7e65d5415d5654/atomic_counter-0.1.3-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4b0ad54beefd3e0773f57dbc6102edacbc0fc8f501dd98b8f073e9fde7c51947",
"md5": "f2f71d4df51ae2c53c2051140aa7eaef",
"sha256": "cc8772175a41c16bbea15e40909a51584cc00c47d6067c7abe18fcbec6397b50"
},
"downloads": -1,
"filename": "atomic_counter-0.1.3-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl",
"has_sig": false,
"md5_digest": "f2f71d4df51ae2c53c2051140aa7eaef",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": ">=3.8",
"size": 243529,
"upload_time": "2024-09-17T14:41:30",
"upload_time_iso_8601": "2024-09-17T14:41:30.980653Z",
"url": "https://files.pythonhosted.org/packages/4b/0a/d54beefd3e0773f57dbc6102edacbc0fc8f501dd98b8f073e9fde7c51947/atomic_counter-0.1.3-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "63689c5735dbec801f49348996660da11b762e335260729dc1a098719518c0fc",
"md5": "9c8ba09f267ecd1e3d6179ee88b89e21",
"sha256": "5142d3fdbffcf39db444760d8ef9a40141adf6f752bffeb0b1cb4f923f7d37f4"
},
"downloads": -1,
"filename": "atomic_counter-0.1.3-cp37-abi3-musllinux_1_2_x86_64.whl",
"has_sig": false,
"md5_digest": "9c8ba09f267ecd1e3d6179ee88b89e21",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": ">=3.8",
"size": 295026,
"upload_time": "2024-09-17T14:41:32",
"upload_time_iso_8601": "2024-09-17T14:41:32.436589Z",
"url": "https://files.pythonhosted.org/packages/63/68/9c5735dbec801f49348996660da11b762e335260729dc1a098719518c0fc/atomic_counter-0.1.3-cp37-abi3-musllinux_1_2_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4baca2cda0031c664064e92d20426b3b8f8ee63557cd94c7c4447f630b4b29d2",
"md5": "effb30f99bdf4c5bf21377d7993d8cd9",
"sha256": "a1b138c4c687424db8d4a33f73a2e1f6f18912a28a34548f860ac9d8f3c864f1"
},
"downloads": -1,
"filename": "atomic_counter-0.1.3-cp37-abi3-win32.whl",
"has_sig": false,
"md5_digest": "effb30f99bdf4c5bf21377d7993d8cd9",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": ">=3.8",
"size": 113306,
"upload_time": "2024-09-17T14:51:06",
"upload_time_iso_8601": "2024-09-17T14:51:06.831870Z",
"url": "https://files.pythonhosted.org/packages/4b/ac/a2cda0031c664064e92d20426b3b8f8ee63557cd94c7c4447f630b4b29d2/atomic_counter-0.1.3-cp37-abi3-win32.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "521292132786ed74638c6f35a094329a4aecbe9a7abafacc46134dad75e7c462",
"md5": "03388b7a4bd006e0ef689e0bd7b6261c",
"sha256": "104d42eaf71061863dec03e92b9449f891d076d9b71d0ae1341b00a742bf547d"
},
"downloads": -1,
"filename": "atomic_counter-0.1.3-cp37-abi3-win_amd64.whl",
"has_sig": false,
"md5_digest": "03388b7a4bd006e0ef689e0bd7b6261c",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": ">=3.8",
"size": 115604,
"upload_time": "2024-09-17T14:51:08",
"upload_time_iso_8601": "2024-09-17T14:51:08.136687Z",
"url": "https://files.pythonhosted.org/packages/52/12/92132786ed74638c6f35a094329a4aecbe9a7abafacc46134dad75e7c462/atomic_counter-0.1.3-cp37-abi3-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d288334a44d65150068d5b6d013f9067f1e432e8e92f92bc411a826f61c8c30c",
"md5": "6872d769b6599cbcdc5bebf843deb2b3",
"sha256": "1d7dc516776fd9d45de97b8179ebe2e7f5f8edb017ce1d769ff6cd0c6edeff12"
},
"downloads": -1,
"filename": "atomic_counter-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "6872d769b6599cbcdc5bebf843deb2b3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 17854,
"upload_time": "2024-09-17T14:41:33",
"upload_time_iso_8601": "2024-09-17T14:41:33.527050Z",
"url": "https://files.pythonhosted.org/packages/d2/88/334a44d65150068d5b6d013f9067f1e432e8e92f92bc411a826f61c8c30c/atomic_counter-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-17 14:41:33",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "timkpaine",
"github_project": "atomic-counter",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "atomic-counter"
}