Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backfill: Impossible to implemented custom store #638

Open
mrd0ll4r opened this issue Apr 8, 2024 · 1 comment
Open

backfill: Impossible to implemented custom store #638

mrd0ll4r opened this issue Apr 8, 2024 · 1 comment

Comments

@mrd0ll4r
Copy link
Contributor

mrd0ll4r commented Apr 8, 2024

To work around #629, I tried creating a custom backfill.Store. This, however, is not possible because the backfill.Job interface depends on the unexported struct backfill.bufferedOp via the BufferOps method:
https://github.com/bluesky-social/indigo/blob/main/backfill/backfill.go#L33

(Nitpick: it would also be helpful to have the operation kinds ("create", etc.) as constants.)

Should I open a PR for these?

@bnewbold
Copy link
Collaborator

bnewbold commented Apr 8, 2024

If you have small PRs, we might be able to review and merge them, but no promises. Right now it could take us a few weeks.

It helps if you can keep them distinct, eg operation contstants separate from ops.

ericvolp12 added a commit that referenced this issue Apr 16, 2024
(Part of #638)

This utilizes constants from the `repomgr` package for buffered
operations.
This was already the case, actually, as they were used
[here](https://github.com/bluesky-social/indigo/blob/main/backfill/backfill.go#L241),
I just added them throughout the code.

They're also used to check the operations emitted by the firehose:
https://github.com/bluesky-social/indigo/blob/main/backfill/backfill.go#L469-L471
The firehose, in turn, uses the events emitted by the repo manager for
the `Action` field in firehose events:
https://github.com/bluesky-social/indigo/blob/main/indexer/indexer.go#L83-L94
This brings us full circle:
Repo manager emits diff operations -> firehose repo commit ops `.Action`
-> backfill buffered op `.kind`

Notably, the constants are also given in the lexicon:
https://github.com/bluesky-social/atproto/blob/main/lexicons/com/atproto/sync/subscribeRepos.json#L178
But `lexgen` does not generate constants for them.

The test in `backfill_test.go` is broken, but I changed the constants
anyway.
ericvolp12 added a commit that referenced this issue May 2, 2024
(part of #638)

This exports the `backfill.BufferedOp` struct to make it possible to
implement a custom `Store` and corresponding `Job`.
I've also renamed the fields slightly for easier understanding, and
added some documentation.
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

No branches or pull requests

2 participants