Skip to content

Commit

Permalink
setup noop listblock indexer on pds
Browse files Browse the repository at this point in the history
  • Loading branch information
devinivy committed Sep 12, 2023
1 parent 2d45175 commit cc67963
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/pds/src/app-view/services/indexing/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { CID } from 'multiformats/cid'
import { WriteOpAction } from '@atproto/repo'
import { AtUri } from '@atproto/syntax'
import { ids } from '../../../lexicon/lexicons'
import Database from '../../../db'
import { BackgroundQueue } from '../../../event-stream/background-queue'
import { NoopProcessor } from './processor'
import * as Post from './plugins/post'
import * as Like from './plugins/like'
import * as Repost from './plugins/repost'
Expand All @@ -11,7 +14,6 @@ import * as List from './plugins/list'
import * as ListItem from './plugins/list-item'
import * as Profile from './plugins/profile'
import * as FeedGenerator from './plugins/feed-generator'
import { BackgroundQueue } from '../../../event-stream/background-queue'

export class IndexingService {
records: {
Expand All @@ -22,6 +24,7 @@ export class IndexingService {
block: Block.PluginType
list: List.PluginType
listItem: ListItem.PluginType
listBlock: NoopProcessor
profile: Profile.PluginType
feedGenerator: FeedGenerator.PluginType
}
Expand All @@ -35,6 +38,11 @@ export class IndexingService {
block: Block.makePlugin(this.db, backgroundQueue),
list: List.makePlugin(this.db, backgroundQueue),
listItem: ListItem.makePlugin(this.db, backgroundQueue),
listBlock: new NoopProcessor(
ids.AppBskyGraphListblock,
this.db,
backgroundQueue,
),
profile: Profile.makePlugin(this.db, backgroundQueue),
feedGenerator: FeedGenerator.makePlugin(this.db, backgroundQueue),
}
Expand Down
17 changes: 17 additions & 0 deletions packages/pds/src/app-view/services/indexing/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,20 @@ export class RecordProcessor<T, S> {
}

export default RecordProcessor

export class NoopProcessor extends RecordProcessor<unknown, unknown> {
constructor(
lexId: string,
appDb: Database,
backgroundQueue: BackgroundQueue,
) {
super(appDb, backgroundQueue, {
lexId,
insertFn: async () => null,
deleteFn: async () => null,
findDuplicate: async () => null,
notifsForInsert: () => [],
notifsForDelete: () => ({ notifs: [], toDelete: [] }),
})
}
}

0 comments on commit cc67963

Please sign in to comment.