Skip to content

bsc-s2/lua-acid

Repository files navigation

Name

lua-acid

Status

This library is in beta phase.

It is deployed in a production envinroment and has been running stably. But it still requires more tests and docs.

Description

lua-acid is a colleciton of lua utility functions and a classic paxos implementation.

It is meant to be a underlaying code base for building a distributed system.

Modules

name description status
acid.async_cache shared-dict based cache, update asynchronously. well tested
acid.chash consistent hash module. well tested
acid.counter hot event counter. well tested
acid.strutil string operation functions. well tested
acid.tableutil table operation functions. well tested
acid.unittest unittest engine that looks for test functions in a dir. well tested
acid.utf8 utf8 encoding and decoding. well tested
acid.xml xml to table and table to xml. well tested
acid.cache in-process or shared-dict based cache. not well tested
acid.cluster cluster implementation based on paxos. not well tested
acid.logging logging utilities. not well tested
acid.paxos classic paxos implementation. not well tested

Install

  • Choice 0: Clone and copy:

    git clone [email protected]:baishancloud/lua-acid.git
    cp -R lua-acid/lib/acid <your_lua_lib_path>
    
  • Choice 1: git-subrepo

    Use git-subrepo to add it to your source code base:

    1. Install git-subrepo

    2. Create config file .gitsubrepo in your git project:

      [ remote: https://github.com/ ]
      lualib/acid     baishancloud/lua-acid   master lib/acid
      
    3. Fetch and merge lua-acid into your working dir:

      git-subrepo
      

Test

This package needs perl command prove to run unittest:

# install in centos 7
$ yum install -y perl-CPAN perl-Test-Harness

run test:

$ sudo cpan Test::Nginx

# optional, setup nginx path:
$ export PATH=$PATH:/usr/local/Cellar/openresty/1.11.2.3/nginx/sbin

# test all
$ prove

# test modules with verbose mode
# prove t/ngx_abort_test.t t/ngx_abort.t -v

check nginx.conf and logs used in test under t/servroot/conf, t/servroot/logs.

lua-poxos

Classic Paxos implementation in lua.

Nginx cluster management based on paxos.

Feature:

  • Classic two phase paxos algorithm.

  • Optional phase-3 as phase 'learn' or 'commit'

  • Support membership changing on the fly.

    This is archived by making the group members a paxos instance. Running paxos on group member updates group membership.

    Here we borrowed the concept 'view' that stands for a single version of membership.

    'view' is a no more than a normal paxos instance.

Author

Zhang Yanpo (张炎泼) [email protected]

Copyright and License

The MIT License (MIT)

Copyright (c) 2015 Zhang Yanpo (张炎泼) [email protected]