MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / HandleNotification

Method HandleNotification

internal/search/search.go:231–247  ·  view source on GitHub ↗

HandleNotification processes incoming notifications and updates Typesense collections based on the table and data. It ensures the required fields exist and upserts the data into Typesense.

(ctx context.Context, table string, data map[string]interface{})

Source from the content-addressed store, hash-verified

229// HandleNotification processes incoming notifications and updates Typesense collections based on the table and data.
230// It ensures the required fields exist and upserts the data into Typesense.
231func (t *TypesenseClient) HandleNotification(ctx context.Context, table string, data map[string]interface{}) error {
232 config, ok := collectionConfigs[table]
233 if !ok {
234 return fmt.Errorf("unknown collection: %s", table)
235 }
236
237 // Process and normalize the data
238 if err := t.processMetadata(data); err != nil {
239 return err
240 }
241 t.convertLargeNumbers(config, data)
242 t.ensureSchemaFields(config, data)
243 t.normalizeTimeFields(config, data)
244
245 // Upsert the document
246 return t.upsertDocument(ctx, table, data)
247}
248
249// HandleBatchNotification processes a batch of items and indexes them in dependency order.
250// It first indexes all dependencies (e.g., balances), then indexes the primary item (e.g., transaction).

Callers 6

indexDataMethod · 0.95
indexLedgersMethod · 0.80
indexIdentitiesMethod · 0.80
indexBalancesMethod · 0.80
indexTransactionsMethod · 0.80

Calls 5

processMetadataMethod · 0.95
convertLargeNumbersMethod · 0.95
ensureSchemaFieldsMethod · 0.95
normalizeTimeFieldsMethod · 0.95
upsertDocumentMethod · 0.95

Tested by

no test coverage detected