mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-16 13:21:57 +00:00
UBERF-8539: Do not store TypingInfo into memdb (#7043)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
d7fd553255
commit
470861ed09
@ -15,30 +15,30 @@
|
|||||||
|
|
||||||
import activity, { type ActivityMessageControl } from '@hcengineering/activity'
|
import activity, { type ActivityMessageControl } from '@hcengineering/activity'
|
||||||
import { chunterId, type ChunterSpace } from '@hcengineering/chunter'
|
import { chunterId, type ChunterSpace } from '@hcengineering/chunter'
|
||||||
import presentation from '@hcengineering/model-presentation'
|
import contact from '@hcengineering/contact'
|
||||||
import { type Builder } from '@hcengineering/model'
|
import { type Builder } from '@hcengineering/model'
|
||||||
import core from '@hcengineering/model-core'
|
import core from '@hcengineering/model-core'
|
||||||
|
import presentation from '@hcengineering/model-presentation'
|
||||||
import view from '@hcengineering/model-view'
|
import view from '@hcengineering/model-view'
|
||||||
import workbench from '@hcengineering/model-workbench'
|
import workbench from '@hcengineering/model-workbench'
|
||||||
import { WidgetType } from '@hcengineering/workbench'
|
import { WidgetType } from '@hcengineering/workbench'
|
||||||
import contact from '@hcengineering/contact'
|
|
||||||
|
|
||||||
import chunter from './plugin'
|
|
||||||
import { defineActions } from './actions'
|
import { defineActions } from './actions'
|
||||||
import { defineNotifications } from './notifications'
|
import { defineNotifications } from './notifications'
|
||||||
|
import chunter from './plugin'
|
||||||
import {
|
import {
|
||||||
DOMAIN_CHUNTER,
|
DOMAIN_CHUNTER,
|
||||||
TChannel,
|
TChannel,
|
||||||
TChatMessage,
|
TChatMessage,
|
||||||
TChatMessageViewlet,
|
TChatMessageViewlet,
|
||||||
TChatSyncInfo,
|
TChatSyncInfo,
|
||||||
|
TChunterExtension,
|
||||||
TChunterSpace,
|
TChunterSpace,
|
||||||
TDirectMessage,
|
TDirectMessage,
|
||||||
TInlineButton,
|
TInlineButton,
|
||||||
TObjectChatPanel,
|
TObjectChatPanel,
|
||||||
TThreadMessage,
|
TThreadMessage,
|
||||||
TTypingInfo,
|
TTypingInfo
|
||||||
TChunterExtension
|
|
||||||
} from './types'
|
} from './types'
|
||||||
|
|
||||||
export { chunterId } from '@hcengineering/chunter'
|
export { chunterId } from '@hcengineering/chunter'
|
||||||
@ -161,6 +161,10 @@ export function createModel (builder: Builder): void {
|
|||||||
presenter: chunter.component.ThreadMessagePresenter
|
presenter: chunter.component.ThreadMessagePresenter
|
||||||
})
|
})
|
||||||
|
|
||||||
|
builder.mixin(chunter.class.TypingInfo, core.class.Class, core.mixin.TransientConfiguration, {
|
||||||
|
broadcastOnly: true
|
||||||
|
})
|
||||||
|
|
||||||
builder.createDoc(
|
builder.createDoc(
|
||||||
view.class.Viewlet,
|
view.class.Viewlet,
|
||||||
core.space.Model,
|
core.space.Model,
|
||||||
|
@ -14,8 +14,6 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import {
|
import {
|
||||||
type Card,
|
|
||||||
type CollaborativeDoc,
|
|
||||||
DOMAIN_BLOB,
|
DOMAIN_BLOB,
|
||||||
DOMAIN_CONFIGURATION,
|
DOMAIN_CONFIGURATION,
|
||||||
DOMAIN_DOC_INDEX_STATE,
|
DOMAIN_DOC_INDEX_STATE,
|
||||||
@ -27,8 +25,10 @@ import {
|
|||||||
type ArrOf,
|
type ArrOf,
|
||||||
type AttachedDoc,
|
type AttachedDoc,
|
||||||
type Blob,
|
type Blob,
|
||||||
|
type Card,
|
||||||
type Class,
|
type Class,
|
||||||
type ClassifierKind,
|
type ClassifierKind,
|
||||||
|
type CollaborativeDoc,
|
||||||
type Collection,
|
type Collection,
|
||||||
type Configuration,
|
type Configuration,
|
||||||
type ConfigurationElement,
|
type ConfigurationElement,
|
||||||
@ -50,6 +50,7 @@ import {
|
|||||||
type RefTo,
|
type RefTo,
|
||||||
type Space,
|
type Space,
|
||||||
type Timestamp,
|
type Timestamp,
|
||||||
|
type TransientConfiguration,
|
||||||
type Type,
|
type Type,
|
||||||
type TypeAny,
|
type TypeAny,
|
||||||
type Version
|
type Version
|
||||||
@ -403,3 +404,9 @@ export class TTypeCollaborativeDocVersion extends TType {}
|
|||||||
@UX(core.string.Rank)
|
@UX(core.string.Rank)
|
||||||
@Model(core.class.TypeRank, core.class.Type)
|
@Model(core.class.TypeRank, core.class.Type)
|
||||||
export class TTypeRank extends TType {}
|
export class TTypeRank extends TType {}
|
||||||
|
|
||||||
|
@MMixin(core.mixin.TransientConfiguration, core.class.Class)
|
||||||
|
export class TTransientConfiguration extends TClass implements TransientConfiguration {
|
||||||
|
@Prop(TypeBoolean(), core.string.Private)
|
||||||
|
broadcastOnly!: boolean
|
||||||
|
}
|
||||||
|
@ -39,12 +39,12 @@ import {
|
|||||||
TAttachedDoc,
|
TAttachedDoc,
|
||||||
TAttribute,
|
TAttribute,
|
||||||
TBlob,
|
TBlob,
|
||||||
|
TCard,
|
||||||
TClass,
|
TClass,
|
||||||
TCollection,
|
TCollection,
|
||||||
TConfiguration,
|
TConfiguration,
|
||||||
TConfigurationElement,
|
TConfigurationElement,
|
||||||
TDoc,
|
TDoc,
|
||||||
TCard,
|
|
||||||
TDocIndexState,
|
TDocIndexState,
|
||||||
TDomainIndexConfiguration,
|
TDomainIndexConfiguration,
|
||||||
TEnum,
|
TEnum,
|
||||||
@ -57,6 +57,7 @@ import {
|
|||||||
TObj,
|
TObj,
|
||||||
TPluginConfiguration,
|
TPluginConfiguration,
|
||||||
TRefTo,
|
TRefTo,
|
||||||
|
TTransientConfiguration,
|
||||||
TType,
|
TType,
|
||||||
TTypeAny,
|
TTypeAny,
|
||||||
TTypeBlob,
|
TTypeBlob,
|
||||||
@ -173,7 +174,8 @@ export function createModel (builder: Builder): void {
|
|||||||
TMigrationState,
|
TMigrationState,
|
||||||
TBlob,
|
TBlob,
|
||||||
TDomainIndexConfiguration,
|
TDomainIndexConfiguration,
|
||||||
TBenchmarkDoc
|
TBenchmarkDoc,
|
||||||
|
TTransientConfiguration
|
||||||
)
|
)
|
||||||
|
|
||||||
builder.createDoc(
|
builder.createDoc(
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import type { Asset, IntlString, Plugin } from '@hcengineering/platform'
|
import type { Asset, IntlString, Plugin } from '@hcengineering/platform'
|
||||||
import type { DocumentQuery } from './storage'
|
|
||||||
import { CollaborativeDoc } from './collaboration'
|
import { CollaborativeDoc } from './collaboration'
|
||||||
|
import type { DocumentQuery } from './storage'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
@ -346,6 +346,14 @@ export const DOMAIN_MIGRATION = '_migrations' as Domain
|
|||||||
*/
|
*/
|
||||||
export const DOMAIN_TRANSIENT = 'transient' as Domain
|
export const DOMAIN_TRANSIENT = 'transient' as Domain
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
export interface TransientConfiguration extends Class<Doc> {
|
||||||
|
// If set will not store transient objects into memdb
|
||||||
|
broadcastOnly: boolean
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Special domain to access s3 blob data.
|
* Special domain to access s3 blob data.
|
||||||
* @public
|
* @public
|
||||||
|
@ -48,6 +48,7 @@ import type {
|
|||||||
SpaceTypeDescriptor,
|
SpaceTypeDescriptor,
|
||||||
SystemSpace,
|
SystemSpace,
|
||||||
Timestamp,
|
Timestamp,
|
||||||
|
TransientConfiguration,
|
||||||
Type,
|
Type,
|
||||||
TypeAny,
|
TypeAny,
|
||||||
TypedSpace,
|
TypedSpace,
|
||||||
@ -148,7 +149,8 @@ export default plugin(coreId, {
|
|||||||
mixin: {
|
mixin: {
|
||||||
ConfigurationElement: '' as Ref<Mixin<ConfigurationElement>>,
|
ConfigurationElement: '' as Ref<Mixin<ConfigurationElement>>,
|
||||||
IndexConfiguration: '' as Ref<Mixin<IndexingConfiguration<Doc>>>,
|
IndexConfiguration: '' as Ref<Mixin<IndexingConfiguration<Doc>>>,
|
||||||
SpacesTypeData: '' as Ref<Mixin<Space>>
|
SpacesTypeData: '' as Ref<Mixin<Space>>,
|
||||||
|
TransientConfiguration: '' as Ref<Mixin<TransientConfiguration>>
|
||||||
},
|
},
|
||||||
space: {
|
space: {
|
||||||
Tx: '' as Ref<Space>,
|
Tx: '' as Ref<Space>,
|
||||||
|
@ -30,10 +30,12 @@ import core, {
|
|||||||
type StorageIterator,
|
type StorageIterator,
|
||||||
toFindResult,
|
toFindResult,
|
||||||
type Tx,
|
type Tx,
|
||||||
|
type TxCUD,
|
||||||
|
TxProcessor,
|
||||||
type TxResult,
|
type TxResult,
|
||||||
type WorkspaceId
|
type WorkspaceId
|
||||||
} from '@hcengineering/core'
|
} from '@hcengineering/core'
|
||||||
import { type DbAdapterHandler, type DbAdapter, type DomainHelperOperations } from './adapter'
|
import { type DbAdapter, type DbAdapterHandler, type DomainHelperOperations } from './adapter'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
@ -119,7 +121,7 @@ export class DummyDbAdapter implements DbAdapter {
|
|||||||
class InMemoryAdapter extends DummyDbAdapter implements DbAdapter {
|
class InMemoryAdapter extends DummyDbAdapter implements DbAdapter {
|
||||||
private readonly modeldb: ModelDb
|
private readonly modeldb: ModelDb
|
||||||
|
|
||||||
constructor (hierarchy: Hierarchy) {
|
constructor (readonly hierarchy: Hierarchy) {
|
||||||
super()
|
super()
|
||||||
this.modeldb = new ModelDb(hierarchy)
|
this.modeldb = new ModelDb(hierarchy)
|
||||||
}
|
}
|
||||||
@ -138,7 +140,23 @@ class InMemoryAdapter extends DummyDbAdapter implements DbAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async tx (ctx: MeasureContext, ...tx: Tx[]): Promise<TxResult[]> {
|
async tx (ctx: MeasureContext, ...tx: Tx[]): Promise<TxResult[]> {
|
||||||
return await this.modeldb.tx(...tx)
|
// Filter transactions with broadcast only flags
|
||||||
|
const ftx = tx.filter((it) => {
|
||||||
|
if (TxProcessor.isExtendsCUD(it._class)) {
|
||||||
|
const cud = it as TxCUD<Doc>
|
||||||
|
const objClass = this.hierarchy.getClass(cud.objectClass)
|
||||||
|
const mix = this.hierarchy.hasMixin(objClass, core.mixin.TransientConfiguration)
|
||||||
|
if (mix && this.hierarchy.as(objClass, core.mixin.TransientConfiguration).broadcastOnly) {
|
||||||
|
// We do not need to store a broadcast only transactions into model.
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
if (ftx.length === 0) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
return await this.modeldb.tx(...ftx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user