mirror of
https://github.com/Start9Labs/patch-db.git
synced 2026-03-31 20:33:39 +00:00
removes temps, massive refactor
This commit is contained in:
29
client/lib/types.ts
Normal file
29
client/lib/types.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { Operation } from 'fast-json-patch'
|
||||
|
||||
// revise a collection of nodes.
|
||||
export type Revision = { id: number, patch: Operation[], expireId: string | null }
|
||||
// dump/replace the entire store with T
|
||||
export type Dump<T> = { id: number, value: T, expireId: string | null }
|
||||
|
||||
export type Update<T> = Revision | Dump<T>
|
||||
|
||||
export enum PatchOp {
|
||||
ADD = 'add',
|
||||
REMOVE = 'remove',
|
||||
REPLACE = 'replace',
|
||||
}
|
||||
|
||||
export interface Http<T> {
|
||||
getRevisions (since: number): Promise<Revision[] | Dump<T>>
|
||||
getDump (): Promise<Dump<T>>
|
||||
}
|
||||
|
||||
export interface Bootstrapper<T> {
|
||||
init (): Promise<DBCache<T>>
|
||||
update (cache: DBCache<T>): Promise<void>
|
||||
}
|
||||
|
||||
export interface DBCache<T>{
|
||||
sequence: number,
|
||||
data: T | { }
|
||||
}
|
||||
Reference in New Issue
Block a user