Skip to content

Commit

Permalink
Merge pull request #5 from numary/feature/property-ledger
Browse files Browse the repository at this point in the history
feature/property ledger
  • Loading branch information
gfyrag authored Aug 19, 2022
2 parents 3e530fc + c4cdf99 commit 0df0c70
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
6 changes: 3 additions & 3 deletions benthos/committed_transactions.blobl
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ map committedTransactions {
"_index": env("OPENSEARCH_INDEX"),
"_id": "TRANSACTION-%s-%s".format(this.ledger, t.data.txid)
}
}, t.merge({
}, t.assign({"data": {"ledger": this.ledger}}).merge({
"when": this.date,
"ledger": this.ledger
})]).
Expand All @@ -91,7 +91,7 @@ map committedTransactions {
"_index": env("OPENSEARCH_INDEX"),
"_id": "ASSET-%s-%s-%s".format(this.ledger, t.data.account, t.data.name)
}
}, t.merge({
}, t.assign({"data": {"ledger": this.ledger}}).merge({
"when": this.date,
"ledger": this.ledger
})]).
Expand All @@ -109,7 +109,7 @@ map committedTransactions {
"_index": env("OPENSEARCH_INDEX"),
"_id": "ACCOUNT-%s-%s".format(this.ledger, t.upsert.data.address)
}
}, t]).
}, t.assign({"upsert": {"data": {"ledger": this.ledger}}})]).
flatten(),
].flatten()
}
Expand Down
21 changes: 13 additions & 8 deletions benthos/committed_transactions_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ tests:
- json_equals: [
{
"index": {
"_id": "TRANSACTION-foo-test-22",
"_id": "TRANSACTION-test-22",
"_index": "ledger"
}
},
Expand All @@ -58,7 +58,8 @@ tests:
],
"reference": "",
"timestamp": "2022-03-16T13:11:38Z",
"txid": 22
"txid": 22,
"ledger": "test"
},
"indexed": {
"amount": [
Expand All @@ -83,7 +84,7 @@ tests:
},
{
"index": {
"_id": "ASSET-foo-test-bank-USD",
"_id": "ASSET-test-bank-USD",
"_index": "ledger"
}
},
Expand All @@ -93,6 +94,7 @@ tests:
"input": 1000,
"name": "USD",
"output": 0,
"ledger": "test"
},
"indexed": {
"name": "USD",
Expand All @@ -104,7 +106,7 @@ tests:
},
{
"index": {
"_id": "ASSET-foo-test-world-USD",
"_id": "ASSET-test-world-USD",
"_index": "ledger"
}
},
Expand All @@ -114,6 +116,7 @@ tests:
"input": 0,
"name": "USD",
"output": 1000,
"ledger": "test"
},
"indexed": {
"name": "USD",
Expand All @@ -125,7 +128,7 @@ tests:
},
{
"update": {
"_id": "ACCOUNT-foo-test-bank",
"_id": "ACCOUNT-test-bank",
"_index": "ledger"
}
},
Expand All @@ -152,7 +155,8 @@ tests:
"input": 1000,
"output": 0
}
}
},
"ledger": "test"
},
"indexed": {
"address": "bank"
Expand All @@ -164,7 +168,7 @@ tests:
},
{
"update": {
"_id": "ACCOUNT-foo-test-world",
"_id": "ACCOUNT-test-world",
"_index": "ledger"
}
},
Expand All @@ -191,7 +195,8 @@ tests:
"input": 0,
"output": 1000
}
}
},
"ledger": "test"
},
"indexed": {
"address": "world"
Expand Down
3 changes: 2 additions & 1 deletion benthos/saved_metadata.blobl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ map savedMetadata {
"address": this.payload.targetId,
"volumes": {},
"balances": {},
"metadata": this.payload.metadata
"metadata": this.payload.metadata,
"ledger": this.ledger
},
"indexed": {
"address": this.payload.targetId
Expand Down
5 changes: 3 additions & 2 deletions benthos/saved_metadata_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ tests:
-
- json_equals: [{
"update": {
"_id": "TRANSACTION-foo-test-22",
"_id": "TRANSACTION-test-22",
"_index": "ledger"
}
},
Expand All @@ -39,7 +39,8 @@ tests:
"foo": "bar",
"test": "\"quoted-field\""
},
"volumes": { }
"volumes": { },
"ledger": "test"
},
"indexed": {
"address": "22"
Expand Down

0 comments on commit 0df0c70

Please sign in to comment.