-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add owner/creator to LinearState to allow ordering by "mine" records first #7139
Comments
Automatically created Jira issue: CORDA-4240 |
HI, If you have a custom schema for your state you could add an issuer column and store the issuer in that column. Then use this to determine which states are yours. |
@adelel1 Issuer column is not enough to achieve "sorting by mine first" because you cannot pass your Party to "ORDER BY" clause. With issuer column only it would be possible to sort by issuer name which is not the same as take mine states first/last. In the end I think that something like issuer/creator/owner should be part of the LinearState, just to know who created that state. |
HI, Your workaround seems reasonable. To add issuer to linear state would be an enhancement request. There is an internal Jira ticket CORDA-4240 created to track this. |
@adelel1 One of the problem with my solution is that inside of a XState I'm extracting something from flow, in this case current Party. It is not perfect, because ideally I would like to get account, but since I'm in context of a contract.jar I cannot use anything from workflows.jar.
I saw one of the ticket (https://r3-cev.atlassian.net/browse/CORDA-4229) which was suggesting to move state to persistent state migration to workflows. That would be perfect because then we could use workflow stuff. |
LinearState has a list of participants which will be automatically notified about changes etc.
Let's say that I have 2 nodes and on both nodes I created 2 states and shared them between nodes, by adding both parties on their participants list, for example:
PARTY_A: state1 (PARTY_A, PARTY_B)
PARTY_B: state2 (PARTY_B, PARTY_A)
PARTY_A: state3 (PARTY_A, PARTY_B)
PARTY_B: state4 (PARTY_B, PARTY_A)
let's say that states implement PersistableState, meaning that in DB both nodes has vault_states records [state1, state2, state3, state4].
My need is now to get all RELEVANT (where my party is on participants list) states but order them by putting mine records first, e.g.
state1 (originally created by PARTY_A)
state3 (originally created by PARTY_A)
state2 (originally created by PARTY_B)
state4 (originally created by PARTY_B)
How can I achieve that? Is it even possible? I was able to achieve that but my solution looks hacky.
The text was updated successfully, but these errors were encountered: