重构同步服务端功能部分代码,使其更易扩展新功能
This commit is contained in:
Vendored
+13
@@ -140,5 +140,18 @@ declare namespace LX {
|
||||
tempList: LX.Music.MusicInfo[]
|
||||
}
|
||||
|
||||
type ActionList = SyncAction<'list_data_overwrite', LX.List.ListActionDataOverwrite>
|
||||
| SyncAction<'list_create', LX.List.ListActionAdd>
|
||||
| SyncAction<'list_remove', LX.List.ListActionRemove>
|
||||
| SyncAction<'list_update', LX.List.ListActionUpdate>
|
||||
| SyncAction<'list_update_position', LX.List.ListActionUpdatePosition>
|
||||
| SyncAction<'list_music_add', LX.List.ListActionMusicAdd>
|
||||
| SyncAction<'list_music_move', LX.List.ListActionMusicMove>
|
||||
| SyncAction<'list_music_remove', LX.List.ListActionMusicRemove>
|
||||
| SyncAction<'list_music_update', LX.List.ListActionMusicUpdate>
|
||||
| SyncAction<'list_music_update_position', LX.List.ListActionMusicUpdatePosition>
|
||||
| SyncAction<'list_music_overwrite', LX.List.ListActionMusicOverwrite>
|
||||
| SyncAction<'list_music_clear', LX.List.ListActionMusicClear>
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+7
-4
@@ -24,7 +24,7 @@ declare namespace LX {
|
||||
| SyncAction<'client_status', ClientStatus>
|
||||
| SyncAction<'server_status', ServerStatus>
|
||||
|
||||
type SyncServiceActions = SyncAction<'select_mode', Mode>
|
||||
type SyncServiceActions = SyncAction<'select_mode', ListSyncMode>
|
||||
| SyncAction<'get_server_status'>
|
||||
| SyncAction<'get_client_status'>
|
||||
| SyncAction<'generate_code'>
|
||||
@@ -90,14 +90,17 @@ declare namespace LX {
|
||||
clientId: string
|
||||
key: string
|
||||
deviceName: string
|
||||
lastSyncDate?: number
|
||||
snapshotKey: string
|
||||
lastConnectDate?: number
|
||||
isMobile: boolean
|
||||
}
|
||||
|
||||
interface ListInfo {
|
||||
lastSyncDate?: number
|
||||
snapshotKey: string
|
||||
}
|
||||
type ListData = Omit<LX.List.ListDataFull, 'tempList'>
|
||||
|
||||
type Mode = 'merge_local_remote'
|
||||
type ListSyncMode = 'merge_local_remote'
|
||||
| 'merge_remote_local'
|
||||
| 'overwrite_local_remote'
|
||||
| 'overwrite_remote_local'
|
||||
|
||||
Vendored
+3
-16
@@ -1,26 +1,13 @@
|
||||
declare namespace LX {
|
||||
namespace Sync {
|
||||
type ActionList = SyncAction<'list_data_overwrite', LX.List.ListActionDataOverwrite>
|
||||
| SyncAction<'list_create', LX.List.ListActionAdd>
|
||||
| SyncAction<'list_remove', LX.List.ListActionRemove>
|
||||
| SyncAction<'list_update', LX.List.ListActionUpdate>
|
||||
| SyncAction<'list_update_position', LX.List.ListActionUpdatePosition>
|
||||
| SyncAction<'list_music_add', LX.List.ListActionMusicAdd>
|
||||
| SyncAction<'list_music_move', LX.List.ListActionMusicMove>
|
||||
| SyncAction<'list_music_remove', LX.List.ListActionMusicRemove>
|
||||
| SyncAction<'list_music_update', LX.List.ListActionMusicUpdate>
|
||||
| SyncAction<'list_music_update_position', LX.List.ListActionMusicUpdatePosition>
|
||||
| SyncAction<'list_music_overwrite', LX.List.ListActionMusicOverwrite>
|
||||
| SyncAction<'list_music_clear', LX.List.ListActionMusicClear>
|
||||
|
||||
type ServerActions = WarpPromiseRecord<{
|
||||
onListSyncAction: (action: LX.Sync.ActionList) => void
|
||||
onListSyncAction: (action: LX.List.ActionList) => void
|
||||
}>
|
||||
|
||||
type ClientActions = WarpPromiseRecord<{
|
||||
onListSyncAction: (action: LX.Sync.ActionList) => void
|
||||
onListSyncAction: (action: LX.List.ActionList) => void
|
||||
list_sync_get_md5: () => string
|
||||
list_sync_get_sync_mode: () => Mode
|
||||
list_sync_get_sync_mode: () => ListSyncMode
|
||||
list_sync_get_list_data: () => ListData
|
||||
list_sync_set_list_data: (data: ListData) => void
|
||||
list_sync_finished: () => void
|
||||
|
||||
Reference in New Issue
Block a user