A database will be created for each account and used by LRC to retrieve
information pertinent to organizing conversations and their respective
interactions. The vCards of peers are stored in files containing extra
profile data that may synchronized via during calls and contact requests.
Jami vCards will include avatars and display names and may include other
meta-data in the future.
1. Database schema
Table 1: Conversations
Table conversations { id INT [pk] participant TEXT // uri of the participant extra_data TEXT // JSON reserved for metadata}extra_data {}index on participant
Table 2: Interactions
Table interactions { id INT [pk] author TEXT // uri of author (empty if outgoing) conversation INT // conversation's id timestamp INT // time of interaction body TEXT // msg body type TEXT // text representation of interaction::Type status TEXT // text representation of interaction::Status is_read INT // non-zero if the interaction has been read daemon_id BIGINT // internal message id extra_data TEXT // JSON reserved for metadata}extra_data { duration // duration of call in seconds (interactions of type:CALL)}foreign key bind: interactions.conversation > conversations.idindex on (author, timestamp)
2. Enumerations
enum class Type { INVALID, TEXT, CALL, CONTACT, DATA_TRANSFER, COUNT__}
enum class Status { INVALID, UNKNOWN, SENDING, FAILURE, SUCCESS, TRANSFER_CREATED, TRANSFER_ACCEPTED, TRANSFER_CANCELED, TRANSFER_ERROR, TRANSFER_UNJOINABLE_PEER, TRANSFER_ONGOING, TRANSFER_AWAITING_PEER, TRANSFER_AWAITING_HOST, TRANSFER_TIMEOUT_EXPIRED, TRANSFER_FINISHED, COUNT__}
interactions.extra_data: How would call duration be stored for incoming calls ?
Since we know who was in the call (using the Conversations' participants) we could know if the call was incoming by using the author field (author is us or the peer)
interactions.extra_data: How would call duration be stored for incoming calls ?
The same as for outgoing calls?
Since we know who was in the call (using the Conversations' participants) we could know if the call was incoming by using the author field (author is us or the peer)
If sensitive information is contained in the filesystem metadata, how are you going to implement a password protection for Jami (ring-client-gnome#737)? I think should be a single db with all account's data (except profile.vcf) which you can optionally encrypt.
Why not "participants" here? It can be a conference or a group chat.
enum class type { INVALID,<...>}
enum class status { INVALID, UNKNOWN,<...>}
What is it for? I think a normal program should not keep any data in the invalid state. If this is an indicator whether some structure is initialized or not, I think this indicator should be stored in the structure itself. UNKNOWN should be more concrete (what does an error leave data in the UNKNOWN state?).
Why not "participants" here? It can be a conference or a group chat.
The intended logic for group chats would have been searching for each participant with a common conversation ID but I think that complicates querying (especially since to get the conversation ID, you need to query the participant first a lot of the time (since convID is generated)).
We could alternatively store all participants in one row as a JSON Object or something similar?
What is it for? I think a normal program should not keep any data in the invalid state. If this is an indicator whether some structure is initialized or not, I think this indicator should be stored in the structure itself.
The INVALID type and status values are indeed intended to indicate an uninitialized structure, and should ideally never be stored in the database. If for some catastrophic reason an INVALID status does get stored, a recovery mechanism should be in place, when loading interactions, to migrate such a state towards a more stable and logical value.
UNKNOWN should be more concrete (what does an error leave data in the UNKNOWN state?).
The UNKNOWN status if the first part of a text message's life cycle. Updates to message status are made in response to callbacks from the message engine. This status value should not require a recovery mechanism as the message engine SHOULD retry and update a message's status until it reaches a stable state.