Skip to content

Commit 530e09f

Browse files
authored
Merge pull request #1096 from kaleido-io/idempotent-apis
Idempotent apis
2 parents 14db324 + deddc41 commit 530e09f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1677
-1431
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"autometa",
1010
"bifactory",
1111
"blobstore",
12+
"blockchainids",
1213
"breq",
1314
"ccache",
1415
"contractlisteners",
@@ -41,6 +42,8 @@
4142
"fftypes",
4243
"finalizers",
4344
"Hyperledger",
45+
"Idempotency",
46+
"idempotencykey",
4447
"IDUUID",
4548
"Infof",
4649
"IPFS",
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
BEGIN;
2+
3+
DROP INDEX transactions_idempotency_keys;
4+
DROP INDEX messages_idempotency_keys;
5+
6+
ALTER TABLE transactions DROP COLUMN idempotency_key;
7+
ALTER TABLE messages DROP COLUMN idempotency_key;
8+
9+
COMMIT;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
BEGIN;
2+
3+
ALTER TABLE transactions ADD COLUMN idempotency_key VARCHAR(256);
4+
ALTER TABLE messages ADD COLUMN idempotency_key VARCHAR(256);
5+
6+
CREATE UNIQUE INDEX transactions_idempotency_keys ON transactions (namespace, idempotency_key);
7+
CREATE UNIQUE INDEX messages_idempotency_keys ON messages (namespace, idempotency_key);
8+
9+
COMMIT;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
DROP INDEX transactions_idempotency_keys;
2+
DROP INDEX messages_idempotency_keys;
3+
4+
ALTER TABLE transactions DROP COLUMN idempotency_key;
5+
ALTER TABLE messages DROP COLUMN idempotency_key;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ALTER TABLE transactions ADD COLUMN idempotency_key VARCHAR(256);
2+
ALTER TABLE messages ADD COLUMN idempotency_key VARCHAR(256);
3+
4+
CREATE UNIQUE INDEX transactions_idempotency_keys ON transactions (namespace, idempotency_key);
5+
CREATE UNIQUE INDEX messages_idempotency_keys ON messages (namespace, idempotency_key);

docs/reference/types/message.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ nav_order: 15
6464
| `confirmed` | The timestamp of when the message was confirmed/rejected | [`FFTime`](simpletypes#fftime) |
6565
| `data` | The list of data elements attached to the message | [`DataRef[]`](#dataref) |
6666
| `pins` | For private messages, a unique pin hash:nonce is assigned for each topic | `string[]` |
67+
| `idempotencyKey` | An optional unique identifier for a message. Cannot be duplicated within a namespace, thus allowing idempotent submission of messages to the API. Local only - not transferred when the message is sent to other members of the network | `IdempotencyKey` |
6768

6869
## MessageHeader
6970

docs/reference/types/transaction.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@ nav_order: 6
4242
| `namespace` | The namespace of the FireFly transaction | `string` |
4343
| `type` | The type of the FireFly transaction | `FFEnum`:<br/>`"none"`<br/>`"unpinned"`<br/>`"batch_pin"`<br/>`"network_action"`<br/>`"token_pool"`<br/>`"token_transfer"`<br/>`"contract_deploy"`<br/>`"contract_invoke"`<br/>`"token_approval"`<br/>`"data_publish"` |
4444
| `created` | The time the transaction was created on this node. Note the transaction is individually created with the same UUID on each participant in the FireFly transaction | [`FFTime`](simpletypes#fftime) |
45+
| `idempotencyKey` | An optional unique identifier for a transaction. Cannot be duplicated within a namespace, thus allowing idempotent submission of transactions to the API | `IdempotencyKey` |
4546
| `blockchainIds` | The blockchain transaction ID, in the format specific to the blockchain involved in the transaction. Not all FireFly transactions include a blockchain. FireFly transactions are extensible to support multiple blockchain transactions | `string[]` |
4647

0 commit comments

Comments
 (0)