Details TOP Build

Usage

This chapter instructs how to use a k2htp_mdtor(aka K2HTPMDTOR) example at the K2HTPMDTOR repository on GitHub. Only two steps are enough to run the example code.

  1. Install K2HTPMDTOR
  2. Run the example code

Install mdtor

This section instructs how to install binary packages. Read the Build page if you want to build the binary from the source code.

For recent Debian-based Linux distributions users, follow the steps below:

$ sudo apt-get update -y
$ sudo apt-get install curl -y
$ curl -s https://packagecloud.io/install/repositories/antpickax/stable/script.deb.sh \
    | sudo bash
$ sudo apt-get install k2htpmdtor

For users who use supported Fedora other than latest version, follow the steps below:

$ sudo dnf makecache
$ sudo dnf install curl -y
$ curl -s https://packagecloud.io/install/repositories/antpickax/stable/script.rpm.sh \
    | sudo bash
$ sudo dnf install k2htpmdtor -y

For other recent RPM-based Linux distributions users, follow the steps below:

$ sudo yum makecache
$ sudo yum install curl -y
$ curl -s https://packagecloud.io/install/repositories/antpickax/stable/script.rpm.sh \
    | sudo bash
$ sudo yum install k2htpmdtor -y

Run the example code

You are simply required two steps; Clone the repository; and run the example code.

$ git clone https://github.com/yahoojapan/k2htp_mdtor.git
$ cd k2htp_mdtor/tests
$ sh test.sh
                                                                                                                                          
====== Start INI file test =================================                                                                              
------ Initialize test environment for INI file ------------   

....

====== Finish all ==========================================

RESULT --> SUCCEED

The following figure shows the simple call flow from test.sh to libk2htpmdtordmy2.so, which describes that:

  1. test.sh forks k2htpmdtortest.
  2. The main function in k2htpmdtortest loads K2HASH as a shared library.
  3. K2HASH loads K2HTPMDTOR as a shared library and pass test.ini to K2HTPMDTOR.
  4. K2HTPMDTOR reads test.ini and loads transaction plugins.
test.sh
   |
   v
 (fork) --> k2htpmdtortest
               |
               v
            (load) --> k2hash(libk2hash.so)  
                          |
                          |--> (pass) test.ini
                          |              |
                          v              v
                       (load) --> k2htp_mdtor(libk2htpmdtor.so)
                                     |
                                     v
                                   (load) --> transaction plugin(libk2htpmdtordmy.so)
                                     |
                                     v
                                   (load) --> transaction plugin(libk2htpmdtordmy2.so)
...

The sources and the settings above are available at GitHub.com:

Details TOP Build