-
Notifications
You must be signed in to change notification settings - Fork 8
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
feat(mediator) : Add TTL for message collection #290
Conversation
mediator/src/main/scala/org/hyperledger/identus/mediator/db/DataModels.scala
Show resolved
Hide resolved
mediator/src/main/scala/org/hyperledger/identus/mediator/db/UserAccountRepo.scala
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the documentation in README I think it looks good
update time stamp field from String to Intant Update initdb.js Add migration script for ttl
f15a602
to
be8a59b
Compare
#### Mediator storage | ||
- The `messages` collection contains two types of messages: `Mediator` and `User`. | ||
1. **Mediator Messages**: | ||
- These messages received by mediator for any interactions with the mediator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The mediator receives these messages for any interactions with the mediator.
1. **Mediator Messages**: | ||
- These messages received by mediator for any interactions with the mediator. | ||
- Examples include messages for setting up mediation, requesting mediation, or picking up messages from the mediator. | ||
- These messages stored in collection can be used for debugging purpose mediator functionality and interactions with the mediator. Hence they can be deleted after a period of time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The messages stored in the collection are usable for debugging purposes, mediator functionality, and interactions with the mediator. Hence, after a predetermined period, deleting them is possible.
- These messages received by mediator for any interactions with the mediator. | ||
- Examples include messages for setting up mediation, requesting mediation, or picking up messages from the mediator. | ||
- These messages stored in collection can be used for debugging purpose mediator functionality and interactions with the mediator. Hence they can be deleted after a period of time. | ||
- This message type `Mediator` can be setup to have a configurable Time-To-Live (TTL) value, after which they can expire. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- This message type `Mediator` can be set up to have a configurable Time-To-Live (TTL) value, after which they can expire.
- Examples include messages for setting up mediation, requesting mediation, or picking up messages from the mediator. | ||
- These messages stored in collection can be used for debugging purpose mediator functionality and interactions with the mediator. Hence they can be deleted after a period of time. | ||
- This message type `Mediator` can be setup to have a configurable Time-To-Live (TTL) value, after which they can expire. | ||
- This is how the TTL can be configured for the collection messages [initdb.js](initdb.js) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- This is how the TTL is configurable for the collection messages initdb.js
- This message type `Mediator` can be setup to have a configurable Time-To-Live (TTL) value, after which they can expire. | ||
- This is how the TTL can be configured for the collection messages [initdb.js](initdb.js) | ||
2. **User Messages**: | ||
- These are the actual messages e.g like the Forward message from the mediator, contain a `User` message inside. This inside message is stored as type `User` to be delivered to user. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- These are the actual messages, e.g. the Forward message from the mediator, containing a
User
message inside. This inside message gets stored asUser
deliverable to the user.
- This is how the TTL can be configured for the collection messages [initdb.js](initdb.js) | ||
2. **User Messages**: | ||
- These are the actual messages e.g like the Forward message from the mediator, contain a `User` message inside. This inside message is stored as type `User` to be delivered to user. | ||
- They do not have a TTL, and will persist in the system until the user retrieves them using a pickup protocol and deletes them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- They do not have a TTL and will persist in the system until the user retrieves them using a pickup protocol and deletes them.
- They do not have a TTL, and will persist in the system until the user retrieves them using a pickup protocol and deletes them. | ||
- The mediator is responsible for storing and making these user messages available for delivery to the intended recipients. | ||
|
||
ℹ️ For existing users, please utilize the migration script [migration_mediator_collection.js](migration_mediator_collection.js) to migrate the collection. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
::: info
For existing users, please utilize the migration script migration_mediator_collection.js to migrate the collection.
:::
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not valid in markdown file :::info
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Requested changes
https://github.com/input-output-hk/atala-prism-mediator/pull/292/files |
Add TTL for message collection to do house keeping update time stamp field from String to Intant Update initdb.js Add migration script for ttl
Add TTL for message collection to do house keeping update time stamp field from String to Intant Update initdb.js Add migration script for ttl Signed-off-by: Shailesh <Patil>
Add TTL for message collection to do house keeping update time stamp field from String to Intant Update initdb.js Add migration script for ttl Signed-off-by: Shailesh <Patil>
Add TTL for message collection to do house keeping update time stamp field from String to Intant Update initdb.js Add migration script for ttl Signed-off-by: Shailesh Patil <53746241+mineme0110@users.noreply.github.com>
Add TTL for message collection to do house keeping update time stamp field from String to Intant Update initdb.js Add migration script for ttl Signed-off-by: Shailesh Patil <53746241+mineme0110@users.noreply.github.com> Signed-off-by: mineme0110 <shailesh.patil@iohk.io>
Add TTL for message collection to do house keeping update time stamp field from String to Intant Update initdb.js Add migration script for ttl Signed-off-by: Shailesh Patil <53746241+mineme0110@users.noreply.github.com> Signed-off-by: Shailesh Patil <shailesh.patil@iohk.io>
Add TTL for message collection to do house keeping update time stamp field from String to Intant Update initdb.js Add migration script for ttl Signed-off-by: Shailesh Patil <53746241+mineme0110@users.noreply.github.com> Signed-off-by: Shailesh Patil <shailesh.patil@iohk.io>
Add TTL for message collection to do house keeping update time stamp field from String to Intant Update initdb.js Add migration script for ttl Signed-off-by: Shailesh Patil <53746241+mineme0110@users.noreply.github.com> Signed-off-by: Shailesh Patil <shailesh.patil@iohk.io>
Description:
Storing every message received by the mediator in the messages collection can lead to significant growth in the collection size. However, not all received messages need to be kept once the relevant action is completed, except for those intended for delivery to the recipient. Therefore, implementing a TTL index for the messages collection, with a filter to expire mediator messages, would optimize storage usage and efficiency.
Alternatives Considered (optional):
Checklist: