mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-10 21:48:48 +08:00
feat(native): move sqlite operation into Rust (#2497)
Co-authored-by: Peng Xiao <pengxiao@outlook.com>
(cherry picked from commit d28c887237)
This commit is contained in:
Vendored
+24
-1
@@ -7,7 +7,7 @@ export interface WatchOptions {
|
||||
recursive?: boolean;
|
||||
}
|
||||
/** Watcher kind enumeration */
|
||||
export enum WatcherKind {
|
||||
export const enum WatcherKind {
|
||||
/** inotify backend (linux) */
|
||||
Inotify = 'Inotify',
|
||||
/** FS-Event backend (mac) */
|
||||
@@ -23,6 +23,16 @@ export enum WatcherKind {
|
||||
Unknown = 'Unknown',
|
||||
}
|
||||
export function moveFile(src: string, dst: string): Promise<void>;
|
||||
export interface BlobRow {
|
||||
key: string;
|
||||
data: Buffer;
|
||||
timestamp: Date;
|
||||
}
|
||||
export interface UpdateRow {
|
||||
id: number;
|
||||
timestamp: Date;
|
||||
data: Buffer;
|
||||
}
|
||||
export class Subscription {
|
||||
toString(): string;
|
||||
unsubscribe(): void;
|
||||
@@ -39,3 +49,16 @@ export class FsWatcher {
|
||||
static unwatch(p: string): void;
|
||||
static close(): void;
|
||||
}
|
||||
export class SqliteConnection {
|
||||
constructor(path: string);
|
||||
connect(): Promise<void>;
|
||||
addBlob(key: string, blob: Uint8Array): Promise<void>;
|
||||
getBlob(key: string): Promise<BlobRow | null>;
|
||||
deleteBlob(key: string): Promise<void>;
|
||||
getBlobKeys(): Promise<Array<string>>;
|
||||
getUpdates(): Promise<Array<UpdateRow>>;
|
||||
insertUpdates(updates: Array<Uint8Array>): Promise<void>;
|
||||
close(): Promise<void>;
|
||||
get isClose(): boolean;
|
||||
static validate(path: string): Promise<boolean>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user