Overview TOP Usage

Details

This chapter consists of two parts; one is how to enable k2htp_mdtor(aka K2HTPMDTOR); another is details on K2HTPMDTOR’s configuration file.

How to enable K2HTPMDTOR

You are simply required two steps to enable it.

  1. Load it in memory by calling the load function.
  2. Enable transaction by calling the enable function.

Load K2HTPMDTOR

K2HTPMDTOR is a shared library to handle K2HASH transaction logs. An application loads K2HTPMDTOR by calling the following API. The APIs are currently available in C and C++. Read the each API reference for details.

Enable transaction

Once you have successfully loaded K2HTPMDTOR, the next step is to tell K2HASH to enable transaction logging by calling the following API. You will see the K2HASH API requires a K2HTPMDTOR configuration file path in the API documents. Don’t worry about it. I describe the configuration file in the next section. You should only recognize the API requires the path in this section.

Configuration file of K2HTPMDTOR

This section describes configuration file formats and its parameters. The configuration file determines the K2HTPMDTOR’s behavior; how K2HTPMDTOR controls transaction plugins.

Configuration file formats

INI, JSON and YAML are supported file formats. See the following examples. I will describe parameters in them at the next section.

Assume making your own configuration file. As you see in the previous section, you will pass the file path into the K2HShm::EnableTransaction’s first parameter if you implement your application in C++. If you implement your application in C, you will pass it to the k2h_enable_transaction_param’s second parameter.

Configuration file parameters

This section describes parameters in K2HTPMDTOR’s configuration file. You might see examples above if you haven’t seen any of them yet.

A K2HTPMDTOR configuration file consists of two sections:

  1. K2HTPMDTOR
    In this section, you tell K2HTPMDTOR the way to call transaction plugins. See K2HTPMDTOR section below for details.
  2. K2HTPMDTOR_TP
    In this section, you tell K2HTPMDTOR each transaction plugin’s path. See K2HTPMDTOR_TP section below for details.

K2HTPMDTOR

A directive in this section determines how K2HTPMDTOR invokes transaction plugins and how it processes results from them.

section directive value optional
K2HTPMDTOR RUN_MODE ALL invokes all transaction plugins in sequence.
RANDOM invokes a transaction plugin method randomly selected.
UNTIL_SUCCESS stops invoking transaction plugin methods if a method returns a success .
UNTIL_FAILURE stops invoking transaction plugin methods if a method returns a failure.
No

K2HTPMDTOR_TP

Directives in this section determine where transaction plugins and their configuration files exist.

section directive value optional
K2HTPMDTOR_TP TPPATH The path to a transaction plugin. libk2htpdtor.so is the default value. Yes
K2HTPMDTOR_TP TPCONF The configuration path to a transaction plugin. No
Overview TOP Usage