vectorclock


Namevectorclock JSON
Version 0.5.3 PyPI version JSON
download
home_pageNone
SummaryA vector clock
upload_time2024-06-23 01:15:48
maintainerNone
docs_urlNone
authorboxydog
requires_python<4.0,>=3.8
licenseMIT License
keywords vector clock
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Introduction
------------

A vector clock is a data structure used for determining the partial
ordering of events in a distributed system and detecting causality
violations.

See https://en.wikipedia.org/wiki/Vector_clock.

This implements a vector where each process has its own clock.

A typical description will have the counter start from 1 and increment by
1 every time there is a change.

However, this implementation allows the counter increase by whatever the
client asks for.  Our processes can set the counter to their own clock,
hence allow us to resolve conflicts (unordered changes) by leaning towards
later (more recent) object versions.

Using
-----

```
>>> from vectorclock import VectorClock
>>> vca1 = VectorClock({"A":1})
>>> vca2 = VectorClock.from_string('{"A":2}')
>>> print(vca1 < vca2)
True
>>> print(vca1 != vca2)
True
>>> print(vca1 == vca2)
False
>>> print(vca1 > vca2)
False
>>> print(str(vca1))
{"A":1}

# these two clocks are not ordered
>>> vcb = VectorClock({"B": 1})
>>> print(vca1 == vcb)
False
>>> print(vca1 < vcb)
False
>>> print(vca1 > vcb)
False
# If tie-breaking is off, they are not ordered (but not equal!)
>>> print(vca1.compare(vcb, tiebreak=False))
0
# If tie-breaking is on, we pick an order (deterministically)
>>> print(vca1.compare(vcb, tiebreak=True))
-1
```

The rest of this README is for vectorclock developers.

Testing
-------

```
python -m unittest discover -s tests
```

Building
--------

```
python -m pip install --upgrade build
python -m build
```

See also https://packaging.python.org/en/latest/tutorials/packaging-projects/#generating-distribution-archives.

Uploading to pypi
-----------------

```
python -m pip install twine
twine check dist/*
twine upload -r testpypi dist/*
```

Check that the distribution looks as expected.  Now:

```
twine upload -r pypi dist/*
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "vectorclock",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": "vector clock",
    "author": "boxydog",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/1b/1e/dab269e183287389b47b51acb74b71eab4ade1f440d4bf2861d2d12a995b/vectorclock-0.5.3.tar.gz",
    "platform": null,
    "description": "Introduction\n------------\n\nA vector clock is a data structure used for determining the partial\nordering of events in a distributed system and detecting causality\nviolations.\n\nSee https://en.wikipedia.org/wiki/Vector_clock.\n\nThis implements a vector where each process has its own clock.\n\nA typical description will have the counter start from 1 and increment by\n1 every time there is a change.\n\nHowever, this implementation allows the counter increase by whatever the\nclient asks for.  Our processes can set the counter to their own clock,\nhence allow us to resolve conflicts (unordered changes) by leaning towards\nlater (more recent) object versions.\n\nUsing\n-----\n\n```\n>>> from vectorclock import VectorClock\n>>> vca1 = VectorClock({\"A\":1})\n>>> vca2 = VectorClock.from_string('{\"A\":2}')\n>>> print(vca1 < vca2)\nTrue\n>>> print(vca1 != vca2)\nTrue\n>>> print(vca1 == vca2)\nFalse\n>>> print(vca1 > vca2)\nFalse\n>>> print(str(vca1))\n{\"A\":1}\n\n# these two clocks are not ordered\n>>> vcb = VectorClock({\"B\": 1})\n>>> print(vca1 == vcb)\nFalse\n>>> print(vca1 < vcb)\nFalse\n>>> print(vca1 > vcb)\nFalse\n# If tie-breaking is off, they are not ordered (but not equal!)\n>>> print(vca1.compare(vcb, tiebreak=False))\n0\n# If tie-breaking is on, we pick an order (deterministically)\n>>> print(vca1.compare(vcb, tiebreak=True))\n-1\n```\n\nThe rest of this README is for vectorclock developers.\n\nTesting\n-------\n\n```\npython -m unittest discover -s tests\n```\n\nBuilding\n--------\n\n```\npython -m pip install --upgrade build\npython -m build\n```\n\nSee also https://packaging.python.org/en/latest/tutorials/packaging-projects/#generating-distribution-archives.\n\nUploading to pypi\n-----------------\n\n```\npython -m pip install twine\ntwine check dist/*\ntwine upload -r testpypi dist/*\n```\n\nCheck that the distribution looks as expected.  Now:\n\n```\ntwine upload -r pypi dist/*\n```\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "A vector clock",
    "version": "0.5.3",
    "project_urls": {
        "Homepage": "https://github.com/boxydog/vectorclock",
        "Issues": "https://github.com/boxydog/vectorclock/issues"
    },
    "split_keywords": [
        "vector",
        "clock"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "519b3ef185a01d9048ddcab7ffaa574a8bff3a12d4bd06932928984cf20989f0",
                "md5": "6c5d271e5f7eedf559783f010cce95ce",
                "sha256": "f82b91dc9fe62c0b26e93c35c50aec0550c04b6ad98ec880e2a3d8a9c3e0fe2e"
            },
            "downloads": -1,
            "filename": "vectorclock-0.5.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6c5d271e5f7eedf559783f010cce95ce",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 6291,
            "upload_time": "2024-06-23T01:15:47",
            "upload_time_iso_8601": "2024-06-23T01:15:47.370519Z",
            "url": "https://files.pythonhosted.org/packages/51/9b/3ef185a01d9048ddcab7ffaa574a8bff3a12d4bd06932928984cf20989f0/vectorclock-0.5.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1b1edab269e183287389b47b51acb74b71eab4ade1f440d4bf2861d2d12a995b",
                "md5": "41576261d28122ec23d25890a9f5ae31",
                "sha256": "bd575cbd3dc3491116b6d9aafcd234958f2eb6e0bb7b36f6ceb9ca10888791ff"
            },
            "downloads": -1,
            "filename": "vectorclock-0.5.3.tar.gz",
            "has_sig": false,
            "md5_digest": "41576261d28122ec23d25890a9f5ae31",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 5991,
            "upload_time": "2024-06-23T01:15:48",
            "upload_time_iso_8601": "2024-06-23T01:15:48.846481Z",
            "url": "https://files.pythonhosted.org/packages/1b/1e/dab269e183287389b47b51acb74b71eab4ade1f440d4bf2861d2d12a995b/vectorclock-0.5.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-23 01:15:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "boxydog",
    "github_project": "vectorclock",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "vectorclock"
}
        
Elapsed time: 0.36386s