{"id":23152544,"url":"https://github.com/cocagne/paxos","last_synced_at":"2025-04-04T05:08:38.735Z","repository":{"id":3338736,"uuid":"4382976","full_name":"cocagne/paxos","owner":"cocagne","description":"Plain Paxos Implementations in Python \u0026 Java","archived":false,"fork":false,"pushed_at":"2021-06-24T00:20:13.000Z","size":152,"stargazers_count":587,"open_issues_count":0,"forks_count":118,"subscribers_count":28,"default_branch":"master","last_synced_at":"2025-03-28T04:15:42.481Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cocagne.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-05-20T05:59:28.000Z","updated_at":"2025-03-20T15:24:31.000Z","dependencies_parsed_at":"2022-09-07T16:14:45.819Z","dependency_job_id":null,"html_url":"https://github.com/cocagne/paxos","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cocagne%2Fpaxos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cocagne%2Fpaxos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cocagne%2Fpaxos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cocagne%2Fpaxos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cocagne","download_url":"https://codeload.github.com/cocagne/paxos/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247123107,"owners_count":20887261,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-17T19:16:04.583Z","updated_at":"2025-04-04T05:08:38.718Z","avatar_url":"https://github.com/cocagne.png","language":"Python","funding_links":[],"categories":["分布式开发"],"sub_categories":[],"readme":"Essential Paxos \n===============\nTom Cocagne \u0026lt;tom.cocagne@gmail.com\u0026gt;  \nv2.0, January 2013\n\n\nIntroductory Note\n-----------------\n\nThis repository contains the results of my first foray into providing both a\nuseful and educational Paxos implementation. The repository is in pretty good\nshape and still fills its intended role but the design includes explicit\nsupport for sending network messages. I now consider this something of an\nanti-pattern for Paxos implementations and recommend using an even more tightly\nconstrained library that implements the core algorithm and nothing else,\nincluding messaging. To that end, I've put together the\n[python-composable-paxos](https://github.com/cocagne/python-composable-paxos)\nrepository and a\n[multi-paxos-example](https://github.com/cocagne/multi-paxos-example) based upon\nit. Those repositories should generally be preferred over this one.\nAdditionally, I've written an [introductory paper on Paxos and\nMulti-Paxos](https://understandingpaxos.wordpress.com/) that may be useful for\nindividuals like myself that find the existing papers somewhat opaque.\n\n\nOverview\n--------\n\nEssential Paxos provides basic implementations of the Paxos algorithm. The\ndistinguishing characteristic of this implementation, as compared to other\nfreely available and open-source implementations, is that this library is\nindependent of application domains and networking infrastructures. Whereas most\nPaxos implementations are deeply and inextricably embedded within\napplication-specific logic, this implementation focuses on encapsulating the\nPaxos algorithm within opaque and easily re-usable classes.\n\nThis library provides an algorithmically correct Paxos implementation that may\nbe used for educational purposes in addition to direct use in networked\napplications. This implementation is specifically designed to facilitate\nunderstanding of both the essential Paxos algorithm as well as the practical\nconsiderations that must be taken into account for real-world use.\n\nImplementations in both Python and Java are provided. \n\n\nPython Installation\n-------------------\n\n```bash\n$ easy_install essential-paxos\n```\n\n\nImplementations\n---------------\n\n### Python\n\n\n#### essential.py\n\n\nThis module provides a direct and minimal implementation of the essential Paxos\nalgorithm. The primary purpose of this module is educational as it allows for\neasy contrast between the implementation of the pure algorithm and that of the\none enhanced for practicality.\n\n\n#### practical.py\n\n\nThis module enhances the essential Paxos algorithm and adds support for such\nthings as leadership tracking, NACKs, and state persistence.\n\n\n#### functional.py\n\n\nThis module provides a fully-functional Paxos implementation that employs\na simple heartbeating mechanism to detect leadership failure and initiate\nrecovery.\n\n\n#### external.py\n\nThis module provides an enhanced version of practical.py that supports\nthe use of external failure detectors to drive leadership management. This module\ndoes not provide a fully-functional solution to leadership management, as does\nfunctional.py. However, it may serve as the basis for much more flexible, \napplication-specific leadership management.\n\n\n#### durable.py\n\n\nCorrect implementations of the Paxos algorithm require saving Acceptor\nstate to persistent media prior to sending Promise and Accepted messages over the \nnetwork. This is necessary to ensure that promises made to external entities\nwill never be reneged upon should the application crash and recover at an\ninopportune time. This module implements a very simple mechanism for efficiently\nsaving application state to disk. \n\n\n### Java\n\nThe Java implementation is functionally identical to that of the Python\nimplementation and is broken out into Java packages that mirror the \npython modules. Refer to the corresponding Python APIs for class and\nmethod documentation.\n\n#### cocagne.paxos.essential\n#### cocagne.paxos.practical\n#### cocagne.paxos.functional\n\n\n\nTesting\n-------\n\nThe `test` directory of the root source code repository contains the unittest\nfiles used to exercise the implementation. The *primary* tests are written in\nPython and correspond to the essential, practical, functional, and durable\nmodules. The Java tests, which are also written in Python, wrap the Java classes\nwith a compatible interface and use the Python unit tests to exercise the Java\nimplementation. The Jython interpreter is required for running these tests but\nit is not required at runtime.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcocagne%2Fpaxos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcocagne%2Fpaxos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcocagne%2Fpaxos/lists"}