an app.bsky.* indexer
1package main 2 3import ( 4 "context" 5 "errors" 6 "fmt" 7 "strconv" 8 9 comatproto "github.com/bluesky-social/indigo/api/atproto" 10 "github.com/bluesky-social/indigo/backfill" 11 "github.com/ipfs/go-cid" 12) 13 14type commitHandler func(context.Context, *comatproto.SyncSubscribeRepos_Commit) error 15 16func (b *Backend) RepoCommitHandler( 17 ctx context.Context, evt *comatproto.SyncSubscribeRepos_Commit, 18) error { 19 select { 20 case <-ctx.Done(): 21 return nil 22 default: 23 // 24 } 25 26 b.firehoseLk.Lock() 27 b.firehoseSeq = strconv.Itoa(int(evt.Seq)) 28 b.firehoseLk.Unlock() 29 30 if b.backfillComplete { 31 return b.bf.HandleEvent(ctx, evt) 32 } 33 34 job, err := b.bf.Store.GetJob(ctx, evt.Repo) 35 if job == nil { 36 if errors.Is(err, backfill.ErrJobNotFound) { 37 return nil 38 } else { 39 return fmt.Errorf("error getting job: %w", err) 40 } 41 } else { 42 return b.bf.HandleEvent(ctx, evt) 43 } 44} 45 46type handleOpCreateUpdate func(context.Context, string, string, string, *[]byte, *cid.Cid) error 47type handleOpDelete func(context.Context, string, string, string) error 48 49func (b *Backend) HandleCreateOp(ctx context.Context, repo, rev, path string, rec *[]byte, cid *cid.Cid) error { 50 return nil 51} 52 53func (b *Backend) HandleUpdateOp(ctx context.Context, repo, rev, path string, rec *[]byte, cid *cid.Cid) error { 54 return nil 55} 56 57func (b *Backend) HandleDeleteOp(ctx context.Context, repo, rev, path string) error { 58 return nil 59}