mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-22 04:26:23 +08:00
refactor(infra): migrate to new infra (#5565)
This commit is contained in:
@@ -23,3 +23,22 @@ export interface SyncStorage {
|
||||
disconnect: (reason: string) => void
|
||||
): Promise<() => void>;
|
||||
}
|
||||
|
||||
export const EmptySyncStorage: SyncStorage = {
|
||||
name: 'empty',
|
||||
pull: async () => null,
|
||||
push: async () => {},
|
||||
subscribe: async () => () => {},
|
||||
};
|
||||
|
||||
export const ReadonlyMappingSyncStorage = (map: {
|
||||
[key: string]: Uint8Array;
|
||||
}): SyncStorage => ({
|
||||
name: 'map',
|
||||
pull: async (id: string) => {
|
||||
const data = map[id];
|
||||
return data ? { data } : null;
|
||||
},
|
||||
push: async () => {},
|
||||
subscribe: async () => () => {},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user