github.com/status-im/status-go@v1.1.0/signal/events_community_archives.go (about) 1 package signal 2 3 const ( 4 5 // EventHistoryArchivesEnabled triggered when the community history archive protocol 6 // was enabled via the RPC API 7 EventHistoryArchivesProtocolEnabled = "community.historyArchivesProtocolEnabled" 8 // EventHistoryArchivesDisabled triggered when the community history archive protocol 9 // was disabled via the RPC API 10 EventHistoryArchivesProtocolDisabled = "community.historyArchivesProtocolDisabled" 11 // EventCreatingHistoryArchives is triggered when the community owner node 12 // starts to create archives torrents 13 EventCreatingHistoryArchives = "community.creatingHistoryArchives" 14 // EventHistoryArchivesCreated is triggered when the community owner node 15 // has finished to create archives torrents 16 EventHistoryArchivesCreated = "community.historyArchivesCreated" 17 // EventNoHistoryArchivesCreated is triggered when the community owner node 18 // tried to create archives but haven't because there were no new messages 19 // to archive 20 EventNoHistoryArchivesCreated = "community.noHistoryArchivesCreated" 21 // EventHistoryArchivesSeeding is triggered when the community owner node 22 // started seeding archives torrents 23 EventHistoryArchivesSeeding = "community.historyArchivesSeeding" 24 // EventHistoryArchivesUnseeded is triggered when the community owner node 25 // drops a torrent for a particular community 26 EventHistoryArchivesUnseeded = "community.historyArchivesUnseeded" 27 // EventDownloadingHistoryArchivesFinished is triggered when the community member node 28 // has downloaded all archives 29 EventDownloadingHistoryArchivesStarted = "community.downloadingHistoryArchivesStarted" 30 // EventHistoryArchiveDownloaded is triggered when the community member node 31 // has downloaded an individual community archive 32 EventHistoryArchiveDownloaded = "community.historyArchiveDownloaded" 33 // EventImportingHistoryArchiveMessages is triggered when the community member node 34 // has starts importing downloaded archive messages into the database 35 EventImportingHistoryArchiveMessages = "community.importingHistoryArchiveMessages" 36 // EventDownloadingHistoryArchivesFinished is triggered when the community member node 37 // has downloaded all archives 38 EventDownloadingHistoryArchivesFinished = "community.downloadingHistoryArchivesFinished" 39 ) 40 41 type CreatingHistoryArchivesSignal struct { 42 CommunityID string `json:"communityId"` 43 } 44 45 type NoHistoryArchivesCreatedSignal struct { 46 CommunityID string `json:"communityId"` 47 From int `json:"from"` 48 To int `json:"to"` 49 } 50 51 type HistoryArchivesCreatedSignal struct { 52 CommunityID string `json:"communityId"` 53 From int `json:"from"` 54 To int `json:"to"` 55 } 56 57 type HistoryArchivesSeedingSignal struct { 58 CommunityID string `json:"communityId"` 59 } 60 61 type HistoryArchivesUnseededSignal struct { 62 CommunityID string `json:"communityId"` 63 } 64 65 type HistoryArchiveDownloadedSignal struct { 66 CommunityID string `json:"communityId"` 67 From int `json:"from"` 68 To int `json:"to"` 69 } 70 71 type DownloadingHistoryArchivesStartedSignal struct { 72 CommunityID string `json:"communityId"` 73 } 74 75 type ImportingHistoryArchiveMessagesSignal struct { 76 CommunityID string `json:"communityId"` 77 } 78 79 type DownloadingHistoryArchivesFinishedSignal struct { 80 CommunityID string `json:"communityId"` 81 } 82 83 func SendHistoryArchivesProtocolEnabled() { 84 send(EventHistoryArchivesProtocolEnabled, nil) 85 } 86 87 func SendHistoryArchivesProtocolDisabled() { 88 send(EventHistoryArchivesProtocolDisabled, nil) 89 } 90 91 func SendCreatingHistoryArchives(communityID string) { 92 send(EventCreatingHistoryArchives, CreatingHistoryArchivesSignal{CommunityID: communityID}) 93 } 94 95 func SendNoHistoryArchivesCreated(communityID string, from int, to int) { 96 send(EventNoHistoryArchivesCreated, NoHistoryArchivesCreatedSignal{ 97 CommunityID: communityID, 98 From: from, 99 To: to, 100 }) 101 } 102 103 func SendHistoryArchivesCreated(communityID string, from int, to int) { 104 send(EventHistoryArchivesCreated, HistoryArchivesCreatedSignal{ 105 CommunityID: communityID, 106 From: from, 107 To: to, 108 }) 109 } 110 111 func SendHistoryArchivesSeeding(communityID string) { 112 send(EventHistoryArchivesSeeding, HistoryArchivesSeedingSignal{CommunityID: communityID}) 113 } 114 115 func SendHistoryArchivesUnseeded(communityID string) { 116 send(EventHistoryArchivesUnseeded, HistoryArchivesUnseededSignal{CommunityID: communityID}) 117 } 118 119 func SendHistoryArchiveDownloaded(communityID string, from int, to int) { 120 send(EventHistoryArchiveDownloaded, HistoryArchiveDownloadedSignal{ 121 CommunityID: communityID, 122 From: from, 123 To: to, 124 }) 125 } 126 127 func SendDownloadingHistoryArchivesStarted(communityID string) { 128 send(EventDownloadingHistoryArchivesStarted, DownloadingHistoryArchivesStartedSignal{ 129 CommunityID: communityID, 130 }) 131 } 132 133 func SendImportingHistoryArchiveMessages(communityID string) { 134 send(EventImportingHistoryArchiveMessages, ImportingHistoryArchiveMessagesSignal{ 135 CommunityID: communityID, 136 }) 137 } 138 139 func SendDownloadingHistoryArchivesFinished(communityID string) { 140 send(EventDownloadingHistoryArchivesFinished, DownloadingHistoryArchivesFinishedSignal{ 141 CommunityID: communityID, 142 }) 143 }