Design - gquintana/beepbeep GitHub Wiki
Design
Pipeline
All the script execution is ran through an event pipeline
- ScriptScanner: scans the file system or the scan and look for scripts
- StoreFilter: skips a script if it's marked as ran in script store
- ScriptReader: Read the script line by line
- StoreUpdate: Mark the script as started or ended in the script store
- VariableReplacer: Replace
${variable}
by its value in the script - MultineAggregator: Aggregates several lines into on query|request|statement detecting start|end markers
- EmptyFilter: skips empty or blank query|request|statement
- Executor: execute query|request|statement on target data store
- Display or export execute query|request|statement result
Script store
Script store is optional. It's used to remember which script were ran and what was the outcome of of their execution.
CREATE TABLE BEEPBEEP (
ID INT PRIMARY KEY AUTO_INCREMENT,
VERSION INT NOT NULL DEFAULT 1, -- For optimistic locking
FULL_NAME VARCHAR(512) NOT NULL, -- Script complete path
SIZE_BYTES INT NOT NULL, -- Script size in bytes
SHA1 VARCHAR(128) NOT NULL, -- Script SHA1 check sum
START_DATE TIMESTAMP NOT NULL, -- Execution start timestamp
END_DATE TIMESTAMP, -- Execution end timestamp
STATUS VARCHAR(16); -- Execution status STARTED, SUCCEEDED, FAILED
CREATE UNIQUE INDEX BEEPBEEP_FULL_NAME_IDX ON BEEPBEEP(FULL_NAME);
By default, script size and SHA1 can not change. There are a couple of settings on the StoreFilter to change that.
At the moment, if you need to change a script, you'll have to manually remove the line from the store.