Skip to content

OnizukaLab/dejima-prototype

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dejima Prototype

How to run

This prototype uses docker and is implemented by setting up a DB (PostgreSQL) container and a proxy server container that controls Dejima-related processing for each peer. This prototype is set to realize a ride-sharing alliance application. A container will be created by executing docker-compose up command in the top directory after cloning this repository. After creating the container, if you perform various update operations on the base table of the postgreSQL container of each started peer, data sharing will be performed via the Dejima table.

If you want to realize an application other than the ride-sharing alliance, please set it properly according to How to build a new application below, and then start the container by the same procedure as above.

How to build a new application

When setting up a new application, the files should be edited and set up as follows.

  • /docker-compose.yml
  • /proxy/dejima_config.json
  • /db/setup_files/[peer name]
    • SQL file for initialization
    • SQL file for BIRDS trigger generation
    • basetable_list.txt

Please refer to the contents below for detailed editing. For each peer name or Dejima table name, be sure to use the same string in each setting. In addition, please do not include underscore in a peer name.

docker-compose.yml

Please set up the following items properly. For details, please refer to the docker-compose.yml for the ride-sharing alliance in this repository.

Proxy server

  • container_name : [peer name]-proxy (used as address for inter-container communication)
  • environment > PEER_NAME : peer name

DB

  • container_name : [peer name]-db (used as address for inter-container communication)
  • environment > PEER_NAME : peer name
  • environment > DEJIMA_EXECUTION_ENDPOINT : [peer name]-proxy:8000/execution
  • environment > DEJIMA_TERMINATION_ENDPOINT : [peer name]-proxy:8000/terminate

proxy/dejima_config.json

This is the configuration file in each peer for the following information. Please refer to the proxy/dejima_config.json in this repository and set it properly.

  • The Dejima tables of the Dejima groups in which this peer participates
  • The base tables of this peer
  • The address of proxy server for each peer

SQL files for base table definition, etc.

Please place the SQL files for the definition of base tables under db/setup_files/[peer name]. The SQL files in this directory are processed only once when each DB is started. Note that they are processed in alphabetical order.

Generating SQL files for BIRDS trigger generation

Please use BIRDS to generate a set of triggers to make the Dejima table updatable. Please write your own update strategy to create a new application, and then compile it into a SQL file using BIRDS. The options required when executing the BIRDS command are as follows.

  • -f [file_path] Please give the path of the datalog file that describes the update strategy as an argument.
  • --dejiima
  • -b [file_path] For this option, prepare the following shell script file, and then give its path as an argument.
#!/bin/sh

result=$(curl -s -X POST -H "Content-Type: application/json" $DEJIMA_EXECUTION_ENDPOINT -d "$1")
if  [ "$result" = "true" ];  then
    echo "true"
else 
    echo $result
fi

SQL file configuration for triggers generated by BIRDS

Create a db/setup_files/[peer name] directory for the peer you want to configure, and place the SQL file generated by BIRDS to define the Dejima table in this directory. Note that db/setup_files/common contains the SQL files that should be executed in common to all peers. So please be careful and do not delete it.

db/setup_file/[peer name]/basetable_list.txt

Describe the base table defined in each peer in this file. Write one table per row.

How to execute a transaction

When executing a transaction, be sure to add the FOR SHARE keyword to the SELECT statements. This allows the execution of serializable transactions throughout the Dejima system.

Restrictions

  • Users cannot update the Dejima table directly. Be sure to update only the base table.
  • Please use a user name other than 'dejima' when connecting to PostgreSQL (because 'dejima' is used to distinguish connections by proxy servers).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages