├── .asf.yaml ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ ├── documentation_related.yml │ ├── enhancement_request.yml │ ├── feature_request.yml │ ├── question.yml │ └── unit_test.yml └── workflows │ └── ci.yml ├── LICENSE ├── Makefile ├── NOTICE ├── README.md ├── api ├── proto │ ├── workflow.pb.go │ ├── workflow.proto │ └── workflow_grpc.pb.go └── workflow.go ├── bin ├── start-workflow.sh └── stop-workflow.sh ├── cmd ├── controller │ ├── docs │ │ ├── docs.go │ │ ├── swagger.json │ │ └── swagger.yaml │ ├── main.go │ ├── request.go │ ├── response.go │ └── workflow.go └── engine │ └── main.go ├── config └── config.go ├── configs ├── controller.yaml ├── engine.yaml └── testcreateworkflow.yaml ├── distribution └── mysql-schema.sql ├── flow ├── engine.go ├── error.go └── model.go ├── go.mod ├── go.sum ├── internal ├── constants │ └── constants.go ├── dal │ ├── config.go │ ├── model │ │ ├── workflow.go │ │ └── workflow_task.go │ └── workflow.go ├── filter │ ├── data_filter.go │ └── data_filter_test.go ├── metrics │ └── metrics.go ├── protocol │ ├── meshmessage.go │ └── message.go ├── queue │ ├── eventmesh_queue.go │ ├── in_memory_queue.go │ └── queue.go ├── schedule │ ├── inline_scheduler.go │ └── scheduler.go ├── task │ ├── event_task.go │ ├── operation_task.go │ ├── switch_task.go │ └── task.go └── util │ ├── file_utils.go │ └── flow_util.go ├── licenses ├── LICENSE-github.com-OneOfOne-xxhash.txt ├── LICENSE-github.com-aliyun-alibaba-cloud-sdk-go.txt ├── LICENSE-github.com-avast-retry-go-v4.txt ├── LICENSE-github.com-beorn7-perks.txt ├── LICENSE-github.com-buger-jsonparser.txt ├── LICENSE-github.com-cespare-xxhash-v2.txt ├── LICENSE-github.com-cespare-xxhash.txt ├── LICENSE-github.com-davecgh-go-spew.txt ├── LICENSE-github.com-fsnotify-fsnotify.txt ├── LICENSE-github.com-gin-contrib-sse.txt ├── LICENSE-github.com-gin-gonic-gin.txt ├── LICENSE-github.com-go-openapi-jsonreference.txt ├── LICENSE-github.com-go-openapi-spec.txt ├── LICENSE-github.com-go-openapi-swag.txt ├── LICENSE-github.com-go-playground-locales.txt ├── LICENSE-github.com-go-playground-universal-translator.txt ├── LICENSE-github.com-go-playground-validator-v10.txt ├── LICENSE-github.com-go-sql-driver-mysql.txt ├── LICENSE-github.com-goccy-go-json.txt ├── LICENSE-github.com-gogf-gf.txt ├── LICENSE-github.com-golang-mock.txt ├── LICENSE-github.com-golang-protobuf.txt ├── LICENSE-github.com-google-go-cmp.txt ├── LICENSE-github.com-google-gofuzz.txt ├── LICENSE-github.com-google-uuid.txt ├── LICENSE-github.com-hashicorp-errwrap.txt ├── LICENSE-github.com-hashicorp-go-multierror.txt ├── LICENSE-github.com-itchyny-gojq.txt ├── LICENSE-github.com-jinzhu-inflection.txt ├── LICENSE-github.com-jinzhu-now.txt ├── LICENSE-github.com-jmespath-go-jmespath.txt ├── LICENSE-github.com-json-iterator-go.txt ├── LICENSE-github.com-leodido-go-urn.txt ├── LICENSE-github.com-lestrrat-go-strftime.txt ├── LICENSE-github.com-mattn-go-isatty.txt ├── LICENSE-github.com-matttproud-golang_protobuf_extensions.txt ├── LICENSE-github.com-modern-go-concurrent.txt ├── LICENSE-github.com-modern-go-reflect2.txt ├── LICENSE-github.com-nacos-group-nacos-sdk-go-v2.txt ├── LICENSE-github.com-panjf2000-ants.txt ├── LICENSE-github.com-pelletier-go-toml-v2.txt ├── LICENSE-github.com-pkg-errors.txt ├── LICENSE-github.com-pmezard-go-difflib.txt ├── LICENSE-github.com-prometheus-client_golang.txt ├── LICENSE-github.com-prometheus-client_model.txt ├── LICENSE-github.com-prometheus-common.txt ├── LICENSE-github.com-prometheus-procfs.txt ├── LICENSE-github.com-reactivex-rxgo-v2.txt ├── LICENSE-github.com-serverlessworkflow-sdk-go-v2.txt ├── LICENSE-github.com-sony-sonyflake.txt ├── LICENSE-github.com-stretchr-objx.txt ├── LICENSE-github.com-stretchr-testify.txt ├── LICENSE-github.com-swaggo-files.txt ├── LICENSE-github.com-swaggo-gin-swagger.txt ├── LICENSE-github.com-swaggo-swag.txt ├── LICENSE-github.com-ugorji-go.txt ├── LICENSE-go.uber.org-atomic.txt ├── LICENSE-go.uber.org-multierr.txt ├── LICENSE-go.uber.org-zap.txt ├── LICENSE-golang.org-x-crypto.txt ├── LICENSE-golang.org-x-net.txt ├── LICENSE-golang.org-x-sync.txt ├── LICENSE-golang.org-x-sys.txt ├── LICENSE-golang.org-x-text.txt ├── LICENSE-golang.org-x-time.txt ├── LICENSE-golang.org-x-tools.txt ├── LICENSE-google.golang.org-genproto.txt ├── LICENSE-google.golang.org-grpc.txt ├── LICENSE-google.golang.org-protobuf.txt ├── LICENSE-gopkg.in-ini.v1.txt ├── LICENSE-gopkg.in-natefinch-lumberjack.v2.txt ├── LICENSE-gopkg.in-yaml.v2.txt ├── LICENSE-gopkg.in-yaml.v3.txt ├── LICENSE-gorm.io-driver-mysql.txt └── LICENSE-gorm.io-gorm.txt ├── middleware └── dblock │ ├── errors.go │ ├── lock.go │ └── lock_client.go └── third_party ├── jqer ├── jqer.go └── options.go ├── lexer ├── lexer.go └── rune_stack.go └── swf ├── swf.go ├── swf_test.go └── testdata └── greeting.yaml /.asf.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | github: 19 | description: EventMesh workflow 20 | homepage: https://eventmesh.apache.org/ 21 | features: 22 | # Enable issue management 23 | issues: true 24 | # Enable wiki 25 | wiki: true 26 | labels: 27 | - pubsub 28 | enabled_merge_buttons: 29 | squash: true 30 | merge: true 31 | rebase: false 32 | protected_branches: 33 | main: 34 | required_status_checks: 35 | strict: true 36 | required_pull_request_reviews: 37 | dismiss_stale_reviews: true 38 | required_approving_review_count: 1 39 | notifications: 40 | commits: commits@eventmesh.apache.org 41 | # Send all issue emails (new, closed, comments) to issues@ 42 | issues: issues@eventmesh.apache.org 43 | # Send new/closed PR notifications to dev@ 44 | pullrequests_status: dev@eventmesh.apache.org 45 | # Send individual PR comments/reviews to issues@ 46 | pullrequests_comment: issues@eventmesh.apache.org 47 | jira_options: link label worklog 48 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | name: Bug report 19 | title: "[Bug] Bug title" 20 | description: If something isn't working as expected. 21 | labels: [ "bug" ] 22 | body: 23 | - type: markdown 24 | attributes: 25 | value: | 26 | For better global communication, Please write in English. 27 | 28 | - type: checkboxes 29 | attributes: 30 | label: Search before asking 31 | description: > 32 | Please make sure to search in the [issues](https://github.com/apache/eventmesh-workflow/issues?q=is%3Aissue) 33 | first to see whether the same issue was reported already. 34 | options: 35 | - label: > 36 | I had searched in the [issues](https://github.com/apache/eventmesh-workflow/issues?q=is%3Aissue) and found 37 | no similar issues. 38 | required: true 39 | 40 | - type: dropdown 41 | attributes: 42 | label: Environment 43 | description: Describe the environment. 44 | options: 45 | - Mac 46 | - Windows 47 | - Linux 48 | - Other 49 | validations: 50 | required: true 51 | 52 | - type: textarea 53 | attributes: 54 | label: What happened 55 | description: Describe what happened. 56 | placeholder: > 57 | A clear and concise description of what the bug is. 58 | validations: 59 | required: true 60 | 61 | - type: textarea 62 | attributes: 63 | label: How to reproduce 64 | description: > 65 | Describe the steps to reproduce the bug here. 66 | placeholder: > 67 | Please make sure you provide a reproducible step-by-step case of how to reproduce the problem 68 | as minimally and precisely as possible. 69 | validations: 70 | required: true 71 | 72 | - type: textarea 73 | attributes: 74 | label: Debug logs 75 | description: Anything else we need to know? 76 | placeholder: > 77 | Add your debug logs here. 78 | validations: 79 | required: false 80 | 81 | - type: checkboxes 82 | attributes: 83 | label: Are you willing to submit PR? 84 | description: > 85 | This is absolutely not required, but we are happy to guide you in the contribution process 86 | especially if you already have a good understanding of how to implement the fix. 87 | options: 88 | - label: Yes I am willing to submit a PR! 89 | 90 | - type: markdown 91 | attributes: 92 | value: "Thanks for completing our form!" 93 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/documentation_related.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | name: Documentation Related 19 | title: "[Doc] Documentation Related" 20 | description: I find some issues related to the documentation. 21 | labels: [ "documentation" ] 22 | body: 23 | - type: markdown 24 | attributes: 25 | value: | 26 | For better global communication, Please write in English. 27 | 28 | - type: checkboxes 29 | attributes: 30 | label: Search before asking 31 | description: > 32 | Please make sure to search in the [issues](https://github.com/apache/eventmesh-workflow/issues?q=is%3Aissue) 33 | first to see whether the same issue was reported already. 34 | options: 35 | - label: > 36 | I had searched in the [issues](https://github.com/apache/eventmesh-workflow/issues?q=is%3Aissue) and found 37 | no similar issues. 38 | required: true 39 | 40 | - type: textarea 41 | attributes: 42 | label: Documentation Related 43 | description: Describe the suggestion about document. 44 | placeholder: > 45 | e.g There is a typo 46 | validations: 47 | required: true 48 | 49 | - type: checkboxes 50 | attributes: 51 | label: Are you willing to submit PR? 52 | description: > 53 | This is absolutely not required, but we are happy to guide you in the contribution process 54 | especially if you already have a good understanding of how to implement the fix. 55 | options: 56 | - label: Yes I am willing to submit a PR! 57 | 58 | - type: markdown 59 | attributes: 60 | value: "Thanks for completing our form!" -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/enhancement_request.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | name: Enhancement Request 19 | title: "[Enhancement] Enhancement title" 20 | description: I want to suggest an enhancement for this project 21 | labels: [ "enhancement" ] 22 | body: 23 | - type: markdown 24 | attributes: 25 | value: | 26 | For better global communication, Please write in English. 27 | 28 | - type: checkboxes 29 | attributes: 30 | label: Search before asking 31 | description: > 32 | Please make sure to search in the [issues](https://github.com/apache/eventmesh-workflow/issues?q=is%3Aissue) 33 | first to see whether the same issue was reported already. 34 | options: 35 | - label: > 36 | I had searched in the [issues](https://github.com/apache/eventmesh-workflow/issues?q=is%3Aissue) and found 37 | no similar issues. 38 | required: true 39 | 40 | - type: textarea 41 | attributes: 42 | label: Enhancement Request 43 | description: Describe the suggestion. 44 | placeholder: > 45 | First of all: Have you checked the docs GitHub issues whether someone else has already reported your issue? 46 | validations: 47 | required: true 48 | 49 | - type: textarea 50 | attributes: 51 | label: Describe the solution you'd like 52 | description: Describe the suggestion. 53 | placeholder: > 54 | A clear and concise description of what you want to happen. Add any considered drawbacks. 55 | validations: 56 | required: true 57 | 58 | - type: checkboxes 59 | attributes: 60 | label: Are you willing to submit PR? 61 | description: > 62 | This is absolutely not required, but we are happy to guide you in the contribution process 63 | especially if you already have a good understanding of how to implement the fix. 64 | options: 65 | - label: Yes I am willing to submit a PR! 66 | 67 | - type: markdown 68 | attributes: 69 | value: "Thanks for completing our form!" -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | name: Feature Request 19 | title: "[Feature] Feature title" 20 | description: I want to suggest a feature for this project. 21 | labels: [ "feature" ] 22 | body: 23 | - type: markdown 24 | attributes: 25 | value: | 26 | For better global communication, Please write in English. 27 | 28 | - type: checkboxes 29 | attributes: 30 | label: Search before asking 31 | description: > 32 | Please make sure to search in the [issues](https://github.com/apache/eventmesh-workflow/issues?q=is%3Aissue) 33 | first to see whether the same issue was reported already. 34 | options: 35 | - label: > 36 | I had searched in the [issues](https://github.com/apache/eventmesh-workflow/issues?q=is%3Aissue) and found 37 | no similar issues. 38 | required: true 39 | 40 | - type: textarea 41 | attributes: 42 | label: Feature Request 43 | description: Describe the feature. 44 | placeholder: > 45 | First of all: Have you checked the docs GitHub issues whether someone else has already reported your issue? 46 | Maybe the feature already exists? 47 | validations: 48 | required: true 49 | 50 | - type: checkboxes 51 | attributes: 52 | label: Are you willing to submit PR? 53 | description: > 54 | This is absolutely not required, but we are happy to guide you in the contribution process 55 | especially if you already have a good understanding of how to implement the fix. 56 | options: 57 | - label: Yes I am willing to submit a PR! 58 | 59 | - type: markdown 60 | attributes: 61 | value: "Thanks for completing our form!" 62 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | name: Question 19 | title: "[Question] Question title" 20 | description: I have a question that isn't answered in docs or issue. 21 | labels: [ "question" ] 22 | body: 23 | - type: markdown 24 | attributes: 25 | value: | 26 | For better global communication, Please write in English. 27 | 28 | - type: checkboxes 29 | attributes: 30 | label: Search before asking 31 | description: > 32 | Please make sure to search in the [issues](https://github.com/apache/eventmesh-workflow/issues?q=is%3Aissue) 33 | first to see whether the same issue was reported already. 34 | options: 35 | - label: > 36 | I had searched in the [issues](https://github.com/apache/eventmesh-workflow/issues?q=is%3Aissue) and found 37 | no similar issues. 38 | required: true 39 | 40 | - type: textarea 41 | attributes: 42 | label: Question 43 | description: Describe your question. 44 | placeholder: > 45 | Describe your question here: 46 | validations: 47 | required: true 48 | 49 | - type: markdown 50 | attributes: 51 | value: "Thanks for completing our form!" 52 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/unit_test.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | name: Unit Test 19 | title: "[Unit Test] Unit test title" 20 | description: I want to do some unit tests for this project 21 | labels: [ "testing" ] 22 | body: 23 | - type: markdown 24 | attributes: 25 | value: | 26 | For better global communication, Please write in English. 27 | 28 | - type: checkboxes 29 | attributes: 30 | label: Search before asking 31 | description: > 32 | Please make sure to search in the [issues](https://github.com/apache/eventmesh-workflow/issues?q=is%3Aissue) 33 | first to see whether the same issue was reported already. 34 | options: 35 | - label: > 36 | I had searched in the [issues](https://github.com/apache/eventmesh-workflow/issues?q=is%3Aissue) and found 37 | no similar issues. 38 | required: true 39 | 40 | - type: textarea 41 | attributes: 42 | label: Unit test request 43 | description: Describe the unit test. 44 | placeholder: > 45 | First of all: Have you checked the docs GitHub issues whether someone else has already reported your issue? 46 | Maybe the unit tests you want to do have already been done? 47 | validations: 48 | required: true 49 | 50 | - type: textarea 51 | attributes: 52 | label: Describe the unit tests you want to do 53 | description: Describe the unit test. 54 | value: | 55 | Module name: 56 | Located at: 57 | Task status: ×(unfinished) / √(finished) 58 | | Task Status | Class | Type | 59 | | :------: | :------ | :------ | 60 | | × | xxxxxx | xxxxxx | 61 | validations: 62 | required: true 63 | 64 | - type: checkboxes 65 | attributes: 66 | label: Are you willing to submit PR? 67 | description: > 68 | This is absolutely not required, but we are happy to guide you in the contribution process 69 | especially if you already have a good understanding of how to implement the fix. 70 | options: 71 | - label: Yes I am willing to submit a PR! 72 | 73 | - type: markdown 74 | attributes: 75 | value: "Thanks for completing our form!" -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | 20 | name: CI 21 | 22 | on: 23 | push: 24 | branches: ['*'] 25 | pull_request: 26 | branches: ['*'] 27 | 28 | jobs: 29 | golangci: 30 | strategy: 31 | matrix: 32 | go: [1.17] 33 | os: [macos-latest, ubuntu-latest] 34 | name: Lint 35 | runs-on: ${{ matrix.os }} 36 | steps: 37 | - uses: actions/checkout@v3 38 | - uses: actions/setup-go@v4 39 | with: 40 | go-version: ${{ matrix.go }} 41 | cache: false 42 | - name: golangci-lint 43 | uses: golangci/golangci-lint-action@v3 44 | with: 45 | # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. 46 | version: latest 47 | 48 | license-check: 49 | name: License Check 50 | runs-on: ubuntu-latest 51 | 52 | steps: 53 | - name: Checkout repository 54 | uses: actions/checkout@v3 55 | 56 | - name: Check license header 57 | uses: apache/skywalking-eyes@main 58 | env: 59 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | lint: 18 | golangci-lint run --tests=false 19 | build: 20 | CGO_ENABLED=0 go build -o bin/eventmesh-workflow 21 | # goimports 22 | # -e report all errors (not just the first 10 on different lines) 23 | # -d display diffs instead of rewriting files 24 | # -local put imports beginning with this string after 3rd-party packages; comma-separated list 25 | # gofmt 26 | # -e report all errors (not just the first 10 on different lines) 27 | # -d display diffs instead of rewriting files 28 | # -s simplify code 29 | # -w write result to (source) file instead of stdout 30 | fmt: 31 | find . -name "*.go" | xargs goimports -e -d -local git.code.oa.com -w && \ 32 | find . -name "*.go" | xargs gofmt -e -d -s -w 33 | test: 34 | go test -v ./... -gcflags "all=-N -l" 35 | 36 | cover: 37 | go test ./... -gcflags "all=-N -l" --covermode=count -coverprofile=cover.out.tmp 38 | cat cover.out.tmp | grep -v "_mock.go" | grep -v ".pb.go" > cover.out 39 | rm cover.out.tmp 40 | go tool cover -html=cover.out -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Apache EventMesh Workflow 2 | Copyright 2021-2023 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # eventmesh-workflow 2 | Apache eventmesh 3 | -------------------------------------------------------------------------------- /api/proto/workflow.proto: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | syntax = "proto3"; 19 | 20 | package eventmesh.workflow.api.protocol; 21 | 22 | option java_multiple_files = true; 23 | option java_package="org.apache.eventmesh.common.protocol.workflow.protos"; 24 | option java_outer_classname = "EventmeshWorkflowGrpc"; 25 | 26 | option go_package = "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/api/proto"; 27 | 28 | service Workflow { 29 | rpc Execute (ExecuteRequest) returns (ExecuteResponse) {} 30 | } 31 | 32 | message ExecuteRequest { 33 | string id = 1; 34 | string instance_id = 2; 35 | string task_instance_id = 3; 36 | string input = 4; 37 | } 38 | 39 | message ExecuteResponse { 40 | string instance_id = 1; 41 | } 42 | -------------------------------------------------------------------------------- /api/proto/workflow_grpc.pb.go: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed to the Apache Software Foundation (ASF) under one or more 3 | // contributor license agreements. See the NOTICE file distributed with 4 | // this work for additional information regarding copyright ownership. 5 | // The ASF licenses this file to You under the Apache License, Version 2.0 6 | // (the "License"); you may not use this file except in compliance with 7 | // the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | 17 | // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 18 | // versions: 19 | // - protoc-gen-go-grpc v1.2.0 20 | // - protoc v3.17.3 21 | // source: workflow.proto 22 | 23 | package proto 24 | 25 | import ( 26 | context "context" 27 | grpc "google.golang.org/grpc" 28 | codes "google.golang.org/grpc/codes" 29 | status "google.golang.org/grpc/status" 30 | ) 31 | 32 | // This is a compile-time assertion to ensure that this generated file 33 | // is compatible with the grpc package it is being compiled against. 34 | // Requires gRPC-Go v1.32.0 or later. 35 | const _ = grpc.SupportPackageIsVersion7 36 | 37 | // WorkflowClient is the client API for Workflow service. 38 | // 39 | // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. 40 | type WorkflowClient interface { 41 | Execute(ctx context.Context, in *ExecuteRequest, opts ...grpc.CallOption) (*ExecuteResponse, error) 42 | } 43 | 44 | type workflowClient struct { 45 | cc grpc.ClientConnInterface 46 | } 47 | 48 | func NewWorkflowClient(cc grpc.ClientConnInterface) WorkflowClient { 49 | return &workflowClient{cc} 50 | } 51 | 52 | func (c *workflowClient) Execute(ctx context.Context, in *ExecuteRequest, opts ...grpc.CallOption) (*ExecuteResponse, error) { 53 | out := new(ExecuteResponse) 54 | err := c.cc.Invoke(ctx, "/eventmesh.workflow.api.protocol.Workflow/Execute", in, out, opts...) 55 | if err != nil { 56 | return nil, err 57 | } 58 | return out, nil 59 | } 60 | 61 | // WorkflowServer is the server API for Workflow service. 62 | // All implementations must embed UnimplementedWorkflowServer 63 | // for forward compatibility 64 | type WorkflowServer interface { 65 | Execute(context.Context, *ExecuteRequest) (*ExecuteResponse, error) 66 | mustEmbedUnimplementedWorkflowServer() 67 | } 68 | 69 | // UnimplementedWorkflowServer must be embedded to have forward compatible implementations. 70 | type UnimplementedWorkflowServer struct { 71 | } 72 | 73 | func (UnimplementedWorkflowServer) Execute(context.Context, *ExecuteRequest) (*ExecuteResponse, error) { 74 | return nil, status.Errorf(codes.Unimplemented, "method Execute not implemented") 75 | } 76 | func (UnimplementedWorkflowServer) mustEmbedUnimplementedWorkflowServer() {} 77 | 78 | // UnsafeWorkflowServer may be embedded to opt out of forward compatibility for this service. 79 | // Use of this interface is not recommended, as added methods to WorkflowServer will 80 | // result in compilation errors. 81 | type UnsafeWorkflowServer interface { 82 | mustEmbedUnimplementedWorkflowServer() 83 | } 84 | 85 | func RegisterWorkflowServer(s grpc.ServiceRegistrar, srv WorkflowServer) { 86 | s.RegisterService(&Workflow_ServiceDesc, srv) 87 | } 88 | 89 | func _Workflow_Execute_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 90 | in := new(ExecuteRequest) 91 | if err := dec(in); err != nil { 92 | return nil, err 93 | } 94 | if interceptor == nil { 95 | return srv.(WorkflowServer).Execute(ctx, in) 96 | } 97 | info := &grpc.UnaryServerInfo{ 98 | Server: srv, 99 | FullMethod: "/eventmesh.workflow.api.protocol.Workflow/Execute", 100 | } 101 | handler := func(ctx context.Context, req interface{}) (interface{}, error) { 102 | return srv.(WorkflowServer).Execute(ctx, req.(*ExecuteRequest)) 103 | } 104 | return interceptor(ctx, in, info, handler) 105 | } 106 | 107 | // Workflow_ServiceDesc is the grpc.ServiceDesc for Workflow service. 108 | // It's only intended for direct use with grpc.RegisterService, 109 | // and not to be introspected or modified (even as a copy) 110 | var Workflow_ServiceDesc = grpc.ServiceDesc{ 111 | ServiceName: "eventmesh.workflow.api.protocol.Workflow", 112 | HandlerType: (*WorkflowServer)(nil), 113 | Methods: []grpc.MethodDesc{ 114 | { 115 | MethodName: "Execute", 116 | Handler: _Workflow_Execute_Handler, 117 | }, 118 | }, 119 | Streams: []grpc.StreamDesc{}, 120 | Metadata: "workflow.proto", 121 | } 122 | -------------------------------------------------------------------------------- /api/workflow.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package api 17 | 18 | import ( 19 | "context" 20 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/flow" 21 | "github.com/gogf/gf/util/gconv" 22 | 23 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/api/proto" 24 | ) 25 | 26 | type workflowImpl struct { 27 | proto.UnimplementedWorkflowServer 28 | engine *flow.Engine 29 | } 30 | 31 | func NewWorkflowService() proto.WorkflowServer { 32 | var w workflowImpl 33 | w.engine = flow.NewEngine() 34 | return &w 35 | } 36 | 37 | func (s *workflowImpl) Execute(ctx context.Context, req *proto.ExecuteRequest) (*proto.ExecuteResponse, error) { 38 | var rsp proto.ExecuteResponse 39 | var param flow.WorkflowParam 40 | if err := gconv.Struct(req, ¶m); err != nil { 41 | return nil, err 42 | } 43 | if len(req.InstanceId) != 0 { 44 | return &rsp, s.engine.Transition(ctx, ¶m) 45 | } 46 | r, err := s.engine.Start(ctx, ¶m) 47 | if err != nil { 48 | return nil, err 49 | } 50 | rsp.InstanceId = r 51 | return &rsp, nil 52 | } 53 | -------------------------------------------------------------------------------- /bin/start-workflow.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Licensed to Apache Software Foundation (ASF) under one or more contributor 4 | # license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright 6 | # ownership. Apache Software Foundation (ASF) licenses this file to you under 7 | # the Apache License, Version 2.0 (the "License"); you may 8 | # not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | WORKFLOW_HOME=`cd $(dirname $0)/.. && pwd` 21 | export WORKFLOW_HOME 22 | export WORKFLOW_LOG_HOME=${WORKFLOW_HOME}/logs 23 | echo "WORKFLOW_HOME : ${WORKFLOW_HOME}, WORKFLOW_LOG_HOME : ${WORKFLOW_LOG_HOME}" 24 | 25 | serverLogFile=${WORKFLOW_HOME}/logs/workflow.log 26 | serverHistoryLogFile=${WORKFLOW_HOME}/workflowHistory.log 27 | pidConf=${WORKFLOW_HOME}/bin/pid.conf 28 | serverName="eventmesh-workflow" 29 | startScriptName="start-workflow.sh" 30 | 31 | function make_logs_dir { 32 | if [ ! -e "${WORKFLOW_LOG_HOME}" ]; then mkdir -p "${WORKFLOW_LOG_HOME}"; fi 33 | } 34 | 35 | make_logs_dir 36 | 37 | #check process 38 | num=`ps -ef |grep ${serverName} |grep -v grep|wc -l` 39 | echo "`date` the num of process is $num" 40 | if [ $num -gt 0 ];then 41 | echo "the process is exist now " 42 | exit 0 43 | fi 44 | 45 | #start process 46 | nohup ./${serverName} 2>&1 | tee $serverLogFile>>$serverHistoryLogFile 2>&1 & 47 | sleep 3 48 | 49 | num=`ps -ef | grep ${serverName} | grep -v grep | wc -l` 50 | echo "the num of process after start is $num" 51 | if [ $num -lt 1 ];then 52 | echo "the process is not exit after start " 53 | exit 9 54 | fi 55 | 56 | pid=`ps -ef |grep ${serverName} |grep -v grep|head -n 1 |awk '{print $2}'` 57 | echo $pid>$pidConf 58 | exit 0 -------------------------------------------------------------------------------- /bin/stop-workflow.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Licensed to Apache Software Foundation (ASF) under one or more contributor 4 | # license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright 6 | # ownership. Apache Software Foundation (ASF) licenses this file to you under 7 | # the Apache License, Version 2.0 (the "License"); you may 8 | # not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | serverName="eventmesh-workflow" 21 | 22 | #stop process 23 | pidInfo=$(ps -ef | grep ${serverName} | grep -v grep | awk '{print $2}') 24 | echo "`date` the pid info is $pidInfo" 25 | 26 | for pid in $pidInfo;do 27 | kill -9 $pid 28 | done 29 | 30 | sleep 3 31 | 32 | #check process num 33 | num=$(ps -ef | grep ${serverName} | grep -v grep |wc -l) 34 | 35 | if [ $num -gt 0 ];then 36 | echo "`date` after stop process in force way the processNum is $num still bigger than 0" 37 | exit 9 38 | fi 39 | exit 0 -------------------------------------------------------------------------------- /cmd/controller/main.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package main 17 | 18 | import ( 19 | "fmt" 20 | "github.com/apache/incubator-eventmesh/eventmesh-server-go/config" 21 | _ "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/cmd/controller/docs" 22 | pconfig "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/config" 23 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/dal" 24 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/util" 25 | "github.com/gin-gonic/gin" 26 | swaggerFiles "github.com/swaggo/files" 27 | ginSwagger "github.com/swaggo/gin-swagger" 28 | "log" 29 | "net/http" 30 | ) 31 | 32 | type Server struct { 33 | server *gin.Engine 34 | workflow *WorkflowController 35 | } 36 | 37 | // @title Workflow API 38 | // @version 1.0 39 | // @description This is a workflow server. 40 | 41 | // @license.name Apache 2.0 42 | // @license.url http://www.apache.org/licenses/LICENSE-2.0.html 43 | func main() { 44 | s, err := initServer() 45 | if err != nil { 46 | log.Fatal("flow new server fail: " + err.Error()) 47 | } 48 | s.router() 49 | if err := s.run(); err != nil { 50 | log.Fatal("run server fail: " + err.Error()) 51 | } 52 | } 53 | 54 | func initServer() (*Server, error) { 55 | var s Server 56 | if err := s.setupConfig(); err != nil { 57 | return nil, err 58 | } 59 | if err := dal.Open(); err != nil { 60 | return nil, err 61 | } 62 | r := gin.New() 63 | r.Use(cors()).Use(gin.Recovery()) 64 | swagger(r) 65 | s.server = r 66 | s.workflow = NewWorkflowController() 67 | return &s, nil 68 | } 69 | 70 | func swagger(r *gin.Engine) { 71 | r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler)) 72 | } 73 | 74 | func cors() gin.HandlerFunc { 75 | return func(c *gin.Context) { 76 | method := c.Request.Method 77 | origin := c.Request.Header.Get("Origin") 78 | if origin != "" { 79 | c.Header("Access-Control-Allow-Origin", "*") 80 | c.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE, UPDATE") 81 | c.Header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, "+ 82 | "Authorization") 83 | c.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, "+ 84 | "Access-Control-Allow-Headers, Cache-Control, Content-Language, Content-Type") 85 | c.Header("Access-Control-Allow-Credentials", "true") 86 | } 87 | if method == "OPTIONS" { 88 | c.AbortWithStatus(http.StatusNoContent) 89 | } 90 | c.Next() 91 | } 92 | } 93 | 94 | func (s *Server) router() { 95 | s.server.POST("/workflow", s.workflow.Save) 96 | s.server.GET("/workflow", s.workflow.QueryList) 97 | s.server.GET("/workflow/:workflowId", s.workflow.QueryDetail) 98 | s.server.DELETE("/workflow/:workflowId", s.workflow.Delete) 99 | s.server.GET("/workflow/instances", s.workflow.QueryInstances) 100 | } 101 | 102 | func (s *Server) setupConfig() error { 103 | config.ServerConfigPath = "./configs/controller.yaml" 104 | // compatible local environment 105 | if !util.Exists(config.ServerConfigPath) { 106 | config.ServerConfigPath = "../configs/controller.yaml" 107 | } 108 | // compatible deploy environment 109 | if !util.Exists(config.ServerConfigPath) { 110 | config.ServerConfigPath = "../conf/controller.yaml" 111 | } 112 | cfg, err := config.LoadConfig(config.ServerConfigPath) 113 | if err != nil { 114 | return err 115 | } 116 | config.SetGlobalConfig(cfg) 117 | if err := config.Setup(cfg); err != nil { 118 | return err 119 | } 120 | return pconfig.Setup(config.ServerConfigPath) 121 | } 122 | 123 | func (s *Server) run() error { 124 | return s.server.Run(fmt.Sprintf(":%d", config.GlobalConfig().Server.Port)) 125 | } 126 | -------------------------------------------------------------------------------- /cmd/controller/request.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package main 17 | 18 | import "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/dal/model" 19 | 20 | // SaveWorkflowRequest save workflow request body 21 | type SaveWorkflowRequest struct { 22 | Workflow model.Workflow `json:"workflow"` 23 | } 24 | 25 | // QueryWorkflowsRequest query workflow list request body 26 | type QueryWorkflowsRequest struct { 27 | WorkflowID string `form:"workflow_id" json:"workflow_id"` 28 | Status int `form:"status" json:"status"` 29 | Page int `form:"page" json:"page"` // page num 30 | Size int `form:"size" json:"size"` // page size 31 | } 32 | 33 | // QueryWorkflowInstancesRequest query workflow instances request body 34 | type QueryWorkflowInstancesRequest struct { 35 | WorkflowID string `form:"workflow_id" json:"workflow_id"` 36 | Page int `form:"page" json:"page"` // page num 37 | Size int `form:"size" json:"size"` // page size 38 | } 39 | -------------------------------------------------------------------------------- /cmd/controller/response.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package main 17 | 18 | import "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/dal/model" 19 | 20 | // QueryWorkflowsResponse query workflow list response data 21 | type QueryWorkflowsResponse struct { 22 | Workflows []model.Workflow `json:"workflows"` 23 | Total int `json:"total"` // total count 24 | } 25 | 26 | // QueryWorkflowResponse query workflow detail response data 27 | type QueryWorkflowResponse struct { 28 | Workflow model.Workflow 29 | } 30 | 31 | // QueryWorkflowInstancesResponse query workflow instances response data 32 | type QueryWorkflowInstancesResponse struct { 33 | WorkflowInstances []model.WorkflowInstance `json:"workflow_instances"` 34 | Total int `json:"total"` // total count 35 | } 36 | -------------------------------------------------------------------------------- /cmd/controller/workflow.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package main 17 | 18 | import ( 19 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/dal" 20 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/dal/model" 21 | "github.com/gin-gonic/gin" 22 | "net/http" 23 | ) 24 | 25 | const ( 26 | workflowIDParam = "workflowId" 27 | ) 28 | 29 | // WorkflowController workflow controller operations 30 | type WorkflowController struct { 31 | workflowDAL dal.WorkflowDAL 32 | } 33 | 34 | func NewWorkflowController() *WorkflowController { 35 | c := WorkflowController{} 36 | c.workflowDAL = dal.NewWorkflowDAL() 37 | return &c 38 | } 39 | 40 | // Save save a workflow 41 | // @Summary save a workflow 42 | // @Description save a workflow 43 | // @Tags workflow 44 | // @Accept json 45 | // @Produce json 46 | // @Param request body SaveWorkflowRequest true "workflow data" 47 | // @Success 200 48 | // @Failure 400 49 | // @Failure 404 50 | // @Failure 500 51 | // @Router /workflow [post] 52 | func (c *WorkflowController) Save(ctx *gin.Context) { 53 | request := SaveWorkflowRequest{} 54 | if err := ctx.ShouldBind(&request); err != nil { 55 | ctx.JSON(http.StatusBadRequest, err.Error()) 56 | return 57 | } 58 | if err := c.workflowDAL.Save(ctx, &request.Workflow); err != nil { 59 | ctx.JSON(http.StatusInternalServerError, err.Error()) 60 | return 61 | } 62 | ctx.JSON(http.StatusOK, nil) 63 | } 64 | 65 | // QueryList query workflow list 66 | // @Summary query workflow list 67 | // @Description query workflow list 68 | // @Tags workflow 69 | // @Accept json 70 | // @Produce json 71 | // @Param workflow_id query string false "workflow id" 72 | // @Param status query string false "workflow status" 73 | // @Param page query string false "query page" 74 | // @Param size query string false "query size" 75 | // @Success 200 {object} QueryWorkflowsResponse 76 | // @Failure 400 77 | // @Failure 404 78 | // @Failure 500 79 | // @Router /workflow [get] 80 | func (c *WorkflowController) QueryList(ctx *gin.Context) { 81 | request := QueryWorkflowsRequest{} 82 | if err := ctx.ShouldBind(&request); err != nil { 83 | ctx.JSON(http.StatusBadRequest, err.Error()) 84 | return 85 | } 86 | res, total, err := c.workflowDAL.SelectList(ctx, &model.QueryParam{ 87 | WorkflowID: request.WorkflowID, 88 | Status: request.Status, 89 | Page: request.Page, 90 | Size: request.Size, 91 | }) 92 | if err != nil { 93 | ctx.JSON(http.StatusInternalServerError, err.Error()) 94 | return 95 | } 96 | ctx.JSON(http.StatusOK, &QueryWorkflowsResponse{Total: total, Workflows: res}) 97 | } 98 | 99 | // QueryDetail query workflow detail info 100 | // @Summary query workflow detail info 101 | // @Description query workflow detail info 102 | // @Tags workflow 103 | // @Accept json 104 | // @Produce json 105 | // @Param workflowId path string true "workflow id" 106 | // @Success 200 {object} QueryWorkflowResponse 107 | // @Failure 400 108 | // @Failure 404 109 | // @Failure 500 110 | // @Router /workflow/{workflowId} [get] 111 | func (c *WorkflowController) QueryDetail(ctx *gin.Context) { 112 | workflowID := ctx.Param(workflowIDParam) 113 | res, err := c.workflowDAL.Select(ctx, dal.GetDalClient(), workflowID) 114 | if err != nil { 115 | ctx.JSON(http.StatusInternalServerError, err.Error()) 116 | return 117 | } 118 | if res == nil { 119 | ctx.JSON(http.StatusOK, nil) 120 | return 121 | } 122 | ctx.JSON(http.StatusOK, &QueryWorkflowResponse{Workflow: *res}) 123 | } 124 | 125 | // Delete delete a workflow 126 | // @Summary delete a workflow 127 | // @Description delete a workflow 128 | // @Tags workflow 129 | // @Accept json 130 | // @Produce json 131 | // @Param workflowId path string true "workflow id" 132 | // @Success 200 {object} QueryWorkflowsResponse 133 | // @Failure 400 134 | // @Failure 404 135 | // @Failure 500 136 | // @Router /workflow/{workflowId} [delete] 137 | func (c *WorkflowController) Delete(ctx *gin.Context) { 138 | workflowID := ctx.Param(workflowIDParam) 139 | if err := c.workflowDAL.Delete(ctx, workflowID); err != nil { 140 | ctx.JSON(http.StatusInternalServerError, err.Error()) 141 | return 142 | } 143 | ctx.JSON(http.StatusOK, nil) 144 | } 145 | 146 | // QueryInstances query workflow instances 147 | // @Summary query workflow instances 148 | // @Description query workflow instances 149 | // @Tags workflow 150 | // @Accept json 151 | // @Produce json 152 | // @Param workflow_id query string false "workflow id" 153 | // @Param page query string false "query page" 154 | // @Param size query string false "query size" 155 | // @Success 200 {object} QueryWorkflowInstancesResponse 156 | // @Failure 400 157 | // @Failure 404 158 | // @Failure 500 159 | // @Router /workflow/instances [get] 160 | func (c *WorkflowController) QueryInstances(ctx *gin.Context) { 161 | request := QueryWorkflowInstancesRequest{} 162 | if err := ctx.ShouldBind(&request); err != nil { 163 | ctx.JSON(http.StatusBadRequest, err.Error()) 164 | return 165 | } 166 | res, total, err := c.workflowDAL.SelectInstances(ctx, &model.QueryParam{ 167 | WorkflowID: request.WorkflowID, 168 | Page: request.Page, 169 | Size: request.Size, 170 | }) 171 | if err != nil { 172 | ctx.JSON(http.StatusInternalServerError, err.Error()) 173 | return 174 | } 175 | ctx.JSON(http.StatusOK, &QueryWorkflowInstancesResponse{Total: total, WorkflowInstances: res}) 176 | } 177 | -------------------------------------------------------------------------------- /cmd/engine/main.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package main 17 | 18 | import ( 19 | "errors" 20 | "fmt" 21 | "github.com/apache/incubator-eventmesh/eventmesh-server-go/config" 22 | "github.com/apache/incubator-eventmesh/eventmesh-server-go/log" 23 | "github.com/apache/incubator-eventmesh/eventmesh-server-go/pkg/naming/registry" 24 | "github.com/apache/incubator-eventmesh/eventmesh-server-go/plugin" 25 | _ "github.com/apache/incubator-eventmesh/eventmesh-server-go/plugin/database/mysql" 26 | _ "github.com/apache/incubator-eventmesh/eventmesh-server-go/plugin/naming/nacos/registry" 27 | _ "github.com/apache/incubator-eventmesh/eventmesh-server-go/plugin/naming/nacos/selector" 28 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/api" 29 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/api/proto" 30 | pconfig "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/config" 31 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/constants" 32 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/dal" 33 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/queue" 34 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/schedule" 35 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/util" 36 | "google.golang.org/grpc" 37 | "net" 38 | ) 39 | 40 | type Server struct { 41 | server *grpc.Server 42 | schedule schedule.Scheduler 43 | queue queue.ObserveQueue 44 | } 45 | 46 | func main() { 47 | s, err := initServer() 48 | if err != nil { 49 | log.Fatal("flow new server fail: " + err.Error()) 50 | } 51 | router(s) 52 | if err = s.run(); err != nil { 53 | log.Fatal("run server fail: " + err.Error()) 54 | } 55 | } 56 | 57 | func router(s *Server) { 58 | proto.RegisterWorkflowServer(s.server, api.NewWorkflowService()) 59 | } 60 | 61 | func initServer() (*Server, error) { 62 | plugin.Register(constants.LogSchedule, log.DefaultLogFactory) 63 | plugin.Register(constants.LogQueue, log.DefaultLogFactory) 64 | 65 | var s Server 66 | if err := s.setupConfig(); err != nil { 67 | return nil, err 68 | } 69 | reg := registry.Get(config.GlobalConfig().Server.Name) 70 | if reg == nil { 71 | return nil, errors.New("service name=" + config.GlobalConfig().Server.Name + " not find registry") 72 | } 73 | if err := reg.Register(config.GlobalConfig().Server.Name); err != nil { 74 | return nil, err 75 | } 76 | scheduler, err := schedule.NewScheduler() 77 | if err != nil { 78 | return nil, err 79 | } 80 | s.schedule = scheduler 81 | if err = dal.Open(); err != nil { 82 | return nil, err 83 | } 84 | s.queue = queue.GetQueue(config.GlobalConfig().Flow.Queue.Store) 85 | 86 | s.server = grpc.NewServer() 87 | return &s, nil 88 | } 89 | 90 | func (s *Server) run() error { 91 | s.queue.Observe() 92 | s.schedule.Run() 93 | 94 | l, err := s.listen() 95 | if err != nil { 96 | return err 97 | } 98 | return s.server.Serve(l) 99 | } 100 | 101 | func (s *Server) setupConfig() error { 102 | config.ServerConfigPath = "./configs/workflow.yaml" 103 | // compatible local environment 104 | if !util.Exists(config.ServerConfigPath) { 105 | config.ServerConfigPath = "../configs/workflow.yaml" 106 | } 107 | // compatible deploy environment 108 | if !util.Exists(config.ServerConfigPath) { 109 | config.ServerConfigPath = "../conf/workflow.yaml" 110 | } 111 | cfg, err := config.LoadConfig(config.ServerConfigPath) 112 | if err != nil { 113 | return err 114 | } 115 | config.SetGlobalConfig(cfg) 116 | if err := config.Setup(cfg); err != nil { 117 | return err 118 | } 119 | return pconfig.Setup(config.ServerConfigPath) 120 | } 121 | 122 | func (s *Server) listen() (net.Listener, error) { 123 | listener, err := net.Listen("tcp", fmt.Sprintf(":%d", config.GlobalConfig().Server.Port)) 124 | if err != nil { 125 | return nil, err 126 | } 127 | return listener, nil 128 | } 129 | -------------------------------------------------------------------------------- /config/config.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package config 17 | 18 | import ( 19 | "gopkg.in/yaml.v3" 20 | "os" 21 | ) 22 | 23 | var ( 24 | cfg *Config 25 | ) 26 | 27 | type Config struct { 28 | Flow struct { 29 | Queue struct { 30 | Store string `yaml:"store"` 31 | Topic string `yaml:"topic"` 32 | } `yaml:"queue"` 33 | Scheduler struct { 34 | Type string `yaml:"type"` 35 | Interval int `yaml:"interval"` 36 | } `yaml:"scheduler"` 37 | Selector string `yaml:"selector"` 38 | Protocol string `yaml:"protocol"` 39 | } `yaml:"flow"` 40 | Catalog struct { 41 | ServerName string `yaml:"server_name"` 42 | } `yaml:"catalog"` 43 | EventMesh struct { 44 | Host string `yaml:"host"` 45 | Env string `yaml:"env"` 46 | IDC string `yaml:"idc"` 47 | GRPC struct { 48 | Port int `yaml:"port"` 49 | } `yaml:"grpc"` 50 | Sys string `yaml:"sys"` 51 | UserName string `yaml:"username"` 52 | Password string `yaml:"password"` 53 | ProducerGroup string `yaml:"producer_group"` 54 | ConsumerGroup string `yaml:"consumer_group"` 55 | TTL int `yaml:"ttl"` 56 | } `yaml:"eventmesh"` 57 | Metrics struct { 58 | EndpointPort string `yaml:"endpoint_port"` 59 | } `yaml:"metrics"` 60 | } 61 | 62 | // Setup setup config 63 | func Setup(path string) error { 64 | var err error 65 | cfg, err = parseConfigFromFile(path) 66 | if err != nil { 67 | return err 68 | } 69 | return nil 70 | } 71 | 72 | // Get get config 73 | func Get() *Config { 74 | return cfg 75 | } 76 | 77 | func parseConfigFromFile(configPath string) (*Config, error) { 78 | buf, err := os.ReadFile(configPath) 79 | if err != nil { 80 | return nil, err 81 | } 82 | c := &Config{} 83 | if err = yaml.Unmarshal(buf, c); err != nil { 84 | return nil, err 85 | } 86 | return c, nil 87 | } 88 | -------------------------------------------------------------------------------- /configs/controller.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | server: 18 | port: 11022 19 | plugins: 20 | database: 21 | mysql: 22 | dsn: "root:123456@(127.0.0.1:3306)/db_workflow?charset=utf8&parseTime=True&loc=Local" 23 | max_idle: 50 24 | max_open: 100 25 | max_lifetime: 180000 26 | log: 27 | default: 28 | - writer: file 29 | level: info 30 | writer_config: 31 | filename: ./workflow.log 32 | max_size: 10 33 | max_backups: 10 34 | max_age: 7 35 | compress: false -------------------------------------------------------------------------------- /configs/engine.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | server: 18 | port: 11012 19 | name: "EVENTMESH-workflow" 20 | flow: 21 | queue: 22 | store: in-memory 23 | scheduler: 24 | type: in-line 25 | interval: 10 # milliseconds 26 | protocol: meshmessage 27 | catalog: 28 | server_name: "EVENTMESH-catalog" 29 | eventmesh: 30 | host: "127.0.0.1" 31 | env: "PRD" 32 | idc: "DEFAULT" 33 | sys: "DEFAULT" 34 | username: "username" 35 | password: "password" 36 | producer_group: "EventMeshTest-producerGroup" 37 | ttl: 4000 38 | grpc: 39 | port: 10205 40 | plugins: 41 | registry: 42 | nacos: 43 | address_list: "127.0.0.1:8848" 44 | selector: 45 | nacos: 46 | address_list: "127.0.0.1:8848" 47 | database: 48 | mysql: 49 | dsn: "root:123456@(127.0.0.1:3306)/db_workflow?charset=utf8&parseTime=True&loc=Local" 50 | max_idle: 50 51 | max_open: 100 52 | max_lifetime: 180000 53 | log: 54 | default: 55 | - writer: file 56 | level: info 57 | writer_config: 58 | filename: ./workflow.log 59 | max_size: 10 60 | max_backups: 10 61 | max_age: 7 62 | compress: false 63 | schedule: 64 | - writer: file 65 | level: info 66 | writer_config: 67 | filename: ./workflow_schedule.log 68 | max_size: 10 69 | max_backups: 10 70 | max_age: 7 71 | compress: false 72 | queue: 73 | - writer: file 74 | level: info 75 | writer_config: 76 | filename: ./workflow_queue.log 77 | max_size: 10 78 | max_backups: 10 79 | max_age: 7 80 | compress: false 81 | -------------------------------------------------------------------------------- /configs/testcreateworkflow.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | id: testcreateworkflow 18 | version: '1.0' 19 | specVersion: '0.8' 20 | name: Store Order Management Workflow 21 | start: Receive New Order Event 22 | states: 23 | - name: Receive New Order Event 24 | type: event 25 | onEvents: 26 | - eventRefs: 27 | - NewOrderEvent 28 | actions: 29 | - functionRef: 30 | refName: "OrderServiceSendEvent" 31 | transition: Check New Order Result 32 | - name: Check New Order Result 33 | type: switch 34 | dataConditions: 35 | - name: New Order Successfull 36 | condition: '${ .order_no != "" }' 37 | transition: Send Order Payment 38 | - name: New Order Failed 39 | condition: '${ .order_no == "" }' 40 | end: true 41 | defaultCondition: 42 | end: true 43 | - name: Send Order Payment 44 | type: operation 45 | actions: 46 | - functionRef: 47 | refName: "PaymentServiceSendEvent" 48 | transition: Check Payment Status 49 | - name: Check Payment Status 50 | type: switch 51 | dataConditions: 52 | - name: Payment Successfull 53 | condition: '${ .order_no != "" }' 54 | transition: Send Order Shipment 55 | - name: Payment Denied 56 | condition: '${ .order_no == "" }' 57 | end: true 58 | defaultCondition: 59 | end: true 60 | - name: Send Order Shipment 61 | type: operation 62 | actions: 63 | - functionRef: 64 | refName: "ShipmentServiceSendEvent" 65 | end: true 66 | events: 67 | - name: NewOrderEvent 68 | source: store/order 69 | type: online.store.newOrder 70 | functions: 71 | - name: OrderServiceSendEvent 72 | operation: file://orderapp.yaml#sendOrder 73 | type: asyncapi 74 | - name: PaymentServiceSendEvent 75 | operation: file://paymentapp.yaml#sendPayment 76 | type: asyncapi 77 | - name: ShipmentServiceSendEvent 78 | operation: file://expressapp.yaml#sendExpress 79 | type: asyncapi -------------------------------------------------------------------------------- /distribution/mysql-schema.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | create database if not exists db_workflow; 19 | 20 | use db_workflow; 21 | 22 | create table if not exists t_workflow 23 | ( 24 | id int auto_increment primary key, 25 | workflow_id varchar(1024) not null, 26 | workflow_name varchar(1024) not null, 27 | definition text not null, 28 | status int not null, 29 | version varchar(64) not null, 30 | create_time datetime default CURRENT_TIMESTAMP not null, 31 | update_time datetime default CURRENT_TIMESTAMP not null, 32 | index `index_workflow_id` (workflow_id) 33 | ) collate = utf8mb3_bin; 34 | 35 | create table if not exists t_workflow_instance 36 | ( 37 | id int auto_increment 38 | primary key, 39 | workflow_id varchar(1024) not null, 40 | workflow_instance_id varchar(1024) not null, 41 | workflow_status int not null, 42 | create_time datetime default CURRENT_TIMESTAMP not null, 43 | update_time datetime default CURRENT_TIMESTAMP not null, 44 | index `index_workflow_id` (workflow_id) 45 | ) 46 | collate = utf8mb3_bin; 47 | 48 | create table if not exists t_workflow_task 49 | ( 50 | id int auto_increment 51 | primary key, 52 | workflow_id varchar(1024) not null, 53 | task_id varchar(1024) not null, 54 | task_name varchar(1024) not null, 55 | task_type varchar(64) not null, 56 | task_input_filter varchar(1024) not null default '', 57 | status int not null, 58 | create_time datetime default CURRENT_TIMESTAMP not null, 59 | update_time datetime default CURRENT_TIMESTAMP not null, 60 | index `index_workflow_id` (workflow_id) 61 | ) 62 | collate = utf8mb3_bin; 63 | 64 | create table if not exists t_workflow_task_action 65 | ( 66 | id int auto_increment 67 | primary key, 68 | workflow_id varchar(1024) not null, 69 | task_id varchar(1024) not null, 70 | operation_name varchar(1024) not null, 71 | operation_type varchar(1024) not null, 72 | status int not null, 73 | create_time datetime default CURRENT_TIMESTAMP not null, 74 | update_time datetime default CURRENT_TIMESTAMP not null, 75 | index `index_workflow_id` (workflow_id) 76 | ) 77 | collate = utf8mb3_bin; 78 | 79 | create table if not exists t_workflow_task_instance 80 | ( 81 | id int auto_increment 82 | primary key, 83 | workflow_id varchar(1024) not null, 84 | workflow_instance_id varchar(1024) not null, 85 | task_id varchar(1024) not null, 86 | task_instance_id varchar(1024) not null, 87 | status int not null, 88 | input text not null, 89 | retry_times int not null, 90 | create_time datetime default CURRENT_TIMESTAMP not null, 91 | update_time datetime default CURRENT_TIMESTAMP not null, 92 | index `index_workflow_id` (workflow_id) 93 | ) 94 | collate = utf8mb3_bin; 95 | 96 | create table if not exists t_workflow_task_relation 97 | ( 98 | id int auto_increment 99 | primary key, 100 | workflow_id varchar(1024) not null, 101 | from_task_id varchar(1024) not null, 102 | to_task_id varchar(1024) not null, 103 | `condition` varchar(2048) not null, 104 | status int not null, 105 | create_time datetime default CURRENT_TIMESTAMP not null, 106 | update_time datetime default CURRENT_TIMESTAMP not null, 107 | index `index_from_task_id` (from_task_id) 108 | index `index_workflow_id` (workflow_id) 109 | ) 110 | collate = utf8mb3_bin; 111 | 112 | -------------------------------------------------------------------------------- /flow/engine.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package flow 17 | 18 | import ( 19 | "context" 20 | "github.com/apache/incubator-eventmesh/eventmesh-server-go/config" 21 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/constants" 22 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/dal" 23 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/dal/model" 24 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/metrics" 25 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/queue" 26 | "github.com/google/uuid" 27 | ) 28 | 29 | type Engine struct { 30 | workflowDAL dal.WorkflowDAL 31 | queue queue.ObserveQueue 32 | } 33 | 34 | func NewEngine() *Engine { 35 | var engine Engine 36 | engine.workflowDAL = dal.NewWorkflowDAL() 37 | engine.queue = queue.GetQueue(config.GlobalConfig().Flow.Queue.Store) 38 | return &engine 39 | } 40 | 41 | // Validate 验证流程执行合法性 42 | func (e *Engine) Validate(ctx context.Context, instanceID string) error { 43 | return nil 44 | } 45 | 46 | // Start start workflow 47 | func (e *Engine) Start(ctx context.Context, param *WorkflowParam) (string, error) { 48 | metrics.Inc(constants.MetricsEngine, constants.MetricsStartRequest) 49 | r, err := e.workflowDAL.SelectStartTask(ctx, model.WorkflowTask{WorkflowID: param.ID}) 50 | if err != nil { 51 | return "", err 52 | } 53 | if r == nil { 54 | return "", ErrWorkflowNotExists 55 | } 56 | var workflowInstanceID = uuid.New().String() 57 | if err = e.workflowDAL.InsertInstance(ctx, &model.WorkflowInstance{ 58 | WorkflowID: param.ID, WorkflowInstanceID: workflowInstanceID, 59 | WorkflowStatus: constants.WorkflowInstanceProcessStatus, 60 | }); err != nil { 61 | return "", err 62 | } 63 | var w = model.WorkflowTaskInstance{WorkflowInstanceID: workflowInstanceID, WorkflowID: param.ID, 64 | TaskID: r.TaskID, TaskInstanceID: uuid.New().String(), Status: constants.TaskInstanceWaitStatus, 65 | Input: param.Input, IsStart: true} 66 | return workflowInstanceID, e.queue.Publish([]*model.WorkflowTaskInstance{&w}) 67 | } 68 | 69 | // Transition transition next workflow task 70 | func (e *Engine) Transition(ctx context.Context, param *WorkflowParam) error { 71 | metrics.Inc(constants.MetricsEngine, constants.MetricsTransitionRequest) 72 | r, err := e.workflowDAL.SelectTransitionTask(ctx, model.WorkflowTaskInstance{WorkflowID: param.ID, 73 | WorkflowInstanceID: param.InstanceID, TaskInstanceID: param.TaskInstanceID, 74 | Status: constants.TaskInstanceSleepStatus}) 75 | if err != nil { 76 | return err 77 | } 78 | if r == nil { 79 | return nil 80 | } 81 | r.Status = constants.TaskInstanceWaitStatus 82 | return e.queue.Publish([]*model.WorkflowTaskInstance{r}) 83 | } 84 | -------------------------------------------------------------------------------- /flow/error.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package flow 17 | 18 | import "errors" 19 | 20 | // ErrWorkflowNotExists is returned when workflow not exists 21 | var ErrWorkflowNotExists = errors.New("workflow not exists") 22 | -------------------------------------------------------------------------------- /flow/model.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package flow 17 | 18 | // WorkflowParam workflow runtime param 19 | type WorkflowParam struct { 20 | ID string `json:"id"` 21 | InstanceID string `json:"instance_id"` 22 | TaskInstanceID string `json:"task_instance_id"` 23 | Input string `json:"input"` 24 | } 25 | 26 | type WorkflowEventCatalog struct { 27 | OperationID string `json:"operation_id"` 28 | Topic string `json:"topic"` 29 | Schema string `json:"schema"` 30 | } 31 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | module github.com/apache/incubator-eventmesh/eventmesh-workflow-go 17 | 18 | go 1.18 19 | 20 | require ( 21 | github.com/apache/incubator-eventmesh/eventmesh-catalog-go v0.0.0-20230110063418-8d8aa909d909 22 | github.com/apache/incubator-eventmesh/eventmesh-sdk-go v0.0.0-20220923152713-86455c587c5b 23 | github.com/apache/incubator-eventmesh/eventmesh-server-go v0.0.0-20220812021948-0945ab92daea 24 | github.com/avast/retry-go/v4 v4.0.1 25 | github.com/gin-gonic/gin v1.8.2 26 | github.com/gogf/gf v1.16.9 27 | github.com/google/uuid v1.3.0 28 | github.com/itchyny/gojq v0.12.8 29 | github.com/prometheus/client_golang v1.12.2 30 | github.com/reactivex/rxgo/v2 v2.5.0 31 | github.com/serverlessworkflow/sdk-go/v2 v2.1.1 32 | github.com/stretchr/testify v1.8.1 33 | github.com/swaggo/files v1.0.0 34 | github.com/swaggo/gin-swagger v1.5.3 35 | github.com/swaggo/swag v1.8.9 36 | google.golang.org/grpc v1.48.0 37 | google.golang.org/protobuf v1.28.1 38 | gopkg.in/yaml.v3 v3.0.1 39 | gorm.io/driver/mysql v1.3.5 40 | gorm.io/gorm v1.23.8 41 | ) 42 | 43 | require ( 44 | github.com/KyleBanks/depth v1.2.1 // indirect 45 | github.com/aliyun/alibaba-cloud-sdk-go v1.61.1704 // indirect 46 | github.com/beorn7/perks v1.0.1 // indirect 47 | github.com/buger/jsonparser v1.1.1 // indirect 48 | github.com/cenkalti/backoff/v4 v4.0.0 // indirect 49 | github.com/cespare/xxhash/v2 v2.1.2 // indirect 50 | github.com/davecgh/go-spew v1.1.1 // indirect 51 | github.com/emirpasic/gods v1.12.0 // indirect 52 | github.com/fsnotify/fsnotify v1.5.4 // indirect 53 | github.com/gin-contrib/sse v0.1.0 // indirect 54 | github.com/go-logr/logr v0.4.0 // indirect 55 | github.com/go-openapi/jsonpointer v0.19.6 // indirect 56 | github.com/go-openapi/jsonreference v0.20.1 // indirect 57 | github.com/go-openapi/spec v0.20.7 // indirect 58 | github.com/go-openapi/swag v0.22.3 // indirect 59 | github.com/go-playground/locales v0.14.0 // indirect 60 | github.com/go-playground/universal-translator v0.18.0 // indirect 61 | github.com/go-playground/validator/v10 v10.11.1 // indirect 62 | github.com/go-sql-driver/mysql v1.6.0 // indirect 63 | github.com/goccy/go-json v0.10.0 // indirect 64 | github.com/gogo/protobuf v1.3.2 // indirect 65 | github.com/golang/mock v1.6.0 // indirect 66 | github.com/golang/protobuf v1.5.2 // indirect 67 | github.com/google/gofuzz v1.1.0 // indirect 68 | github.com/hashicorp/errwrap v1.0.0 // indirect 69 | github.com/hashicorp/go-multierror v1.1.1 // indirect 70 | github.com/itchyny/timefmt-go v0.1.3 // indirect 71 | github.com/jinzhu/inflection v1.0.0 // indirect 72 | github.com/jinzhu/now v1.1.5 // indirect 73 | github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af // indirect 74 | github.com/josharian/intern v1.0.0 // indirect 75 | github.com/json-iterator/go v1.1.12 // indirect 76 | github.com/leodido/go-urn v1.2.1 // indirect 77 | github.com/lestrrat-go/strftime v1.0.6 // indirect 78 | github.com/mailru/easyjson v0.7.7 // indirect 79 | github.com/mattn/go-isatty v0.0.17 // indirect 80 | github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect 81 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect 82 | github.com/modern-go/reflect2 v1.0.2 // indirect 83 | github.com/nacos-group/nacos-sdk-go/v2 v2.0.4 // indirect 84 | github.com/panjf2000/ants v1.3.0 // indirect 85 | github.com/pelletier/go-toml/v2 v2.0.6 // indirect 86 | github.com/pkg/errors v0.9.1 // indirect 87 | github.com/pmezard/go-difflib v1.0.0 // indirect 88 | github.com/prometheus/client_model v0.2.0 // indirect 89 | github.com/prometheus/common v0.32.1 // indirect 90 | github.com/prometheus/procfs v0.7.3 // indirect 91 | github.com/sony/sonyflake v1.0.0 // indirect 92 | github.com/stretchr/objx v0.5.0 // indirect 93 | github.com/teivah/onecontext v0.0.0-20200513185103-40f981bfd775 // indirect 94 | github.com/ugorji/go/codec v1.2.8 // indirect 95 | go.uber.org/atomic v1.7.0 // indirect 96 | go.uber.org/multierr v1.6.0 // indirect 97 | go.uber.org/zap v1.22.0 // indirect 98 | golang.org/x/crypto v0.5.0 // indirect 99 | golang.org/x/net v0.7.0 // indirect 100 | golang.org/x/sync v0.1.0 // indirect 101 | golang.org/x/sys v0.5.0 // indirect 102 | golang.org/x/text v0.7.0 // indirect 103 | golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 // indirect 104 | golang.org/x/tools v0.5.0 // indirect 105 | google.golang.org/genproto v0.0.0-20200825200019-8632dd797987 // indirect 106 | gopkg.in/go-playground/validator.v8 v8.18.2 // indirect 107 | gopkg.in/ini.v1 v1.66.2 // indirect 108 | gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect 109 | gopkg.in/yaml.v2 v2.4.0 // indirect 110 | k8s.io/apimachinery v0.21.0 // indirect 111 | k8s.io/klog/v2 v2.8.0 // indirect 112 | sigs.k8s.io/yaml v1.2.0 // indirect 113 | ) 114 | -------------------------------------------------------------------------------- /internal/constants/constants.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package constants 17 | 18 | type TaskType int 19 | type QueueType int 20 | 21 | const ( 22 | // QueueTypeInMemory in memory queue type 23 | QueueTypeInMemory = "in-memory" 24 | // QueueTypeEventMesh EventMesh queue 25 | QueueTypeEventMesh = "eventmesh" 26 | ) 27 | 28 | const ( 29 | TaskStartID = "START" 30 | TaskEndID = "END" 31 | NormalStatus = 1 32 | InvalidStatus = -1 33 | ) 34 | 35 | // task instance status 36 | const ( 37 | TaskInstanceSleepStatus = 1 38 | TaskInstanceWaitStatus = 2 39 | TaskInstanceProcessStatus = 3 40 | TaskInstanceSuccessStatus = 4 41 | TaskInstanceFailStatus = 5 42 | ) 43 | 44 | // workflow instance status 45 | const ( 46 | WorkflowInstanceProcessStatus = 1 47 | WorkflowInstanceSuccessStatus = 2 48 | ) 49 | 50 | // log name 51 | const ( 52 | LogSchedule = "schedule" 53 | LogQueue = "queue" 54 | ) 55 | 56 | const ( 57 | TaskTypeOperation = "operation" 58 | TaskTypeEvent = "event" 59 | TaskTypeSwitch = "switch" 60 | ) 61 | 62 | const ( 63 | // RetryAttempts fail retry max times 64 | RetryAttempts = 5 65 | ) 66 | 67 | const ( 68 | EventTypePublish = "publish" 69 | EventPropsWorkflowInstanceID = "workflowinstanceid" 70 | EventPropsWorkflowTaskInstanceID = "workflowtaskinstanceid" 71 | ) 72 | 73 | // Metrics Collector types 74 | const ( 75 | MetricsEventTask = "event_task" 76 | MetricsOperationTask = "operation_task" 77 | MetricsSwitchTask = "switch_task" 78 | MetricsScheduler = "scheduler" 79 | MetricsEngine = "engine" 80 | MetricsTaskQueue = "task_queue" 81 | ) 82 | 83 | // Metrics labels 84 | const ( 85 | MetricsTotal = "total" 86 | MetricsSwitchReject = "reject" 87 | MetricsSwitchPass = "pass" 88 | 89 | MetricsStartRequest = "start_request" 90 | MetricsTransitionRequest = "transition_request" 91 | 92 | MetricsDbLockAcquireTime = "db_lock_acquire_time" 93 | MetricsQueueSize = "queue_size" 94 | ) 95 | -------------------------------------------------------------------------------- /internal/dal/config.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package dal 17 | 18 | import ( 19 | "database/sql" 20 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/middleware/dblock" 21 | "gorm.io/gorm/logger" 22 | "time" 23 | 24 | "gorm.io/driver/mysql" 25 | "gorm.io/gorm" 26 | 27 | pmysql "github.com/apache/incubator-eventmesh/eventmesh-server-go/plugin/database/mysql" 28 | ) 29 | 30 | var workflowDB *gorm.DB 31 | var workflowLock *dblock.MysqlLocker 32 | 33 | func Open() error { 34 | var err error 35 | d, err := sql.Open("mysql", pmysql.PluginConfig.DSN) 36 | d.SetMaxOpenConns(pmysql.PluginConfig.MaxOpen) 37 | d.SetMaxIdleConns(pmysql.PluginConfig.MaxIdle) 38 | d.SetConnMaxLifetime(time.Millisecond * time.Duration(pmysql.PluginConfig.MaxLifetime)) 39 | 40 | workflowDB, err = gorm.Open(mysql.New(mysql.Config{Conn: d}), 41 | &gorm.Config{Logger: logger.Default.LogMode(logger.Silent)}) 42 | if err != nil { 43 | return err 44 | } 45 | db, err := workflowDB.DB() 46 | if err != nil { 47 | return err 48 | } 49 | workflowLock = dblock.NewMysqlLocker(db) 50 | return nil 51 | } 52 | 53 | func GetDalClient() *gorm.DB { 54 | return workflowDB 55 | } 56 | 57 | func GetLockClient() *dblock.MysqlLocker { 58 | return workflowLock 59 | } 60 | -------------------------------------------------------------------------------- /internal/dal/model/workflow.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package model 17 | 18 | import "time" 19 | 20 | // Workflow workflow model definition 21 | type Workflow struct { 22 | ID int `json:"id" gorm:"column:id;type:int;primaryKey;autoIncrement"` 23 | WorkflowID string `json:"workflow_id" gorm:"column:workflow_id;type:varchar;size:1024"` 24 | WorkflowName string `json:"workflow_name" gorm:"column:workflow_name;type:varchar;size:1024"` 25 | Definition string `json:"definition" gorm:"column:definition;type:text;"` 26 | Status int `json:"status" gorm:"column:status;type:int"` 27 | Version string `json:"version" gorm:"column:version;type:varchar;size:64"` 28 | CreateTime time.Time `json:"create_time"` 29 | UpdateTime time.Time `json:"update_time"` 30 | TotalInstances int `json:"total_instances" gorm:"-"` 31 | TotalRunningInstances int `json:"total_running_instances" gorm:"-"` 32 | TotalFailedInstances int `json:"total_failed_instances" gorm:"-"` 33 | } 34 | 35 | // TableName workflow table name define 36 | func (w Workflow) TableName() string { 37 | return "t_workflow" 38 | } 39 | 40 | type WorkflowInstance struct { 41 | ID int `json:"id" gorm:"column:id;type:int;primaryKey;autoIncrement"` 42 | WorkflowID string `json:"workflow_id" gorm:"column:workflow_id;type:varchar;size:1024"` 43 | WorkflowInstanceID string `json:"workflow_instance_id" gorm:"column:workflow_instance_id;type:varchar;size:1024"` 44 | WorkflowStatus int `json:"workflow_status" gorm:"column:workflow_status;type:int"` 45 | CreateTime time.Time `json:"create_time"` 46 | UpdateTime time.Time `json:"update_time"` 47 | } 48 | 49 | func (w WorkflowInstance) TableName() string { 50 | return "t_workflow_instance" 51 | } 52 | 53 | type QueryParam struct { 54 | WorkflowID string `json:"workflow_id"` 55 | Status int `json:"status"` 56 | Page int `json:"page"` // page num 57 | Size int `json:"size"` // page size 58 | } 59 | -------------------------------------------------------------------------------- /internal/dal/model/workflow_task.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package model 17 | 18 | import "time" 19 | 20 | type WorkflowTask struct { 21 | ID int `json:"id" gorm:"column:id;type:int;primaryKey;autoIncrement"` 22 | WorkflowID string `json:"workflow_id" gorm:"column:workflow_id;type:varchar;size:1024"` 23 | TaskID string `json:"task_id" gorm:"column:task_id;type:varchar;size:1024"` 24 | TaskName string `json:"task_name" gorm:"column:task_name;type:varchar;size:1024"` 25 | TaskType string `json:"task_type" gorm:"column:task_type;type:varchar;size:64"` 26 | TaskInputFilter string `json:"task_input_filter" gorm:"column:task_input_filter;type:varchar;size:1024"` 27 | Status int `json:"status" gorm:"column:status;type:int"` 28 | CreateTime time.Time `json:"create_time"` 29 | UpdateTime time.Time `json:"update_time"` 30 | Actions []*WorkflowTaskAction `json:"-" gorm:"-"` 31 | TaskIDs []string `json:"-" gorm:"-"` 32 | WorkflowInstanceID string `json:"workflow_instance_id" gorm:"-"` 33 | ChildTasks []*WorkflowTaskRelation `json:"-" gorm:"-"` 34 | } 35 | 36 | func (w WorkflowTask) TableName() string { 37 | return "t_workflow_task" 38 | } 39 | 40 | type WorkflowTaskAction struct { 41 | ID int `json:"id" gorm:"column:id;type:int;primaryKey;autoIncrement"` 42 | WorkflowID string `json:"workflow_id" gorm:"column:workflow_id;type:varchar;size:1024"` 43 | TaskID string `json:"task_id" gorm:"column:task_id;type:varchar;size:1024"` 44 | OperationName string `json:"operation_name" gorm:"column:operation_name;type:varchar;size:1024"` 45 | OperationType string `json:"operation_type" gorm:"column:operation_type;type:varchar;size:1024"` 46 | Status int `json:"status" gorm:"column:status;type:int"` 47 | CreateTime time.Time `json:"create_time"` 48 | UpdateTime time.Time `json:"Update_time"` 49 | TaskIDs []string `json:"-" gorm:"-"` 50 | } 51 | 52 | func (w WorkflowTaskAction) TableName() string { 53 | return "t_workflow_task_action" 54 | } 55 | 56 | type WorkflowTaskRelation struct { 57 | ID int `json:"id" gorm:"column:id;type:int;primaryKey;autoIncrement"` 58 | WorkflowID string `json:"workflow_id" gorm:"column:workflow_id;type:varchar;size:1024"` 59 | FromTaskID string `json:"from_task_id" gorm:"column:from_task_id;type:varchar;size:1024"` 60 | ToTaskID string `json:"to_task_id" gorm:"column:to_task_id;type:varchar;size:1024"` // DSL transition task id 61 | Condition string `json:"condition" gorm:"column:condition;type:varchar;size:2048"` // DSL transition condition 62 | Status int `json:"status" gorm:"column:status;type:int"` 63 | CreateTime time.Time `json:"create_time"` 64 | UpdateTime time.Time `json:"update_time"` 65 | } 66 | 67 | func (w WorkflowTaskRelation) TableName() string { 68 | return "t_workflow_task_relation" 69 | } 70 | 71 | type WorkflowTaskInstance struct { 72 | ID int `json:"id" gorm:"column:id;type:int;primaryKey;autoIncrement"` 73 | WorkflowInstanceID string `json:"workflow_instance_id" gorm:"column:workflow_instance_id;type:varchar;size:1024"` 74 | WorkflowID string `json:"workflow_id" gorm:"column:workflow_id;type:varchar;size:1024"` 75 | TaskID string `json:"task_id" gorm:"column:task_id;type:varchar;size:1024"` 76 | TaskInstanceID string `json:"task_instance_id" gorm:"column:task_instance_id;type:varchar;size:1024"` 77 | Status int `json:"status" gorm:"column:status;type:int"` 78 | Input string `json:"input" gorm:"column:input;type:text;"` 79 | RetryTimes int `json:"retry_times" gorm:"column:retry_times;type:int"` 80 | CreateTime time.Time `json:"create_time" gorm:"column:create_time"` 81 | UpdateTime time.Time `json:"update_time" gorm:"column:update_time"` 82 | Task *WorkflowTask `json:"task" gorm:"-"` 83 | Order string `json:"order" gorm:"-"` 84 | IsStart bool `json:"is_start" gorm:"-"` 85 | } 86 | 87 | func (w WorkflowTaskInstance) TableName() string { 88 | return "t_workflow_task_instance" 89 | } 90 | -------------------------------------------------------------------------------- /internal/filter/data_filter.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package filter 17 | 18 | import ( 19 | "encoding/json" 20 | "github.com/apache/incubator-eventmesh/eventmesh-server-go/log" 21 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/dal/model" 22 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/third_party/jqer" 23 | ) 24 | 25 | func FilterWorkflowTaskInputData(task *model.WorkflowTaskInstance) { 26 | if task == nil || len(task.Input) == 0 || len(task.Task.TaskInputFilter) == 0 { 27 | return 28 | } 29 | inputAfterFilter, err := filterJsonData(task.Task.TaskInputFilter, task.Input) 30 | if err != nil { 31 | log.Errorf("fail to filter task input data taskId=%s, err=%v", task.TaskID, err) 32 | return 33 | } 34 | task.Input = inputAfterFilter 35 | } 36 | 37 | func filterJsonData(filterJson string, inputDataJson string) (string, error) { 38 | var jsonObj interface{} 39 | err := json.Unmarshal([]byte(inputDataJson), &jsonObj) 40 | if err != nil { 41 | return "", err 42 | } 43 | jq := jqer.NewJQ() 44 | ret, err := jq.Object(jsonObj, filterJson) 45 | if err != nil { 46 | return "", err 47 | } 48 | outputDataJson, err := json.Marshal(ret) 49 | if err != nil { 50 | return "", err 51 | } 52 | return string(outputDataJson), nil 53 | } 54 | -------------------------------------------------------------------------------- /internal/filter/data_filter_test.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package filter 17 | 18 | import ( 19 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/dal/model" 20 | "github.com/stretchr/testify/assert" 21 | "testing" 22 | ) 23 | 24 | func TestFilterWorkflowTaskInputData(t *testing.T) { 25 | task := mockWorkflowInstance() 26 | FilterWorkflowTaskInputData(task) 27 | assert.Equal(t, task.Input, `{ "order_no": "123456789"}`) 28 | } 29 | 30 | func mockWorkflowInstance() *model.WorkflowTaskInstance { 31 | return &model.WorkflowTaskInstance{ 32 | Input: `{ "order_no": "123456789", "status":1}`, 33 | Task: &model.WorkflowTask{ 34 | TaskInputFilter: `${ {order_no: .order_no} }`, 35 | }, 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /internal/protocol/meshmessage.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package protocol 17 | 18 | import ( 19 | "context" 20 | "fmt" 21 | pgrpc "github.com/apache/incubator-eventmesh/eventmesh-sdk-go/grpc" 22 | "github.com/apache/incubator-eventmesh/eventmesh-sdk-go/grpc/conf" 23 | eventmesh "github.com/apache/incubator-eventmesh/eventmesh-sdk-go/grpc/proto" 24 | "github.com/apache/incubator-eventmesh/eventmesh-server-go/log" 25 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/config" 26 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/constants" 27 | "github.com/gogf/gf/util/gconv" 28 | "github.com/google/uuid" 29 | ) 30 | 31 | func init() { 32 | messageBuilder["meshmessage"] = &MeshMessage{} 33 | } 34 | 35 | // MeshMessage eventmesh message definition 36 | type MeshMessage struct { 37 | } 38 | 39 | func (m *MeshMessage) Publish(ctx context.Context, topic string, content string, properties map[string]string) error { 40 | eventmeshCfg := config.Get() 41 | cfg := &conf.GRPCConfig{ 42 | Host: eventmeshCfg.EventMesh.Host, 43 | Port: eventmeshCfg.EventMesh.GRPC.Port, 44 | ENV: eventmeshCfg.EventMesh.Env, 45 | IDC: eventmeshCfg.EventMesh.IDC, 46 | SYS: eventmeshCfg.EventMesh.Sys, 47 | Username: eventmeshCfg.EventMesh.UserName, 48 | Password: eventmeshCfg.EventMesh.Password, 49 | ProtocolType: pgrpc.EventmeshMessage, 50 | ProducerConfig: conf.ProducerConfig{ 51 | ProducerGroup: eventmeshCfg.EventMesh.ProducerGroup, 52 | }, 53 | } 54 | client, err := pgrpc.New(cfg) 55 | if err != nil { 56 | return err 57 | } 58 | defer closeEventMeshClient(client) 59 | message := &eventmesh.SimpleMessage{ 60 | Header: pgrpc.CreateHeader(cfg), 61 | ProducerGroup: eventmeshCfg.EventMesh.ProducerGroup, 62 | Topic: topic, 63 | Content: content, 64 | Ttl: gconv.String(eventmeshCfg.EventMesh.TTL), 65 | UniqueId: uuid.New().String(), 66 | SeqNum: uuid.New().String(), 67 | Properties: properties, 68 | } 69 | resp, err := client.Publish(context.Background(), message) 70 | if err != nil { 71 | return err 72 | } 73 | log.Get(constants.LogSchedule).Debugf("publish event result: %v", resp.String()) 74 | if resp.RespCode != "0" { 75 | return fmt.Errorf("eventmesh publish message error: [code]%v[msg]%v", resp.RespCode, resp.RespMsg) 76 | } 77 | return nil 78 | } 79 | -------------------------------------------------------------------------------- /internal/protocol/message.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package protocol 17 | 18 | import ( 19 | "context" 20 | pgrpc "github.com/apache/incubator-eventmesh/eventmesh-sdk-go/grpc" 21 | "github.com/apache/incubator-eventmesh/eventmesh-server-go/log" 22 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/constants" 23 | ) 24 | 25 | var messageBuilder = make(map[string]Message) 26 | 27 | // Message workflow message definition 28 | type Message interface { 29 | Publish(ctx context.Context, string, content string, properties map[string]string) error 30 | } 31 | 32 | func closeEventMeshClient(client pgrpc.Interface) { 33 | if client != nil { 34 | if err := client.Close(); err != nil { 35 | log.Get(constants.LogSchedule).Errorf("close eventmesh client error:%v", err) 36 | } 37 | } 38 | } 39 | 40 | func Builder(protocol string) Message { 41 | return messageBuilder[protocol] 42 | } 43 | -------------------------------------------------------------------------------- /internal/queue/in_memory_queue.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package queue 17 | 18 | import ( 19 | "context" 20 | "fmt" 21 | "github.com/apache/incubator-eventmesh/eventmesh-server-go/log" 22 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/constants" 23 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/dal" 24 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/dal/model" 25 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/metrics" 26 | "github.com/gogf/gf/util/gconv" 27 | "github.com/reactivex/rxgo/v2" 28 | ) 29 | 30 | func init() { 31 | RegisterQueue(newInMemoryQueue()) 32 | } 33 | 34 | type inMemoryQueue struct { 35 | ch chan rxgo.Item 36 | observable rxgo.Observable 37 | workflowDAL dal.WorkflowDAL 38 | } 39 | 40 | func newInMemoryQueue() ObserveQueue { 41 | var p inMemoryQueue 42 | p.ch = make(chan rxgo.Item) 43 | p.observable = rxgo.FromChannel(p.ch) 44 | p.workflowDAL = dal.NewWorkflowDAL() 45 | return &p 46 | } 47 | 48 | // Name returns queue's name. 49 | func (q *inMemoryQueue) Name() string { 50 | return constants.QueueTypeInMemory 51 | } 52 | 53 | func (q *inMemoryQueue) Publish(tasks []*model.WorkflowTaskInstance) error { 54 | if len(tasks) == 0 { 55 | return nil 56 | } 57 | metrics.Add(constants.MetricsTaskQueue, fmt.Sprintf("%s_%s", q.Name(), constants.MetricsQueueSize), 58 | float64(len(tasks))) 59 | for _, t := range tasks { 60 | q.ch <- rxgo.Of(t) 61 | } 62 | return nil 63 | } 64 | 65 | func (q *inMemoryQueue) Ack(tasks *model.WorkflowTaskInstance) error { 66 | return nil 67 | } 68 | 69 | func (q *inMemoryQueue) Observe() { 70 | go func() { 71 | defer func() { 72 | if err := recover(); err != nil { 73 | log.Get(constants.LogQueue).Errorf("Observe error=%+v", err) 74 | } 75 | }() 76 | for item := range q.observable.Observe() { 77 | metrics.Dec(constants.MetricsTaskQueue, fmt.Sprintf("%s_%s", q.Name(), constants.MetricsQueueSize)) 78 | q.handle(item) 79 | } 80 | }() 81 | } 82 | func (q *inMemoryQueue) handle(item rxgo.Item) { 83 | v, ok := item.V.(*model.WorkflowTaskInstance) 84 | if !ok { 85 | return 86 | } 87 | log.Get(constants.LogQueue).Infof("handle=%s", gconv.String(v)) 88 | if v.ID != 0 { 89 | if err := q.workflowDAL.UpdateTaskInstance(dal.GetDalClient(), v); err != nil { 90 | log.Get(constants.LogQueue).Errorf("Observe UpdateTaskInstance error=%v", err) 91 | } 92 | return 93 | } 94 | if err := q.workflowDAL.InsertTaskInstance(context.Background(), v); err != nil { 95 | log.Get(constants.LogQueue).Errorf("Observe InsertTaskInstance error=%v", err) 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /internal/queue/queue.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package queue 17 | 18 | import "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/dal/model" 19 | 20 | type ObserveQueue interface { 21 | Name() string 22 | 23 | Publish(tasks []*model.WorkflowTaskInstance) error 24 | 25 | Ack(tasks *model.WorkflowTaskInstance) error 26 | 27 | Observe() 28 | } 29 | 30 | var queueFactory = make(map[string]ObserveQueue) 31 | 32 | // RegisterQueue registers a queue by its name. 33 | func RegisterQueue(q ObserveQueue) { 34 | queueFactory[q.Name()] = q 35 | } 36 | 37 | // GetQueue returns the queue by name. 38 | func GetQueue(name string) ObserveQueue { 39 | return queueFactory[name] 40 | } 41 | -------------------------------------------------------------------------------- /internal/schedule/inline_scheduler.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package schedule 17 | 18 | import ( 19 | "context" 20 | "github.com/apache/incubator-eventmesh/eventmesh-server-go/log" 21 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/config" 22 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/constants" 23 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/dal" 24 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/dal/model" 25 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/filter" 26 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/metrics" 27 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/task" 28 | "github.com/avast/retry-go/v4" 29 | "gorm.io/gorm" 30 | "time" 31 | ) 32 | 33 | func init() { 34 | schedulerBuilder["in-line"] = NewInlineScheduler 35 | } 36 | 37 | const ( 38 | schedulerLockKey = "scheduler_lock" 39 | schedulerLockTimeout = 2 40 | ) 41 | 42 | type inlineScheduler struct { 43 | workflowDAL dal.WorkflowDAL 44 | } 45 | 46 | func NewInlineScheduler() Scheduler { 47 | var s inlineScheduler 48 | s.workflowDAL = dal.NewWorkflowDAL() 49 | return &s 50 | } 51 | 52 | func (s *inlineScheduler) Run() { 53 | go func() { 54 | ticker := time.NewTicker(time.Millisecond * time.Duration(config.Get().Flow.Scheduler.Interval)) 55 | defer func() { 56 | if err := recover(); err != nil { 57 | log.Get(constants.LogSchedule).Errorf("schedule run error=%+v", err) 58 | } 59 | ticker.Stop() 60 | }() 61 | 62 | for range ticker.C { 63 | s.handle() 64 | } 65 | }() 66 | } 67 | 68 | func (s *inlineScheduler) handle() { 69 | if err := dal.GetDalClient().Transaction(func(tx *gorm.DB) error { 70 | var res *model.WorkflowTaskInstance 71 | if err := s.lock(func() error { 72 | var err error 73 | res, err = s.fetchTask(tx) 74 | if err != nil { 75 | return err 76 | } 77 | return nil 78 | }); err != nil { 79 | return err 80 | } 81 | if res == nil { 82 | return nil 83 | } 84 | 85 | // filter input data 86 | filter.FilterWorkflowTaskInputData(res) 87 | 88 | t := task.New(res) 89 | if t == nil { 90 | return nil 91 | } 92 | if err := retry.Do(func() error { 93 | return t.Run() 94 | }, retry.Attempts(constants.RetryAttempts)); err != nil { 95 | return s.workflowDAL.UpdateTaskInstance(tx, &model.WorkflowTaskInstance{ID: res.ID, 96 | Status: constants.TaskInstanceFailStatus}) 97 | } 98 | return s.workflowDAL.UpdateTaskInstance(tx, &model.WorkflowTaskInstance{ID: res.ID, 99 | Status: constants.TaskInstanceSuccessStatus}) 100 | }); err != nil { 101 | log.Get(constants.LogSchedule).Errorf("handle UpdateTaskInstance error=%v", err) 102 | } 103 | } 104 | 105 | func (s *inlineScheduler) lock(h func() error) error { 106 | start := time.Now() 107 | l, err := dal.GetLockClient().ObtainTimeout(schedulerLockKey, schedulerLockTimeout) 108 | elapsed := time.Since(start).Milliseconds() 109 | metrics.RecordLatency(constants.MetricsScheduler, constants.MetricsDbLockAcquireTime, float64(elapsed)) 110 | if err != nil { 111 | return err 112 | } 113 | defer l.Release() 114 | return h() 115 | } 116 | 117 | func (s *inlineScheduler) fetchTask(tx *gorm.DB) (*model.WorkflowTaskInstance, error) { 118 | var err error 119 | res, err := s.workflowDAL.SelectTaskInstance(context.Background(), 120 | model.WorkflowTaskInstance{Status: constants.TaskInstanceWaitStatus}) 121 | if err != nil { 122 | return nil, err 123 | } 124 | if res == nil { 125 | return nil, nil 126 | } 127 | if err = s.workflowDAL.UpdateTaskInstance(tx, &model.WorkflowTaskInstance{ID: res.ID, 128 | Status: constants.TaskInstanceProcessStatus}); err != nil { 129 | return nil, err 130 | } 131 | return res, nil 132 | } 133 | -------------------------------------------------------------------------------- /internal/schedule/scheduler.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package schedule 17 | 18 | import ( 19 | "errors" 20 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/config" 21 | ) 22 | 23 | var schedulerBuilder = make(map[string]func() Scheduler) 24 | 25 | type Scheduler interface { 26 | Run() 27 | } 28 | 29 | func NewScheduler() (Scheduler, error) { 30 | scheduler := schedulerBuilder[config.Get().Flow.Scheduler.Type] 31 | if scheduler == nil { 32 | return nil, errors.New("must config scheduler type") 33 | } 34 | return scheduler(), nil 35 | } 36 | -------------------------------------------------------------------------------- /internal/task/event_task.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package task 17 | 18 | import ( 19 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/flow" 20 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/constants" 21 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/dal/model" 22 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/metrics" 23 | ) 24 | 25 | type eventTask struct { 26 | baseTask 27 | operationTask Task 28 | action *model.WorkflowTaskAction 29 | transition *model.WorkflowTaskRelation 30 | flowEngine *flow.Engine 31 | } 32 | 33 | func NewEventTask(instance *model.WorkflowTaskInstance) Task { 34 | var t eventTask 35 | if instance == nil || instance.Task == nil { 36 | return nil 37 | } 38 | t.baseTask = baseTask{taskID: instance.TaskID, taskInstanceID: instance.TaskInstanceID, input: instance.Input, 39 | workflowID: instance.WorkflowID, workflowInstanceID: instance.WorkflowInstanceID, taskType: instance.Task.TaskType} 40 | t.action = instance.Task.Actions[0] 41 | t.transition = instance.Task.ChildTasks[0] 42 | t.operationTask = NewOperationTask(instance) 43 | t.flowEngine = flow.NewEngine() 44 | return &t 45 | } 46 | 47 | func (t *eventTask) Run() error { 48 | metrics.Inc(constants.MetricsEventTask, constants.MetricsTotal) 49 | if t.transition == nil { 50 | return nil 51 | } 52 | // TODO event ref validate 53 | return t.operationTask.Run() 54 | } 55 | -------------------------------------------------------------------------------- /internal/task/operation_task.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package task 17 | 18 | import ( 19 | "context" 20 | "github.com/apache/incubator-eventmesh/eventmesh-server-go/config" 21 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/constants" 22 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/dal" 23 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/dal/model" 24 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/metrics" 25 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/queue" 26 | "github.com/google/uuid" 27 | ) 28 | 29 | type operationTask struct { 30 | baseTask 31 | action *model.WorkflowTaskAction 32 | transition *model.WorkflowTaskRelation 33 | } 34 | 35 | func NewOperationTask(instance *model.WorkflowTaskInstance) Task { 36 | var t operationTask 37 | if instance == nil || instance.Task == nil { 38 | return nil 39 | } 40 | t.baseTask = baseTask{taskID: instance.TaskID, taskInstanceID: instance.TaskInstanceID, input: instance.Input, 41 | workflowID: instance.WorkflowID, workflowInstanceID: instance.WorkflowInstanceID, taskType: instance.Task.TaskType} 42 | t.action = instance.Task.Actions[0] 43 | t.transition = instance.Task.ChildTasks[0] 44 | t.baseTask.queue = queue.GetQueue(config.GlobalConfig().Flow.Queue.Store) 45 | t.workflowDAL = dal.NewWorkflowDAL() 46 | return &t 47 | } 48 | 49 | func (t *operationTask) Run() error { 50 | metrics.Inc(constants.MetricsOperationTask, constants.MetricsTotal) 51 | if t.action == nil { 52 | return nil 53 | } 54 | // match end 55 | if t.transition.ToTaskID == constants.TaskEndID { 56 | if t.action != nil { 57 | if err := publishEvent(t.workflowInstanceID, uuid.New().String(), t.action.OperationName, t.input); err != nil { 58 | return err 59 | } 60 | } 61 | return t.workflowDAL.UpdateInstance(context.Background(), 62 | &model.WorkflowInstance{WorkflowInstanceID: t.workflowInstanceID, 63 | WorkflowStatus: constants.WorkflowInstanceSuccessStatus}) 64 | } 65 | var taskInstanceID = uuid.New().String() 66 | var taskInstance = model.WorkflowTaskInstance{WorkflowInstanceID: t.workflowInstanceID, WorkflowID: t.workflowID, 67 | TaskID: t.transition.ToTaskID, TaskInstanceID: taskInstanceID, Status: constants.TaskInstanceSleepStatus, 68 | Input: t.baseTask.input} 69 | if err := t.baseTask.queue.Publish([]*model.WorkflowTaskInstance{&taskInstance}); err != nil { 70 | return err 71 | } 72 | return publishEvent(t.workflowInstanceID, taskInstanceID, t.action.OperationName, t.input) 73 | } 74 | -------------------------------------------------------------------------------- /internal/task/switch_task.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package task 17 | 18 | import ( 19 | "context" 20 | "encoding/json" 21 | "github.com/apache/incubator-eventmesh/eventmesh-server-go/config" 22 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/constants" 23 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/dal" 24 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/dal/model" 25 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/metrics" 26 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/queue" 27 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/third_party/jqer" 28 | "github.com/gogf/gf/util/gconv" 29 | "github.com/google/uuid" 30 | "strconv" 31 | ) 32 | 33 | type switchTask struct { 34 | baseTask 35 | transitions []*model.WorkflowTaskRelation 36 | jq jqer.JQ 37 | } 38 | 39 | func NewSwitchTask(instance *model.WorkflowTaskInstance) Task { 40 | var t switchTask 41 | if instance == nil || instance.Task == nil { 42 | return nil 43 | } 44 | t.baseTask = baseTask{taskID: instance.TaskID, input: instance.Input, 45 | workflowID: instance.WorkflowID, workflowInstanceID: instance.WorkflowInstanceID, 46 | taskType: instance.Task.TaskType} 47 | t.transitions = instance.Task.ChildTasks 48 | t.baseTask.queue = queue.GetQueue(config.GlobalConfig().Flow.Queue.Store) 49 | t.workflowDAL = dal.NewWorkflowDAL() 50 | t.jq = jqer.NewJQ() 51 | return &t 52 | } 53 | 54 | func (t *switchTask) Run() error { 55 | metrics.Inc(constants.MetricsSwitchTask, constants.MetricsTotal) 56 | if len(t.transitions) == 0 { 57 | return nil 58 | } 59 | for _, transition := range t.transitions { 60 | if transition.ToTaskID == constants.TaskEndID { 61 | continue 62 | } 63 | var jqData interface{} 64 | err := json.Unmarshal([]byte(t.input), &jqData) 65 | if err != nil { 66 | return err 67 | } 68 | res, err := t.jq.One(jqData, transition.Condition) 69 | if err != nil { 70 | return err 71 | } 72 | boolValue, err := strconv.ParseBool(gconv.String(res)) 73 | if err != nil { 74 | return err 75 | } 76 | if !boolValue { 77 | metrics.Inc(constants.MetricsSwitchTask, constants.MetricsSwitchReject) 78 | continue 79 | } 80 | 81 | metrics.Inc(constants.MetricsSwitchTask, constants.MetricsSwitchPass) 82 | var taskInstance = model.WorkflowTaskInstance{WorkflowInstanceID: t.workflowInstanceID, 83 | WorkflowID: t.workflowID, TaskID: transition.ToTaskID, TaskInstanceID: uuid.New().String(), 84 | Status: constants.TaskInstanceWaitStatus, Input: t.baseTask.input} 85 | return t.baseTask.queue.Publish([]*model.WorkflowTaskInstance{&taskInstance}) 86 | } 87 | // not match 88 | return t.workflowDAL.UpdateInstance(context.Background(), 89 | &model.WorkflowInstance{WorkflowInstanceID: t.workflowInstanceID, 90 | WorkflowStatus: constants.WorkflowInstanceSuccessStatus}) 91 | } 92 | -------------------------------------------------------------------------------- /internal/task/task.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package task 17 | 18 | import ( 19 | "context" 20 | "fmt" 21 | catalog "github.com/apache/incubator-eventmesh/eventmesh-catalog-go/api/proto" 22 | pconfig "github.com/apache/incubator-eventmesh/eventmesh-server-go/config" 23 | "github.com/apache/incubator-eventmesh/eventmesh-server-go/log" 24 | "github.com/apache/incubator-eventmesh/eventmesh-server-go/pkg/naming/selector" 25 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/config" 26 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/flow" 27 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/constants" 28 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/dal" 29 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/dal/model" 30 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/protocol" 31 | "github.com/apache/incubator-eventmesh/eventmesh-workflow-go/internal/queue" 32 | "google.golang.org/grpc" 33 | "google.golang.org/grpc/credentials/insecure" 34 | "net" 35 | ) 36 | 37 | type Task interface { 38 | Run() error 39 | } 40 | 41 | type baseTask struct { 42 | taskID string 43 | taskInstanceID string 44 | workflowID string 45 | workflowInstanceID string 46 | input string 47 | taskType string 48 | queue queue.ObserveQueue 49 | workflowDAL dal.WorkflowDAL 50 | } 51 | 52 | func New(instance *model.WorkflowTaskInstance) Task { 53 | if instance == nil || instance.Task == nil { 54 | return nil 55 | } 56 | switch instance.Task.TaskType { 57 | case constants.TaskTypeOperation: 58 | return NewOperationTask(instance) 59 | case constants.TaskTypeEvent: 60 | return NewEventTask(instance) 61 | case constants.TaskTypeSwitch: 62 | return NewSwitchTask(instance) 63 | } 64 | return nil 65 | } 66 | 67 | func publishEvent(workflowInstanceID string, taskInstanceID string, operationID string, content string) error { 68 | eventCatalog, err := queryPublishCatalog(operationID) 69 | if err != nil { 70 | return err 71 | } 72 | return protocol.Builder(config.Get().Flow.Protocol).Publish(context.Background(), eventCatalog.Topic, 73 | content, 74 | map[string]string{constants.EventPropsWorkflowInstanceID: workflowInstanceID, 75 | constants.EventPropsWorkflowTaskInstanceID: taskInstanceID}) 76 | } 77 | 78 | func queryPublishCatalog(operationID string) (*flow.WorkflowEventCatalog, error) { 79 | grpcConn, err := getGRPCConn() 80 | if err != nil { 81 | return nil, err 82 | } 83 | defer closeGRPCConn(grpcConn) 84 | 85 | catalogClient := catalog.NewCatalogClient(grpcConn) 86 | rsp, err := catalogClient.QueryOperations(context.Background(), &catalog.QueryOperationsRequest{ 87 | OperationId: operationID, 88 | }) 89 | if err != nil { 90 | return nil, err 91 | } 92 | if len(rsp.Operations) == 0 { 93 | return nil, fmt.Errorf("operationID %s invalid, please check it", operationID) 94 | } 95 | operation := rsp.Operations[0] 96 | if operation.Type != constants.EventTypePublish { 97 | return nil, fmt.Errorf("operationID %s invalid, please check it", operationID) 98 | } 99 | return &flow.WorkflowEventCatalog{Topic: operation.ChannelName, Schema: operation.Schema, 100 | OperationID: operationID}, nil 101 | } 102 | 103 | func getGRPCConn() (*grpc.ClientConn, error) { 104 | namingClient := selector.Get(pconfig.GlobalConfig().Server.Name) 105 | if namingClient == nil { 106 | return nil, fmt.Errorf("naming client is not registered.please register it") 107 | } 108 | instance, err := namingClient.Select(config.Get().Catalog.ServerName) 109 | if err != nil { 110 | return nil, err 111 | } 112 | if instance == nil { 113 | return nil, fmt.Errorf("catalog client is not running.please check it") 114 | } 115 | host, port, err := net.SplitHostPort(instance.Address) 116 | if err != nil { 117 | return nil, err 118 | } 119 | addr := fmt.Sprintf("%v:%v", host, port) 120 | conn, err := grpc.Dial(addr, grpc.WithTransportCredentials(insecure.NewCredentials())) 121 | if err != nil { 122 | return nil, err 123 | } 124 | log.Get(constants.LogSchedule).Infof("success make grpc conn with:%s", addr) 125 | return conn, nil 126 | } 127 | 128 | func closeGRPCConn(conn *grpc.ClientConn) { 129 | if conn != nil { 130 | if err := conn.Close(); err != nil { 131 | log.Get(constants.LogSchedule).Errorf("close grpc conn error:%v", err) 132 | } 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /internal/util/file_utils.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package util 17 | 18 | import "os" 19 | 20 | // Exists check if the file exists 21 | func Exists(path string) bool { 22 | _, err := os.Stat(path) 23 | if err == nil { 24 | return true 25 | } 26 | return os.IsExist(err) 27 | } 28 | -------------------------------------------------------------------------------- /internal/util/flow_util.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package util 17 | 18 | import ( 19 | "runtime" 20 | "sync" 21 | 22 | "github.com/apache/incubator-eventmesh/eventmesh-server-go/log" 23 | ) 24 | 25 | // PanicBufLen is len of buffer used for stack trace logging 26 | // when the goroutine panics, 1024 by default. 27 | var PanicBufLen = 1024 28 | 29 | // GoAndWait provides safe concurrent handling. Per input handler, it starts a goroutine. 30 | // Then it waits until all handlers are done and will recover if any handler panics. 31 | // The returned error is the first non-nil error returned by one of the handlers. 32 | // It can be set that non-nil error will be returned if the "key" handler fails while other handlers always 33 | // return nil error. 34 | func GoAndWait(handlers ...func() error) error { 35 | var ( 36 | wg sync.WaitGroup 37 | once sync.Once 38 | err error 39 | ) 40 | for _, f := range handlers { 41 | wg.Add(1) 42 | go func(handler func() error) { 43 | defer func() { 44 | if e := recover(); e != nil { 45 | buf := make([]byte, PanicBufLen) 46 | buf = buf[:runtime.Stack(buf, false)] 47 | log.Errorf("[PANIC]%v\n%s\n", e, buf) 48 | } 49 | wg.Done() 50 | }() 51 | if e := handler(); e != nil { 52 | once.Do(func() { 53 | err = e 54 | }) 55 | } 56 | }(f) 57 | } 58 | wg.Wait() 59 | return err 60 | } 61 | -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-avast-retry-go-v4.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Avast 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-beorn7-perks.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013 Blake Mizerany 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-buger-jsonparser.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Leonid Bugaev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-cespare-xxhash-v2.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Caleb Spare 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-cespare-xxhash.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Caleb Spare 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-davecgh-go-spew.txt: -------------------------------------------------------------------------------- 1 | ISC License 2 | 3 | Copyright (c) 2012-2016 Dave Collins 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-fsnotify-fsnotify.txt: -------------------------------------------------------------------------------- 1 | Copyright © 2012 The Go Authors. All rights reserved. 2 | Copyright © fsnotify Authors. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright notice, this 10 | list of conditions and the following disclaimer in the documentation and/or 11 | other materials provided with the distribution. 12 | * Neither the name of Google Inc. nor the names of its contributors may be used 13 | to endorse or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-gin-contrib-sse.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Manuel Martínez-Almeida 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-gin-gonic-gin.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Manuel Martínez-Almeida 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-go-playground-locales.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Go Playground 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-go-playground-universal-translator.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Go Playground 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-go-playground-validator-v10.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Dean Karn 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-goccy-go-json.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Masaaki Goshima 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-gogf-gf.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 john@goframe.org https://goframe.org 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-golang-protobuf.txt: -------------------------------------------------------------------------------- 1 | Copyright 2010 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-google-go-cmp.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-google-uuid.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009,2014 Google Inc. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-itchyny-gojq.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019-2022 itchyny 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-jinzhu-inflection.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 - Jinzhu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-jinzhu-now.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-NOW Jinzhu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-json-iterator-go.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 json-iterator 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-leodido-go-urn.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Leonardo Di Donato 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-lestrrat-go-strftime.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 lestrrat 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-mattn-go-isatty.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) Yasuhiro MATSUMOTO 2 | 3 | MIT License (Expat) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-panjf2000-ants.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Andy Pan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-pelletier-go-toml-v2.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 - 2022 Thomas Pelletier, Eric Anderton 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-pkg-errors.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Dave Cheney 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-pmezard-go-difflib.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013, Patrick Mezard 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | The names of its contributors may not be used to endorse or promote 14 | products derived from this software without specific prior written 15 | permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 18 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 20 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 23 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 24 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 25 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 26 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-reactivex-rxgo-v2.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Joe Chasinga 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-sony-sonyflake.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright 2015 Sony Corporation 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-stretchr-objx.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2014 Stretchr, Inc. 4 | Copyright (c) 2017-2018 objx contributors 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-stretchr-testify.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2012-2020 Mat Ryer, Tyler Bunnell and contributors. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-swaggo-files.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Swaggo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-swaggo-gin-swagger.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Swaggo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-swaggo-swag.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Eason Lin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-github.com-ugorji-go.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2012-2020 Ugorji Nwoke. 4 | All rights reserved. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-go.uber.org-atomic.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Uber Technologies, Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-go.uber.org-multierr.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017-2021 Uber Technologies, Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-go.uber.org-zap.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016-2017 Uber Technologies, Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-golang.org-x-crypto.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /licenses/LICENSE-golang.org-x-net.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /licenses/LICENSE-golang.org-x-sync.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /licenses/LICENSE-golang.org-x-sys.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /licenses/LICENSE-golang.org-x-text.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /licenses/LICENSE-golang.org-x-time.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /licenses/LICENSE-golang.org-x-tools.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /licenses/LICENSE-gopkg.in-natefinch-lumberjack.v2.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Nate Finch 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-gopkg.in-yaml.v3.txt: -------------------------------------------------------------------------------- 1 | 2 | This project is covered by two different licenses: MIT and Apache. 3 | 4 | #### MIT License #### 5 | 6 | The following files were ported to Go from C files of libyaml, and thus 7 | are still covered by their original MIT license, with the additional 8 | copyright staring in 2011 when the project was ported over: 9 | 10 | apic.go emitterc.go parserc.go readerc.go scannerc.go 11 | writerc.go yamlh.go yamlprivateh.go 12 | 13 | Copyright (c) 2006-2010 Kirill Simonov 14 | Copyright (c) 2006-2011 Kirill Simonov 15 | 16 | Permission is hereby granted, free of charge, to any person obtaining a copy of 17 | this software and associated documentation files (the "Software"), to deal in 18 | the Software without restriction, including without limitation the rights to 19 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 20 | of the Software, and to permit persons to whom the Software is furnished to do 21 | so, subject to the following conditions: 22 | 23 | The above copyright notice and this permission notice shall be included in all 24 | copies or substantial portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | SOFTWARE. 33 | 34 | ### Apache License ### 35 | 36 | All the remaining project files are covered by the Apache license: 37 | 38 | Copyright (c) 2011-2019 Canonical Ltd 39 | 40 | Licensed under the Apache License, Version 2.0 (the "License"); 41 | you may not use this file except in compliance with the License. 42 | You may obtain a copy of the License at 43 | 44 | http://www.apache.org/licenses/LICENSE-2.0 45 | 46 | Unless required by applicable law or agreed to in writing, software 47 | distributed under the License is distributed on an "AS IS" BASIS, 48 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 49 | See the License for the specific language governing permissions and 50 | limitations under the License. -------------------------------------------------------------------------------- /licenses/LICENSE-gorm.io-driver-mysql.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-NOW Jinzhu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-gorm.io-gorm.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-NOW Jinzhu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /middleware/dblock/errors.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package dblock 17 | 18 | import "errors" 19 | 20 | // ErrGetLockContextCancelled is returned when user given context is cancelled while trying to obtain the lock 21 | var ErrGetLockContextCancelled = errors.New("context cancelled while trying to obtain lock") 22 | 23 | // ErrMySQLTimeout is returned when the MySQL server can't acquire the lock in the specified timeout 24 | var ErrMySQLTimeout = errors.New("(mysql) timeout while acquiring the lock") 25 | 26 | // ErrMySQLInternalError is returned when MySQL is returning a generic internal error 27 | var ErrMySQLInternalError = errors.New("internal mysql error acquiring the lock") 28 | -------------------------------------------------------------------------------- /middleware/dblock/lock.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package dblock 17 | 18 | import ( 19 | "context" 20 | "database/sql" 21 | "time" 22 | ) 23 | 24 | // Lock denotes an acquired lock and presents two methods, one for getting the context which is cancelled when the lock 25 | // is lost/released and other for Releasing the lock 26 | type Lock struct { 27 | key string 28 | conn *sql.Conn 29 | unlocker chan struct{} 30 | lostLockContext context.Context 31 | cancelFunc context.CancelFunc 32 | } 33 | 34 | // GetContext returns a context which is cancelled when the lock is lost or released 35 | func (l Lock) GetContext() context.Context { 36 | return l.lostLockContext 37 | } 38 | 39 | // Release unlocks the lock 40 | func (l Lock) Release() error { 41 | l.unlocker <- struct{}{} 42 | if _, err := l.conn.ExecContext(context.Background(), "DO RELEASE_LOCK(?)", l.key); err != nil { 43 | return err 44 | } 45 | return l.conn.Close() 46 | } 47 | 48 | func (l Lock) refresher(duration time.Duration, cancelFunc context.CancelFunc) { 49 | for { 50 | select { 51 | case <-time.After(duration): 52 | deadline := time.Now().Add(duration) 53 | contextDeadline, deadlineCancelFunc := context.WithDeadline(context.Background(), deadline) 54 | 55 | // try refresh, else cancel 56 | err := l.conn.PingContext(contextDeadline) 57 | if err != nil { 58 | cancelFunc() 59 | deadlineCancelFunc() 60 | // this will make sure connection is closed 61 | l.Release() 62 | return 63 | } 64 | deadlineCancelFunc() // to avoid context leak 65 | case <-l.unlocker: 66 | cancelFunc() 67 | return 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /middleware/dblock/lock_client.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package dblock 17 | 18 | import ( 19 | "context" 20 | "database/sql" 21 | "fmt" 22 | "time" 23 | ) 24 | 25 | // DefaultRefreshInterval is the periodic duration with which a connection is refreshed/pinged 26 | const DefaultRefreshInterval = time.Second 27 | 28 | type lockerOpt func(locker *MysqlLocker) 29 | 30 | // MysqlLocker is the client which provide APIs to obtain lock 31 | type MysqlLocker struct { 32 | db *sql.DB 33 | refreshInterval time.Duration 34 | } 35 | 36 | // NewMysqlLocker returns an instance of locker which can be used to obtain locks 37 | func NewMysqlLocker(db *sql.DB, lockerOpts ...lockerOpt) *MysqlLocker { 38 | locker := &MysqlLocker{ 39 | db: db, 40 | refreshInterval: DefaultRefreshInterval, 41 | } 42 | 43 | for _, opt := range lockerOpts { 44 | opt(locker) 45 | } 46 | 47 | return locker 48 | } 49 | 50 | // WithRefreshInterval sets the duration for refresh interval for each obtained lock 51 | func WithRefreshInterval(d time.Duration) lockerOpt { 52 | return func(l *MysqlLocker) { l.refreshInterval = d } 53 | } 54 | 55 | // Obtain tries to acquire lock (with no MySQL timeout) with background context. This call is expected to block is lock is already held 56 | func (l MysqlLocker) Obtain(key string) (*Lock, error) { 57 | return l.ObtainTimeoutContext(context.Background(), key, -1) 58 | } 59 | 60 | // ObtainTimeout tries to acquire lock with background context and a MySQL timeout. This call is expected to block is lock is already held 61 | func (l MysqlLocker) ObtainTimeout(key string, timeout int) (*Lock, error) { 62 | return l.ObtainTimeoutContext(context.Background(), key, timeout) 63 | } 64 | 65 | // ObtainContext tries to acquire lock and gives up when the given context is cancelled 66 | func (l MysqlLocker) ObtainContext(ctx context.Context, key string) (*Lock, error) { 67 | return l.ObtainTimeoutContext(ctx, key, -1) 68 | } 69 | 70 | // ObtainTimeoutContext tries to acquire lock and gives up when the given context is cancelled 71 | func (l MysqlLocker) ObtainTimeoutContext(ctx context.Context, key string, timeout int) (*Lock, error) { 72 | cancellableContext, cancelFunc := context.WithCancel(context.Background()) 73 | 74 | dbConn, err := l.db.Conn(ctx) 75 | if err != nil { 76 | cancelFunc() 77 | return nil, fmt.Errorf("failed to get a db connection: %w", err) 78 | } 79 | 80 | row := dbConn.QueryRowContext(ctx, "SELECT COALESCE(GET_LOCK(?, ?), 2)", key, timeout) 81 | 82 | var res int 83 | err = row.Scan(&res) 84 | if err != nil { 85 | // mysql error does not tell if it was due to context closing, checking it manually 86 | select { 87 | case <-ctx.Done(): 88 | cancelFunc() 89 | return nil, ErrGetLockContextCancelled 90 | default: 91 | break 92 | } 93 | cancelFunc() 94 | return nil, fmt.Errorf("could not read mysql response: %w", err) 95 | } else if res == 2 { 96 | // Internal MySQL error occurred, such as out-of-memory, thread killed or others (the doc is not clear) 97 | // Note: some MySQL/MariaDB versions (like MariaDB 10.1) does not support -1 as timeout parameters 98 | cancelFunc() 99 | return nil, ErrMySQLInternalError 100 | } else if res == 0 { 101 | // MySQL Timeout 102 | cancelFunc() 103 | return nil, ErrMySQLTimeout 104 | } 105 | 106 | lock := &Lock{ 107 | key: key, 108 | conn: dbConn, 109 | unlocker: make(chan struct{}, 1), 110 | lostLockContext: cancellableContext, 111 | cancelFunc: cancelFunc, 112 | } 113 | go lock.refresher(l.refreshInterval, cancelFunc) 114 | 115 | return lock, nil 116 | } 117 | -------------------------------------------------------------------------------- /third_party/jqer/options.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package jqer 17 | 18 | // Options config option 19 | type Options struct { 20 | WrapBegin string 21 | WrapLeftSeparator string 22 | WrapRightSeparator string 23 | } 24 | 25 | // Option represents the optional function. 26 | type Option func(opts *Options) 27 | 28 | // WithWrapBegin config wrap begin option 29 | func WithWrapBegin(wrapBegin string) Option { 30 | return func(opts *Options) { 31 | opts.WrapBegin = wrapBegin 32 | } 33 | } 34 | 35 | // WithWrapLeftSeparator config wrap left separator option 36 | func WithWrapLeftSeparator(wrapBegin string) Option { 37 | return func(opts *Options) { 38 | opts.WrapBegin = wrapBegin 39 | } 40 | } 41 | 42 | // WithWrapRightSeparator config wrap right separator option 43 | func WithWrapRightSeparator(wrapBegin string) Option { 44 | return func(opts *Options) { 45 | opts.WrapBegin = wrapBegin 46 | } 47 | } 48 | 49 | func loadOptions(options ...Option) *Options { 50 | var opts = new(Options) 51 | for _, option := range options { 52 | option(opts) 53 | } 54 | return opts 55 | } 56 | -------------------------------------------------------------------------------- /third_party/lexer/lexer.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package lexer 17 | 18 | import ( 19 | "errors" 20 | "strings" 21 | "unicode/utf8" 22 | ) 23 | 24 | type StateFunc func(*L) StateFunc 25 | 26 | type TokenType int 27 | 28 | const ( 29 | EOFRune rune = -1 30 | EmptyToken TokenType = 0 31 | ) 32 | 33 | type Token struct { 34 | Type TokenType 35 | Value string 36 | } 37 | 38 | type L struct { 39 | source string 40 | start, position int 41 | startState StateFunc 42 | Err error 43 | tokens chan Token 44 | ErrorHandler func(e string) 45 | rewind runeStack 46 | } 47 | 48 | // New creates a returns a lexer ready to parse the given source code. 49 | func New(src string, start StateFunc) *L { 50 | return &L{ 51 | source: src, 52 | startState: start, 53 | start: 0, 54 | position: 0, 55 | rewind: newRuneStack(), 56 | } 57 | } 58 | 59 | // Start begins executing the Lexer in an asynchronous manner (using a goroutine). 60 | func (l *L) Start() { 61 | // Take half the string length as a buffer size. 62 | buffSize := len(l.source) / 2 63 | if buffSize <= 0 { 64 | buffSize = 1 65 | } 66 | l.tokens = make(chan Token, buffSize) 67 | go l.run() 68 | } 69 | 70 | func (l *L) StartSync() { 71 | // Take half the string length as a buffer size. 72 | buffSize := len(l.source) / 2 73 | if buffSize <= 0 { 74 | buffSize = 1 75 | } 76 | l.tokens = make(chan Token, buffSize) 77 | l.run() 78 | } 79 | 80 | // Current returns the value being being analyzed at this moment. 81 | func (l *L) Current() string { 82 | return l.source[l.start:l.position] 83 | } 84 | 85 | // Emit will receive a token type and push a new token with the current analyzed 86 | // value into the tokens channel. 87 | func (l *L) Emit(t TokenType) { 88 | tok := Token{ 89 | Type: t, 90 | Value: l.Current(), 91 | } 92 | l.tokens <- tok 93 | l.start = l.position 94 | l.rewind.clear() 95 | } 96 | 97 | // Ignore clears the rewind stack and then sets the current beginning position 98 | // to the current position in the source which effectively ignores the section 99 | // of the source being analyzed. 100 | func (l *L) Ignore() { 101 | l.rewind.clear() 102 | l.start = l.position 103 | } 104 | 105 | // Peek performs a Next operation immediately followed by a Rewind returning the 106 | // peeked rune. 107 | func (l *L) Peek() rune { 108 | r := l.Next() 109 | l.Rewind() 110 | 111 | return r 112 | } 113 | 114 | // Rewind will take the last rune read (if any) and rewind back. Rewinds can 115 | // occur more than once per call to Next but you can never rewind past the 116 | // last point a token was emitted. 117 | func (l *L) Rewind() { 118 | r := l.rewind.pop() 119 | if r > EOFRune { 120 | size := utf8.RuneLen(r) 121 | l.position -= size 122 | if l.position < l.start { 123 | l.position = l.start 124 | } 125 | } 126 | } 127 | 128 | // Next pulls the next rune from the Lexer and returns it, moving the position 129 | // forward in the source. 130 | func (l *L) Next() rune { 131 | var ( 132 | r rune 133 | s int 134 | ) 135 | str := l.source[l.position:] 136 | if len(str) == 0 { 137 | r, s = EOFRune, 0 138 | } else { 139 | r, s = utf8.DecodeRuneInString(str) 140 | } 141 | l.position += s 142 | l.rewind.push(r) 143 | 144 | return r 145 | } 146 | 147 | // Take receives a string containing all acceptable strings and will contine 148 | // over each consecutive character in the source until a token not in the given 149 | // string is encountered. This should be used to quickly pull token parts. 150 | func (l *L) Take(chars string) { 151 | r := l.Next() 152 | for strings.ContainsRune(chars, r) { 153 | r = l.Next() 154 | } 155 | l.Rewind() // last next wasn't a match 156 | } 157 | 158 | // NextToken returns the next token from the lexer and a value to denote whether 159 | // or not the token is finished. 160 | func (l *L) NextToken() (*Token, bool) { 161 | if tok, ok := <-l.tokens; ok { 162 | return &tok, false 163 | } else { 164 | return nil, true 165 | } 166 | } 167 | 168 | // Partial yyLexer implementation 169 | 170 | func (l *L) Error(e string) { 171 | if l.ErrorHandler != nil { 172 | l.Err = errors.New(e) 173 | l.ErrorHandler(e) 174 | } else { 175 | panic(e) 176 | } 177 | } 178 | 179 | // Private methods 180 | 181 | func (l *L) run() { 182 | state := l.startState 183 | for state != nil { 184 | state = state(l) 185 | } 186 | close(l.tokens) 187 | } 188 | -------------------------------------------------------------------------------- /third_party/lexer/rune_stack.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package lexer 17 | 18 | type runeNode struct { 19 | r rune 20 | next *runeNode 21 | } 22 | 23 | type runeStack struct { 24 | start *runeNode 25 | } 26 | 27 | func newRuneStack() runeStack { 28 | return runeStack{} 29 | } 30 | 31 | func (s *runeStack) push(r rune) { 32 | node := &runeNode{r: r} 33 | if s.start == nil { 34 | s.start = node 35 | } else { 36 | node.next = s.start 37 | s.start = node 38 | } 39 | } 40 | 41 | func (s *runeStack) pop() rune { 42 | if s.start == nil { 43 | return EOFRune 44 | } 45 | 46 | n := s.start 47 | s.start = n.next 48 | return n.r 49 | } 50 | 51 | func (s *runeStack) clear() { 52 | s.start = nil 53 | } 54 | -------------------------------------------------------------------------------- /third_party/swf/swf.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package swf 17 | 18 | import ( 19 | "github.com/gogf/gf/util/gconv" 20 | "github.com/serverlessworkflow/sdk-go/v2/model" 21 | "github.com/serverlessworkflow/sdk-go/v2/parser" 22 | ) 23 | 24 | func Parse(source string) (*model.Workflow, error) { 25 | if len(source) == 0 { 26 | return nil, nil 27 | } 28 | return parser.FromYAMLSource(gconv.Bytes(source)) 29 | } 30 | -------------------------------------------------------------------------------- /third_party/swf/swf_test.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package swf 17 | 18 | import ( 19 | "testing" 20 | 21 | "github.com/gogf/gf/util/gconv" 22 | "github.com/serverlessworkflow/sdk-go/v2/model" 23 | "github.com/stretchr/testify/assert" 24 | ) 25 | 26 | func Test_Parse(t *testing.T) { 27 | var source = "id: storeorderworkflow\nversion: '1.0'\nspecVersion: '0.8'\nname: Store Order Management Workflow\nstart: Receive New Order Event\nstates:\n - name: Receive New Order Event\n type: event\n onEvents:\n - eventRefs:\n - NewOrderEvent\n actions:\n - functionRef:\n refName: \"OrderServiceSendEvent\"\n transition: Check New Order Result\n - name: Check New Order Result\n type: switch\n dataConditions:\n - name: New Order Successfull\n condition: \"${{ .order.order_no != '' }}\"\n transition: Send Order Payment\n - name: New Order Failed\n condition: \"${{ .order.order_no == '' }}\"\n end: true\n defaultCondition:\n end: true\n - name: Send Order Payment\n type: operation\n actions:\n - functionRef:\n refName: \"PaymentServiceSendEvent\"\n transition: Check Payment Status\n - name: Check Payment Status\n type: switch\n dataConditions:\n - name: Payment Successfull\n condition: \"${{ .payment.order_no != '' }}\"\n transition: Send Order Shipment\n - name: Payment Denied\n condition: \"${{ .payment.order_no == '' }}\"\n end: true\n defaultCondition:\n end: true\n - name: Send Order Shipment\n type: operation\n actions:\n - functionRef:\n refName: \"ShipmentServiceSendEvent\"\n end: true\nevents:\n - name: NewOrderEvent\n source: store/order\n type: online.store.newOrder\nfunctions:\n - name: OrderServiceSendEvent\n operation: file://orderService.yaml#sendOrder\n type: asyncapi\n - name: PaymentServiceSendEvent\n operation: file://paymentService.yaml#sendPayment\n type: asyncapi\n - name: ShipmentServiceSendEvent\n operation: file://shipmentService.yaml#sendShipment\n type: asyncapi\n" 28 | wf, err := Parse(source) 29 | t.Log(gconv.String(wf)) 30 | assert.Nil(t, err) 31 | assert.False(t, wf.States[1].(*model.DataBasedSwitchState).DefaultCondition.End.Terminate) 32 | } 33 | -------------------------------------------------------------------------------- /third_party/swf/testdata/greeting.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | id: storeorderworkflow 18 | version: '1.0' 19 | specVersion: '0.8' 20 | name: Store Order Management Workflow 21 | start: Receive New Order Event 22 | states: 23 | - name: Receive New Order Event 24 | type: event 25 | onEvents: 26 | - eventRefs: 27 | - NewOrderEvent 28 | actions: 29 | - functionRef: 30 | refName: "OrderServiceSendEvent" 31 | transition: Check New Order Result 32 | - name: Check New Order Result 33 | type: switch 34 | dataConditions: 35 | - name: New Order Successfull 36 | condition: "${{ .order.order_no != '' }}" 37 | transition: Send Order Payment 38 | - name: New Order Failed 39 | condition: "${{ .order.order_no == '' }}" 40 | end: true 41 | defaultCondition: 42 | end: true 43 | - name: Send Order Payment 44 | type: operation 45 | actions: 46 | - functionRef: 47 | refName: "PaymentServiceSendEvent" 48 | transition: Check Payment Status 49 | - name: Check Payment Status 50 | type: switch 51 | dataConditions: 52 | - name: Payment Successfull 53 | condition: "${{ .payment.order_no != '' }}" 54 | transition: Send Order Shipment 55 | - name: Payment Denied 56 | condition: "${{ .payment.order_no == '' }}" 57 | end: true 58 | defaultCondition: 59 | end: true 60 | - name: Send Order Shipment 61 | type: operation 62 | actions: 63 | - functionRef: 64 | refName: "ShipmentServiceSendEvent" 65 | end: true 66 | events: 67 | - name: NewOrderEvent 68 | source: store/order 69 | type: online.store.newOrder 70 | functions: 71 | - name: OrderServiceSendEvent 72 | operation: file://orderService.yaml#sendOrder 73 | type: asyncapi 74 | - name: PaymentServiceSendEvent 75 | operation: file://paymentService.yaml#sendPayment 76 | type: asyncapi 77 | - name: ShipmentServiceSendEvent 78 | operation: file://shipmentService.yaml#sendShipment 79 | type: asyncapi 80 | --------------------------------------------------------------------------------