this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

events: remove unused litestream code

-60
-60
events/repostream.go
··· 1 - package events 2 - 3 - import ( 4 - "context" 5 - 6 - "github.com/bluesky-social/indigo/repomgr" 7 - 8 - "github.com/gorilla/websocket" 9 - cid "github.com/ipfs/go-cid" 10 - ) 11 - 12 - type LiteStreamHandleFunc func(op repomgr.EventKind, seq int64, path string, did string, rcid *cid.Cid, rec any) error 13 - 14 - func ConsumeRepoStreamLite2(ctx context.Context, con *websocket.Conn, cb LiteStreamHandleFunc) error { 15 - /* 16 - return HandleRepoStream(ctx, con, &RepoStreamCallbacks{ 17 - RepoCommit: func(evt *comatproto.SyncSubscribeRepos_Commit) error { 18 - if evt.TooBig { 19 - log.Errorf("skipping too big events for now: %d", evt.Seq) 20 - return nil 21 - } 22 - r, err := repo.ReadRepoFromCar(ctx, bytes.NewReader(evt.Blocks)) 23 - if err != nil { 24 - return fmt.Errorf("reading repo from car (seq: %d, len: %d): %w", evt.Seq, len(evt.Blocks), err) 25 - } 26 - 27 - for _, op := range evt.Ops { 28 - ek := repomgr.EventKind(op.Action) 29 - switch ek { 30 - case repomgr.EvtKindCreateRecord, repomgr.EvtKindUpdateRecord: 31 - rc, rec, err := r.GetRecord(ctx, op.Path) 32 - if err != nil { 33 - e := fmt.Errorf("getting record %s (%s) within seq %d for %s: %w", op.Path, *op.Cid, evt.Seq, evt.Repo, err) 34 - log.Error(e) 35 - continue 36 - } 37 - 38 - if lexutil.LexLink(rc) != *op.Cid { 39 - // TODO: do we even error here? 40 - return fmt.Errorf("mismatch in record and op cid: %s != %s", rc, *op.Cid) 41 - } 42 - 43 - if err := cb(ek, evt.Seq, op.Path, evt.Repo, &rc, rec); err != nil { 44 - log.Errorf("event consumer callback (%s): %s", ek, err) 45 - continue 46 - } 47 - 48 - case repomgr.EvtKindDeleteRecord: 49 - if err := cb(ek, evt.Seq, op.Path, evt.Repo, nil, nil); err != nil { 50 - log.Errorf("event consumer callback (%s): %s", ek, err) 51 - continue 52 - } 53 - } 54 - } 55 - return nil 56 - }, 57 - }) 58 - */ 59 - return nil 60 - }