@dontirun/state-machine-semaphore 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +6 -3
- package/README.md +1 -1
- package/lib/index.js +1 -1
- package/package.json +5 -1
package/.jsii
CHANGED
|
@@ -2989,7 +2989,7 @@
|
|
|
2989
2989
|
},
|
|
2990
2990
|
"name": "@dontirun/state-machine-semaphore",
|
|
2991
2991
|
"readme": {
|
|
2992
|
-
"markdown": "# @dontirun/state-machine-semaphore\n\n[](https://img.shields.io/npm/v/@dontirun/state-machine-semaphore)\n[](https://pypi.org/project/state-machine-semaphore)\n[](https://www.nuget.org/packages/Dontirun.StateMachineSemaphore)\n[](https://search.maven.org/artifact/io.github.dontirun/statemachinesemaphore)\n[](https://img.shields.io/npm/v/@dontirun/state-machine-semaphore)\n[](https://pypi.org/project/state-machine-semaphore)\n[](https://www.nuget.org/packages/Dontirun.StateMachineSemaphore)\n[](https://search.maven.org/artifact/io.github.dontirun/statemachinesemaphore)\n[](https://pkg.go.dev/github.com/dontirun/state-machine-semaphore-go)\n\n[](https://constructs.dev/packages/@dontirun/state-machine-semaphore)\n\nAn [aws-cdk](https://github.com/aws/aws-cdk) construct that enables you to use AWS Step Functions to control concurrency in your distributed system. You can use this construct to distributed state machine semaphores to control concurrent invocations of contentious work.\n\nThis construct is based off of [Justin Callison's](https://github.com/JustinCallison) example [code](https://github.com/aws-samples/aws-stepfunctions-examples/blob/main/sam/app-control-concurrency-with-dynamodb/statemachines/dynamodb-semaphore.asl.json). Make sure to check out Justin's [blogpost](https://aws.amazon.com/blogs/compute/controlling-concurrency-in-distributed-systems-using-aws-step-functions/) to learn about how the system works.\n\n## Examples\n\n### Example 1) A state machine with a controlled job\n\n<details>\n\n<summary>Click to see code</summary>\n\n```typescript\nimport { Function } from 'aws-cdk-lib/aws-lambda';\nimport { Duration, Stack, StackProps } from 'aws-cdk-lib';\nimport { StateMachine, Succeed, Wait, WaitTime } from 'aws-cdk-lib/aws-stepfunctions';\nimport { LambdaInvoke } from 'aws-cdk-lib/aws-stepfunctions-tasks';\nimport { Construct } from 'constructs';\nimport { Semaphore } from '@dontirun/state-machine-semaphore';\n\n\nexport class CdkTestStack extends Stack {\n constructor(scope: Construct, id: string, props?: StackProps) {\n super(scope, id, props);\n\n const contestedJob = new LambdaInvoke(this, 'ContestedJobPart1', {\n lambdaFunction: Function.fromFunctionName(this, 'JobFunctionPart1', 'cool-function'),\n }).next(new Wait(this, 'Wait', { time: WaitTime.duration(Duration.seconds(7)) }))\n .next(new Wait(this, 'AnotherWait', { time: WaitTime.duration(Duration.seconds(7)) }))\n .next(new Wait(this, 'YetAnotherWait', { time: WaitTime.duration(Duration.seconds(7)) }));\n\n const afterContestedJob = new Succeed(this, 'Succeed');\n\n const stateMachineFragment = new Semaphore(stack, 'Semaphore', { lockName: 'life', limit: 42, job: contestedJob, nextState: afterContestedJob });\n\n new StateMachine(this, 'StateMachine', {\n definition: stateMachineFragment,\n });\n }\n}\n```\n\n</details>\n\n\n<details>\n\n<summary>Click to see the state machine definition</summary>\n\n\n</details>\n\n\n### Example 2) A state machine with multiple semaphores\n\n<details>\n\n<summary>Click to see code</summary>\n\n```typescript\nimport { Function } from 'aws-cdk-lib/aws-lambda';\nimport { Duration, Stack, StackProps } from 'aws-cdk-lib';\nimport { StateMachine, Succeed, Wait, WaitTime } from 'aws-cdk-lib/aws-stepfunctions';\nimport { LambdaInvoke } from 'aws-cdk-lib/aws-stepfunctions-tasks';\nimport { Construct } from 'constructs';\nimport { Semaphore } from '@dontirun/state-machine-semaphore';\n\n\nexport class CdkTestStack extends Stack {\n constructor(scope: Construct, id: string, props?: StackProps) {\n super(scope, id, props);\n\n const contestedJob = new LambdaInvoke(this, 'ContestedJobPart1', {\n lambdaFunction: Function.fromFunctionName(this, 'JobFunctionPart1', 'cool-function'),\n })\n const notContestedJob = new LambdaInvoke(this, 'NotContestedJob', {\n lambdaFunction: Function.fromFunctionName(this, 'NotContestedJobFunction', 'cooler-function'),\n })\n const contestedJob2 = new LambdaInvoke(this, 'ContestedJobPart2', {\n lambdaFunction: Function.fromFunctionName(this, 'JobFunctionPart2', 'coolest-function'),\n })\n const afterContestedJob2 = new Succeed(this, 'Succeed');\n\n const definition = new Semaphore(stack, 'Semaphore', { lockName: 'life', limit: 42, job: contestedJob, nextState: notContestedJob })\n .next(new Semaphore(stack, 'Semaphore2', { lockName: 'liberty', limit: 7, job: contestedJob2, nextState: afterContestedJob2 }));\n\n new StateMachine(this, 'StateMachine', {\n definition: definition,\n });\n }\n}\n```\n\n</details>\n\n<details>\n\n<summary>Click to see the state machine definition</summary>\n\n\n</details>\n\n## API Reference\n\nSee [API.md](./API.md).\n\n## License\n\nThis project is licensed under the Apache-2.0 License.\n"
|
|
2993
2993
|
},
|
|
2994
2994
|
"repository": {
|
|
2995
2995
|
"type": "git",
|
|
@@ -3001,6 +3001,9 @@
|
|
|
3001
3001
|
"namespace": "Dontirun.StateMachineSemaphore",
|
|
3002
3002
|
"packageId": "Dontirun.StateMachineSemaphore"
|
|
3003
3003
|
},
|
|
3004
|
+
"go": {
|
|
3005
|
+
"moduleName": "github.com/dontirun/state-machine-semaphore-go"
|
|
3006
|
+
},
|
|
3004
3007
|
"java": {
|
|
3005
3008
|
"maven": {
|
|
3006
3009
|
"artifactId": "statemachinesemaphore",
|
|
@@ -3305,6 +3308,6 @@
|
|
|
3305
3308
|
"symbolId": "src/index:TableReadWriteCapacity"
|
|
3306
3309
|
}
|
|
3307
3310
|
},
|
|
3308
|
-
"version": "0.1.
|
|
3309
|
-
"fingerprint": "
|
|
3311
|
+
"version": "0.1.5",
|
|
3312
|
+
"fingerprint": "fXEIp1IWqvvUDspXYq6w2bwJeik7yzJsySpRi36LKDY="
|
|
3310
3313
|
}
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://pypi.org/project/state-machine-semaphore)
|
|
5
5
|
[](https://www.nuget.org/packages/Dontirun.StateMachineSemaphore)
|
|
6
6
|
[](https://search.maven.org/artifact/io.github.dontirun/statemachinesemaphore)
|
|
7
|
-
[](https://pkg.go.dev/github.com/dontirun/state-machine-semaphore-go)
|
|
8
8
|
|
|
9
9
|
[](https://constructs.dev/packages/@dontirun/state-machine-semaphore)
|
|
10
10
|
|
package/lib/index.js
CHANGED
|
@@ -176,7 +176,7 @@ class Semaphore extends aws_stepfunctions_1.StateMachineFragment {
|
|
|
176
176
|
}
|
|
177
177
|
exports.Semaphore = Semaphore;
|
|
178
178
|
_a = JSII_RTTI_SYMBOL_1;
|
|
179
|
-
Semaphore[_a] = { fqn: "@dontirun/state-machine-semaphore.Semaphore", version: "0.1.
|
|
179
|
+
Semaphore[_a] = { fqn: "@dontirun/state-machine-semaphore.Semaphore", version: "0.1.5" };
|
|
180
180
|
/**
|
|
181
181
|
* The names and associated concurrency limits and number of uses of the sempahores.
|
|
182
182
|
*/
|
package/package.json
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"package": "npx projen package",
|
|
19
19
|
"package-all": "npx projen package-all",
|
|
20
20
|
"package:dotnet": "npx projen package:dotnet",
|
|
21
|
+
"package:go": "npx projen package:go",
|
|
21
22
|
"package:java": "npx projen package:java",
|
|
22
23
|
"package:js": "npx projen package:js",
|
|
23
24
|
"package:python": "npx projen package:python",
|
|
@@ -75,7 +76,7 @@
|
|
|
75
76
|
],
|
|
76
77
|
"main": "lib/index.js",
|
|
77
78
|
"license": "Apache-2.0",
|
|
78
|
-
"version": "0.1.
|
|
79
|
+
"version": "0.1.5",
|
|
79
80
|
"jest": {
|
|
80
81
|
"testMatch": [
|
|
81
82
|
"<rootDir>/src/**/__tests__/**/*.ts?(x)",
|
|
@@ -135,6 +136,9 @@
|
|
|
135
136
|
"dotnet": {
|
|
136
137
|
"namespace": "Dontirun.StateMachineSemaphore",
|
|
137
138
|
"packageId": "Dontirun.StateMachineSemaphore"
|
|
139
|
+
},
|
|
140
|
+
"go": {
|
|
141
|
+
"moduleName": "github.com/dontirun/state-machine-semaphore-go"
|
|
138
142
|
}
|
|
139
143
|
},
|
|
140
144
|
"tsc": {
|