UBERF-8508: Get rid of Mongo in storage adapter (#6989)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev
2024-10-21 23:23:26 +07:00
committed by GitHub
parent 8edf748d30
commit 187c489b2c
57 changed files with 653 additions and 1332 deletions
+2 -37
View File
@@ -14,16 +14,15 @@
//
import {
type LowLevelStorage,
type Class,
type Doc,
type DocumentQuery,
type DocumentUpdate,
type Domain,
type FieldIndexConfig,
type FindOptions,
type FindResult,
type Hierarchy,
type LowLevelStorage,
type MeasureContext,
type ModelDb,
type Ref,
@@ -56,40 +55,6 @@ export interface DomainHelper {
) => Promise<void>
}
export interface RawDBAdapterStream<T extends Doc> {
next: () => Promise<T[]>
close: () => Promise<void>
}
/**
* @public
*/
export interface RawDBAdapter {
find: <T extends Doc>(
ctx: MeasureContext,
workspace: WorkspaceId,
domain: Domain,
query: DocumentQuery<T>,
options?: Omit<FindOptions<T>, 'projection' | 'lookup' | 'total'>
) => Promise<FindResult<T>>
findStream: <T extends Doc>(
ctx: MeasureContext,
workspace: WorkspaceId,
domain: Domain,
query: DocumentQuery<T>,
options?: Omit<FindOptions<T>, 'projection' | 'lookup' | 'total'>
) => Promise<RawDBAdapterStream<T>>
upload: <T extends Doc>(ctx: MeasureContext, workspace: WorkspaceId, domain: Domain, docs: T[]) => Promise<void>
update: <T extends Doc>(
ctx: MeasureContext,
workspace: WorkspaceId,
domain: Domain,
docs: Map<Ref<T>, DocumentUpdate<T>>
) => Promise<void>
clean: <T extends Doc>(ctx: MeasureContext, workspace: WorkspaceId, domain: Domain, docs: Ref<T>[]) => Promise<void>
close: () => Promise<void>
}
export type DbAdapterHandler = (
domain: Domain,
event: 'add' | 'update' | 'delete' | 'read',
@@ -102,7 +67,7 @@ export type DbAdapterHandler = (
export interface DbAdapter extends LowLevelStorage {
init?: (domains?: string[], excludeDomains?: string[]) => Promise<void>
helper: () => DomainHelperOperations
helper?: () => DomainHelperOperations
close: () => Promise<void>
findAll: <T extends Doc>(