Skip to content

search: allow custom index file openers - #1138

Open
aaaaaandrew wants to merge 1 commit into
sourcegraph:mainfrom
aaaaaandrew:feat/index-file-opener
Open

search: allow custom index file openers#1138
aaaaaandrew wants to merge 1 commit into
sourcegraph:mainfrom
aaaaaandrew:feat/index-file-opener

Conversation

@aaaaaandrew

Copy link
Copy Markdown
Contributor

Summary

  • add options-bearing blocking and fast directory-searcher constructors
  • allow callers to provide an IndexFileOpener for initial and watcher shard loads
  • preserve index.NewIndexFile and mmap behavior for every existing constructor

The opener hook lets deployments select an owned-buffer reader when filesystem
mapping lifetime semantics are unsuitable, without changing the default for
other users.

Closes #1137.

Test plan

  • go test ./...
  • go test -race ./search
  • go vet ./search
  • repeated initial-load and watcher-reload opener test

Keep mmap as the default while allowing directory searchers to inject an alternative IndexFile implementation for initial loads and watcher reloads.

Co-Authored-By: OpenAI Codex <codex@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow directory searchers to use a custom IndexFile opener

1 participant