This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Architecture

Lockval Engine core:

gw: provides the function of synchronizing data with the front end

api: Provide multiple languages to support your program logic development.

db: implements acid database

trigger: provides a method for external access to Locval Engine

Lockval Engine base architecture:

architecture

1 - api

The api provides support for multiple languages at the application layer. And is closely related to gw and db. Achieve consistent reading and modification of data.

2 - db

The db provides an interface for obtaining and modifying data for the API. The db locks the data when the api gets the data, and unlocks the data after modifying the data

3 - gw

gw is connected to the front end through websocket.

The front end can send the request protocol through gw and receive the returned result.

And gw will automatically synchronize the results of modifying the database at the back end to the front end.

4 - trigger

Triggers provide the following functionality:

(cron) cron periodically executes api scripts (debug) Upload the script directly via http and execute it (timer) Timers provided to api scripts (caller) Execute the api script through the http interface

about ‘config.yaml’

config.yaml is the trigger configuration file.

key: 1111 # update this file and (cron) password
pwd: 2222 # (debug) password
chk: 3333 # (caller) password

task:
  life:
    sayHi: usr/testChat 0 */1 * * * * {"text":"I am TriggerCron. Hi"}
    SayBye: usr/testChat 30 */1 * * * * {"text":"I am TriggerCron. Bye"}

inst:
  life:
    - worldBoss:1
    - worldBoss:2
  • key: 1111 # update this file and (cron) password
  • pwd: 2222 # (debug) password
  • chk: 3333 # (caller) password

trigger http api

# update config.yaml
curl --insecure "https://localhost:59102/upd?key=admin" -X POST --data-binary @config_new.yaml
# cat config.yaml
curl --insecure "https://localhost:59102/cat?key=admin"
# execute a task of an instance
curl --insecure "https://localhost:59102/cmd?key=admin&inst=life&task=sayHi"

# update and debug script
curl --insecure "https://localhost:59102/js?pwd=admin" -X POST --data-binary @main.js
curl --insecure "https://localhost:59102/lua?pwd=admin" -X POST --data-binary @main.lua
curl --insecure "https://localhost:59102/star?pwd=admin" -X POST --data-binary @main.star

# call a script function
curl --insecure "http://localhost:59102/call?chk=3333&uid=???&cmd=sys/testItsTime" -X POST -d '{"n":1}'