github.com/voedger/voedger@v0.0.0-20240520144910-273e84102129/design/commandprocessor/README.md (about) 1 # Command Processor 2 ## Architecture 3 ```mermaid 4 erDiagram 5 AppSchema ||--|{ TableSpec: declares 6 UserDefinedCmdFunctionSpec { 7 string Name 8 schema ArgumentObjectSchema 9 schema ResultObjectSchema 10 func Func 11 } 12 UserDefinedValidatorSpec { 13 string Name 14 schema ArgumentObjectSchema 15 func Func 16 } 17 AppSchema ||--|{ UserDefinedCmdFunctionSpec: declares 18 AppSchema ||--|{ UserDefinedValidatorSpec: declares 19 UserDefinedCmdFunctionSpec ||--|| UserDefinedCmdFunction: "used to build" 20 UserDefinedValidatorSpec ||--|| UserDefinedValidator: "used to build" 21 UserDefinedValidator ||--|| Validator: is 22 TableSpec ||--|| CUDFunc: "used by" 23 CUDFunc ||--|| BuiltinCmdFunction: is 24 BuiltinCmdFunction }|--|| CommandFunction: is 25 UserDefinedCmdFunction ||--|| CommandFunction: is 26 CommandFunction ||--|| State: "reads from Storages using" 27 CommandFunction ||--|| Arg: "reads from" 28 CommandFunction ||--o{ Intents: "prepares" 29 CommandFunction ||--|| Result: "returns" 30 Result ||--|| CommandProcessor: "returned by" 31 Intents }o--|| CommandProcessor: "applied by" 32 Arg ||--|| CommandProcessor: "provided by" 33 State ||--|{ StateStorage: "reads from" 34 State ||--|| CommandProcessor: "provided by" 35 CommandFunction }|--|| CommandProcessor: "executed by" 36 Validator }|--|| CommandProcessor: "executed by" 37 CommandProcessor ||--|{ StateStorage: "applies intents to" 38 CommandProcessor ||--|{ ExtensionEngine: uses 39 ExtensionEngine }|--|| VVM: "provided by" 40 CommandProcessor }|--|| VVM: "created by" 41 CommandProcessor }|--|| Bus_HTTPProcessor: "called by" 42 Bus_HTTPProcessor ||--|| VVM: "created by" 43 ``` 44 ## Notes 45 - Command Function can only generate IIntents of one type (CUDs). 46 - `cuds: [...]` is not a part of ANY command anymore 47 - `c.sys.CUD` is not available anymore as a separate function 48 49 ## Rest API 50 - Every App's Table is represented by separate Rest API resource which internally executes sys.CUD command: 51 - POST `/api/rest/<wsid>/<table_qname>` 52 - batch operations supported: request is a Record OR array of Records; 53 - record may include child records; 54 - GET `/api/rest/<wsid>/<table_qname>/<id>` 55 - a Record with it's child records is returned (ex. CDoc); 56 - PATCH `/api/rest/<wsid>/<table_qname>/<id>` 57 - record may include child records; 58 - Every App's Command represented by separate Rest API resource 59 - POST `/api/rest/<wsid>/<cmd_qname>` 60 61