-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* device sync backups * new reference_id field * union type * backup metadata * version is going in the header * comments * lint * new fields * handle unspecified * lint * lint * fix rule
- Loading branch information
Showing
5 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Definitions for backups | ||
syntax = "proto3"; | ||
package xmtp.device_sync.consent_backup; | ||
|
||
// Proto representation of a consent record save | ||
message ConsentSave { | ||
ConsentTypeSave entity_type = 1; | ||
ConsentStateSave state = 2; | ||
string entity = 3; | ||
} | ||
|
||
// Consent record type | ||
enum ConsentTypeSave { | ||
CONSENT_TYPE_SAVE_UNSPECIFIED = 0; | ||
CONSENT_TYPE_SAVE_CONVERSATION_ID = 1; | ||
CONSENT_TYPE_SAVE_INBOX_ID = 2; | ||
CONSENT_TYPE_SAVE_ADDRESS = 3; | ||
} | ||
|
||
// Consent record state | ||
enum ConsentStateSave { | ||
CONSENT_STATE_SAVE_UNSPECIFIED = 0; | ||
CONSENT_STATE_SAVE_UNKNOWN = 1; | ||
CONSENT_STATE_SAVE_ALLOWED = 2; | ||
CONSENT_STATE_SAVE_DENIED = 3; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Definitions for backups | ||
syntax = "proto3"; | ||
package xmtp.device_sync; | ||
|
||
import "device_sync/consent_backup.proto"; | ||
import "device_sync/group_backup.proto"; | ||
import "device_sync/message_backup.proto"; | ||
|
||
// Union type representing everything that can be serialied and saved in a backup archive. | ||
message BackupElement { | ||
oneof element { | ||
BackupMetadataSave metadata = 1; | ||
xmtp.device_sync.group_backup.GroupSave group = 2; | ||
xmtp.device_sync.message_backup.GroupMessageSave group_message = 3; | ||
xmtp.device_sync.consent_backup.ConsentSave consent = 4; | ||
} | ||
} | ||
|
||
// Proto representation of backup metadata | ||
// (Backup version is explicitly missing - it's stored as a header.) | ||
message BackupMetadataSave { | ||
repeated BackupElementSelection elements = 2; | ||
int64 exported_at_ns = 3; | ||
optional int64 start_ns = 4; | ||
optional int64 end_ns = 5; | ||
} | ||
|
||
// Elements selected for backup | ||
enum BackupElementSelection { | ||
BACKUP_ELEMENT_SELECTION_UNSPECIFIED = 0; | ||
BACKUP_ELEMENT_SELECTION_MESSAGES = 1; | ||
BACKUP_ELEMENT_SELECTION_CONSENT = 2; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Definitions for backups | ||
syntax = "proto3"; | ||
package xmtp.device_sync.group_backup; | ||
|
||
// Proto representation of a stored group | ||
message GroupSave { | ||
bytes id = 1; | ||
int64 created_at_ns = 2; | ||
GroupMembershipStateSave membership_state = 3; | ||
int64 installations_last_checked = 4; | ||
string added_by_inbox_id = 5; | ||
optional int64 welcome_id = 6; | ||
int64 rotated_at_ns = 7; | ||
ConversationTypeSave conversation_type = 8; | ||
optional string dm_id = 9; | ||
optional int64 last_message_ns = 10; | ||
optional int64 message_disappear_from_ns = 11; | ||
optional int64 message_disappear_in_ns = 12; | ||
} | ||
|
||
// Group membership state | ||
enum GroupMembershipStateSave { | ||
GROUP_MEMBERSHIP_STATE_SAVE_UNSPECIFIED = 0; | ||
GROUP_MEMBERSHIP_STATE_SAVE_ALLOWED = 1; | ||
GROUP_MEMBERSHIP_STATE_SAVE_REJECTED = 2; | ||
GROUP_MEMBERSHIP_STATE_SAVE_PENDING = 3; | ||
} | ||
|
||
// Conversation type | ||
enum ConversationTypeSave { | ||
CONVERSATION_TYPE_SAVE_UNSPECIFIED = 0; | ||
CONVERSATION_TYPE_SAVE_GROUP = 1; | ||
CONVERSATION_TYPE_SAVE_DM = 2; | ||
CONVERSATION_TYPE_SAVE_SYNC = 3; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Definitions for backups | ||
syntax = "proto3"; | ||
package xmtp.device_sync.message_backup; | ||
|
||
// Proto representation of a stored group message | ||
message GroupMessageSave { | ||
bytes id = 1; | ||
bytes group_id = 2; | ||
bytes decrypted_message_bytes = 3; | ||
int64 sent_at_ns = 4; | ||
GroupMessageKindSave kind = 5; | ||
bytes sender_installation_id = 6; | ||
string sender_inbox_id = 7; | ||
DeliveryStatusSave delivery_status = 8; | ||
ContentTypeSave content_type = 9; | ||
int32 version_major = 10; | ||
int32 version_minor = 11; | ||
string authority_id = 12; | ||
optional bytes reference_id = 13; | ||
} | ||
|
||
// Group message kind | ||
enum GroupMessageKindSave { | ||
GROUP_MESSAGE_KIND_SAVE_UNSPECIFIED = 0; | ||
GROUP_MESSAGE_KIND_SAVE_APPLICATION = 1; | ||
GROUP_MESSAGE_KIND_SAVE_MEMBERSHIP_CHANGE = 2; | ||
} | ||
|
||
// Group message delivery status | ||
enum DeliveryStatusSave { | ||
DELIVERY_STATUS_SAVE_UNSPECIFIED = 0; | ||
DELIVERY_STATUS_SAVE_UNPUBLISHED = 1; | ||
DELIVERY_STATUS_SAVE_PUBLISHED = 2; | ||
DELIVERY_STATUS_SAVE_FAILED = 3; | ||
} | ||
|
||
// Group message content type | ||
enum ContentTypeSave { | ||
CONTENT_TYPE_SAVE_UNSPECIFIED = 0; | ||
CONTENT_TYPE_SAVE_UNKNOWN = 1; | ||
CONTENT_TYPE_SAVE_TEXT = 2; | ||
CONTENT_TYPE_SAVE_GROUP_MEMBERSHIP_CHANGE = 3; | ||
CONTENT_TYPE_SAVE_GROUP_UPDATED = 4; | ||
CONTENT_TYPE_SAVE_REACTION = 5; | ||
CONTENT_TYPE_SAVE_READ_RECEIPT = 6; | ||
CONTENT_TYPE_SAVE_REPLY = 7; | ||
CONTENT_TYPE_SAVE_ATTACHMENT = 8; | ||
CONTENT_TYPE_SAVE_REMOTE_ATTACHMENT = 9; | ||
CONTENT_TYPE_SAVE_TRANSACTION_REFERENCE = 10; | ||
} |