···88 "context"
99 "encoding/json"
10101111- "github.com/bluesky-social/indigo/xrpc"
1111+ "github.com/bluesky-social/indigo/lex/util"
1212)
13131414// IdentitySignPlcOperation_Input is the input argument to a com.atproto.identity.signPlcOperation call.
···2828}
29293030// IdentitySignPlcOperation calls the XRPC method "com.atproto.identity.signPlcOperation".
3131-func IdentitySignPlcOperation(ctx context.Context, c *xrpc.Client, input *IdentitySignPlcOperation_Input) (*IdentitySignPlcOperation_Output, error) {
3131+func IdentitySignPlcOperation(ctx context.Context, c util.LexClient, input *IdentitySignPlcOperation_Input) (*IdentitySignPlcOperation_Output, error) {
3232 var out IdentitySignPlcOperation_Output
3333- if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.identity.signPlcOperation", nil, input, &out); err != nil {
3333+ if err := c.LexDo(ctx, util.Procedure, "application/json", "com.atproto.identity.signPlcOperation", nil, input, &out); err != nil {
3434 return nil, err
3535 }
3636
+3-3
api/agnostic/identitysubmitPlcOperation.go
···88 "context"
99 "encoding/json"
10101111- "github.com/bluesky-social/indigo/xrpc"
1111+ "github.com/bluesky-social/indigo/lex/util"
1212)
13131414// IdentitySubmitPlcOperation_Input is the input argument to a com.atproto.identity.submitPlcOperation call.
···1717}
18181919// IdentitySubmitPlcOperation calls the XRPC method "com.atproto.identity.submitPlcOperation".
2020-func IdentitySubmitPlcOperation(ctx context.Context, c *xrpc.Client, input *IdentitySubmitPlcOperation_Input) error {
2121- if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.identity.submitPlcOperation", nil, input, nil); err != nil {
2020+func IdentitySubmitPlcOperation(ctx context.Context, c util.LexClient, input *IdentitySubmitPlcOperation_Input) error {
2121+ if err := c.LexDo(ctx, util.Procedure, "application/json", "com.atproto.identity.submitPlcOperation", nil, input, nil); err != nil {
2222 return err
2323 }
2424
+2-3
api/agnostic/repoapplyWrites.go
···1010 "fmt"
11111212 "github.com/bluesky-social/indigo/lex/util"
1313- "github.com/bluesky-social/indigo/xrpc"
1413)
15141615// RepoApplyWrites_Create is a "create" in the com.atproto.repo.applyWrites schema.
···179178}
180179181180// RepoApplyWrites calls the XRPC method "com.atproto.repo.applyWrites".
182182-func RepoApplyWrites(ctx context.Context, c *xrpc.Client, input *RepoApplyWrites_Input) (*RepoApplyWrites_Output, error) {
181181+func RepoApplyWrites(ctx context.Context, c util.LexClient, input *RepoApplyWrites_Input) (*RepoApplyWrites_Output, error) {
183182 var out RepoApplyWrites_Output
184184- if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.repo.applyWrites", nil, input, &out); err != nil {
183183+ if err := c.LexDo(ctx, util.Procedure, "application/json", "com.atproto.repo.applyWrites", nil, input, &out); err != nil {
185184 return nil, err
186185 }
187186
+3-3
api/agnostic/repocreateRecord.go
···77import (
88 "context"
991010- "github.com/bluesky-social/indigo/xrpc"
1010+ "github.com/bluesky-social/indigo/lex/util"
1111)
12121313// RepoDefs_CommitMeta is a "commitMeta" in the com.atproto.repo.defs schema.
···4141}
42424343// RepoCreateRecord calls the XRPC method "com.atproto.repo.createRecord".
4444-func RepoCreateRecord(ctx context.Context, c *xrpc.Client, input *RepoCreateRecord_Input) (*RepoCreateRecord_Output, error) {
4444+func RepoCreateRecord(ctx context.Context, c util.LexClient, input *RepoCreateRecord_Input) (*RepoCreateRecord_Output, error) {
4545 var out RepoCreateRecord_Output
4646- if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.repo.createRecord", nil, input, &out); err != nil {
4646+ if err := c.LexDo(ctx, util.Procedure, "application/json", "com.atproto.repo.createRecord", nil, input, &out); err != nil {
4747 return nil, err
4848 }
4949
+3-3
api/agnostic/repogetRecord.go
···88 "context"
99 "encoding/json"
10101111- "github.com/bluesky-social/indigo/xrpc"
1111+ "github.com/bluesky-social/indigo/lex/util"
1212)
13131414// RepoGetRecord_Output is the output of a com.atproto.repo.getRecord call.
···2525// collection: The NSID of the record collection.
2626// repo: The handle or DID of the repo.
2727// rkey: The Record Key.
2828-func RepoGetRecord(ctx context.Context, c *xrpc.Client, cid string, collection string, repo string, rkey string) (*RepoGetRecord_Output, error) {
2828+func RepoGetRecord(ctx context.Context, c util.LexClient, cid string, collection string, repo string, rkey string) (*RepoGetRecord_Output, error) {
2929 var out RepoGetRecord_Output
30303131 params := map[string]interface{}{
···3636 if cid != "" {
3737 params["cid"] = cid
3838 }
3939- if err := c.Do(ctx, xrpc.Query, "", "com.atproto.repo.getRecord", params, nil, &out); err != nil {
3939+ if err := c.LexDo(ctx, util.Query, "", "com.atproto.repo.getRecord", params, nil, &out); err != nil {
4040 return nil, err
4141 }
4242
+3-3
api/agnostic/repolistRecords.go
···88 "context"
99 "encoding/json"
10101111- "github.com/bluesky-social/indigo/xrpc"
1111+ "github.com/bluesky-social/indigo/lex/util"
1212)
13131414// RepoListRecords_Output is the output of a com.atproto.repo.listRecords call.
···3131// limit: The number of records to return.
3232// repo: The handle or DID of the repo.
3333// reverse: Flag to reverse the order of the returned records.
3434-func RepoListRecords(ctx context.Context, c *xrpc.Client, collection string, cursor string, limit int64, repo string, reverse bool) (*RepoListRecords_Output, error) {
3434+func RepoListRecords(ctx context.Context, c util.LexClient, collection string, cursor string, limit int64, repo string, reverse bool) (*RepoListRecords_Output, error) {
3535 var out RepoListRecords_Output
36363737 params := map[string]interface{}{
···4848 params["reverse"] = reverse
4949 }
50505151- if err := c.Do(ctx, xrpc.Query, "", "com.atproto.repo.listRecords", params, nil, &out); err != nil {
5151+ if err := c.LexDo(ctx, util.Query, "", "com.atproto.repo.listRecords", params, nil, &out); err != nil {
5252 return nil, err
5353 }
5454
+3-3
api/agnostic/repoputRecord.go
···77import (
88 "context"
991010- "github.com/bluesky-social/indigo/xrpc"
1010+ "github.com/bluesky-social/indigo/lex/util"
1111)
12121313// RepoPutRecord_Input is the input argument to a com.atproto.repo.putRecord call.
···3737}
38383939// RepoPutRecord calls the XRPC method "com.atproto.repo.putRecord".
4040-func RepoPutRecord(ctx context.Context, c *xrpc.Client, input *RepoPutRecord_Input) (*RepoPutRecord_Output, error) {
4040+func RepoPutRecord(ctx context.Context, c util.LexClient, input *RepoPutRecord_Input) (*RepoPutRecord_Output, error) {
4141 var out RepoPutRecord_Output
4242- if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.repo.putRecord", nil, input, &out); err != nil {
4242+ if err := c.LexDo(ctx, util.Procedure, "application/json", "com.atproto.repo.putRecord", nil, input, &out); err != nil {
4343 return nil, err
4444 }
4545
-627
api/atproto/cbor_gen.go
···1206120612071207 return nil
12081208}
12091209-func (t *SyncSubscribeRepos_Handle) MarshalCBOR(w io.Writer) error {
12101210- if t == nil {
12111211- _, err := w.Write(cbg.CborNull)
12121212- return err
12131213- }
1214120912151215- cw := cbg.NewCborWriter(w)
12161216-12171217- if _, err := cw.Write([]byte{164}); err != nil {
12181218- return err
12191219- }
12201220-12211221- // t.Did (string) (string)
12221222- if len("did") > 1000000 {
12231223- return xerrors.Errorf("Value in field \"did\" was too long")
12241224- }
12251225-12261226- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("did"))); err != nil {
12271227- return err
12281228- }
12291229- if _, err := cw.WriteString(string("did")); err != nil {
12301230- return err
12311231- }
12321232-12331233- if len(t.Did) > 1000000 {
12341234- return xerrors.Errorf("Value in field t.Did was too long")
12351235- }
12361236-12371237- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Did))); err != nil {
12381238- return err
12391239- }
12401240- if _, err := cw.WriteString(string(t.Did)); err != nil {
12411241- return err
12421242- }
12431243-12441244- // t.Seq (int64) (int64)
12451245- if len("seq") > 1000000 {
12461246- return xerrors.Errorf("Value in field \"seq\" was too long")
12471247- }
12481248-12491249- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("seq"))); err != nil {
12501250- return err
12511251- }
12521252- if _, err := cw.WriteString(string("seq")); err != nil {
12531253- return err
12541254- }
12551255-12561256- if t.Seq >= 0 {
12571257- if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Seq)); err != nil {
12581258- return err
12591259- }
12601260- } else {
12611261- if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Seq-1)); err != nil {
12621262- return err
12631263- }
12641264- }
12651265-12661266- // t.Time (string) (string)
12671267- if len("time") > 1000000 {
12681268- return xerrors.Errorf("Value in field \"time\" was too long")
12691269- }
12701270-12711271- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("time"))); err != nil {
12721272- return err
12731273- }
12741274- if _, err := cw.WriteString(string("time")); err != nil {
12751275- return err
12761276- }
12771277-12781278- if len(t.Time) > 1000000 {
12791279- return xerrors.Errorf("Value in field t.Time was too long")
12801280- }
12811281-12821282- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Time))); err != nil {
12831283- return err
12841284- }
12851285- if _, err := cw.WriteString(string(t.Time)); err != nil {
12861286- return err
12871287- }
12881288-12891289- // t.Handle (string) (string)
12901290- if len("handle") > 1000000 {
12911291- return xerrors.Errorf("Value in field \"handle\" was too long")
12921292- }
12931293-12941294- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("handle"))); err != nil {
12951295- return err
12961296- }
12971297- if _, err := cw.WriteString(string("handle")); err != nil {
12981298- return err
12991299- }
13001300-13011301- if len(t.Handle) > 1000000 {
13021302- return xerrors.Errorf("Value in field t.Handle was too long")
13031303- }
13041304-13051305- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Handle))); err != nil {
13061306- return err
13071307- }
13081308- if _, err := cw.WriteString(string(t.Handle)); err != nil {
13091309- return err
13101310- }
13111311- return nil
13121312-}
13131313-13141314-func (t *SyncSubscribeRepos_Handle) UnmarshalCBOR(r io.Reader) (err error) {
13151315- *t = SyncSubscribeRepos_Handle{}
13161316-13171317- cr := cbg.NewCborReader(r)
13181318-13191319- maj, extra, err := cr.ReadHeader()
13201320- if err != nil {
13211321- return err
13221322- }
13231323- defer func() {
13241324- if err == io.EOF {
13251325- err = io.ErrUnexpectedEOF
13261326- }
13271327- }()
13281328-13291329- if maj != cbg.MajMap {
13301330- return fmt.Errorf("cbor input should be of type map")
13311331- }
13321332-13331333- if extra > cbg.MaxLength {
13341334- return fmt.Errorf("SyncSubscribeRepos_Handle: map struct too large (%d)", extra)
13351335- }
13361336-13371337- n := extra
13381338-13391339- nameBuf := make([]byte, 6)
13401340- for i := uint64(0); i < n; i++ {
13411341- nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
13421342- if err != nil {
13431343- return err
13441344- }
13451345-13461346- if !ok {
13471347- // Field doesn't exist on this type, so ignore it
13481348- if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
13491349- return err
13501350- }
13511351- continue
13521352- }
13531353-13541354- switch string(nameBuf[:nameLen]) {
13551355- // t.Did (string) (string)
13561356- case "did":
13571357-13581358- {
13591359- sval, err := cbg.ReadStringWithMax(cr, 1000000)
13601360- if err != nil {
13611361- return err
13621362- }
13631363-13641364- t.Did = string(sval)
13651365- }
13661366- // t.Seq (int64) (int64)
13671367- case "seq":
13681368- {
13691369- maj, extra, err := cr.ReadHeader()
13701370- if err != nil {
13711371- return err
13721372- }
13731373- var extraI int64
13741374- switch maj {
13751375- case cbg.MajUnsignedInt:
13761376- extraI = int64(extra)
13771377- if extraI < 0 {
13781378- return fmt.Errorf("int64 positive overflow")
13791379- }
13801380- case cbg.MajNegativeInt:
13811381- extraI = int64(extra)
13821382- if extraI < 0 {
13831383- return fmt.Errorf("int64 negative overflow")
13841384- }
13851385- extraI = -1 - extraI
13861386- default:
13871387- return fmt.Errorf("wrong type for int64 field: %d", maj)
13881388- }
13891389-13901390- t.Seq = int64(extraI)
13911391- }
13921392- // t.Time (string) (string)
13931393- case "time":
13941394-13951395- {
13961396- sval, err := cbg.ReadStringWithMax(cr, 1000000)
13971397- if err != nil {
13981398- return err
13991399- }
14001400-14011401- t.Time = string(sval)
14021402- }
14031403- // t.Handle (string) (string)
14041404- case "handle":
14051405-14061406- {
14071407- sval, err := cbg.ReadStringWithMax(cr, 1000000)
14081408- if err != nil {
14091409- return err
14101410- }
14111411-14121412- t.Handle = string(sval)
14131413- }
14141414-14151415- default:
14161416- // Field doesn't exist on this type, so ignore it
14171417- if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
14181418- return err
14191419- }
14201420- }
14211421- }
14221422-14231423- return nil
14241424-}
14251210func (t *SyncSubscribeRepos_Identity) MarshalCBOR(w io.Writer) error {
14261211 if t == nil {
14271212 _, err := w.Write(cbg.CborNull)
···2094187920951880 return nil
20961881}
20972097-func (t *SyncSubscribeRepos_Migrate) MarshalCBOR(w io.Writer) error {
20982098- if t == nil {
20992099- _, err := w.Write(cbg.CborNull)
21002100- return err
21012101- }
2102188221032103- cw := cbg.NewCborWriter(w)
21042104-21052105- if _, err := cw.Write([]byte{164}); err != nil {
21062106- return err
21072107- }
21082108-21092109- // t.Did (string) (string)
21102110- if len("did") > 1000000 {
21112111- return xerrors.Errorf("Value in field \"did\" was too long")
21122112- }
21132113-21142114- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("did"))); err != nil {
21152115- return err
21162116- }
21172117- if _, err := cw.WriteString(string("did")); err != nil {
21182118- return err
21192119- }
21202120-21212121- if len(t.Did) > 1000000 {
21222122- return xerrors.Errorf("Value in field t.Did was too long")
21232123- }
21242124-21252125- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Did))); err != nil {
21262126- return err
21272127- }
21282128- if _, err := cw.WriteString(string(t.Did)); err != nil {
21292129- return err
21302130- }
21312131-21322132- // t.Seq (int64) (int64)
21332133- if len("seq") > 1000000 {
21342134- return xerrors.Errorf("Value in field \"seq\" was too long")
21352135- }
21362136-21372137- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("seq"))); err != nil {
21382138- return err
21392139- }
21402140- if _, err := cw.WriteString(string("seq")); err != nil {
21412141- return err
21422142- }
21432143-21442144- if t.Seq >= 0 {
21452145- if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Seq)); err != nil {
21462146- return err
21472147- }
21482148- } else {
21492149- if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Seq-1)); err != nil {
21502150- return err
21512151- }
21522152- }
21532153-21542154- // t.Time (string) (string)
21552155- if len("time") > 1000000 {
21562156- return xerrors.Errorf("Value in field \"time\" was too long")
21572157- }
21582158-21592159- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("time"))); err != nil {
21602160- return err
21612161- }
21622162- if _, err := cw.WriteString(string("time")); err != nil {
21632163- return err
21642164- }
21652165-21662166- if len(t.Time) > 1000000 {
21672167- return xerrors.Errorf("Value in field t.Time was too long")
21682168- }
21692169-21702170- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Time))); err != nil {
21712171- return err
21722172- }
21732173- if _, err := cw.WriteString(string(t.Time)); err != nil {
21742174- return err
21752175- }
21762176-21772177- // t.MigrateTo (string) (string)
21782178- if len("migrateTo") > 1000000 {
21792179- return xerrors.Errorf("Value in field \"migrateTo\" was too long")
21802180- }
21812181-21822182- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("migrateTo"))); err != nil {
21832183- return err
21842184- }
21852185- if _, err := cw.WriteString(string("migrateTo")); err != nil {
21862186- return err
21872187- }
21882188-21892189- if t.MigrateTo == nil {
21902190- if _, err := cw.Write(cbg.CborNull); err != nil {
21912191- return err
21922192- }
21932193- } else {
21942194- if len(*t.MigrateTo) > 1000000 {
21952195- return xerrors.Errorf("Value in field t.MigrateTo was too long")
21962196- }
21972197-21982198- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.MigrateTo))); err != nil {
21992199- return err
22002200- }
22012201- if _, err := cw.WriteString(string(*t.MigrateTo)); err != nil {
22022202- return err
22032203- }
22042204- }
22052205- return nil
22062206-}
22072207-22082208-func (t *SyncSubscribeRepos_Migrate) UnmarshalCBOR(r io.Reader) (err error) {
22092209- *t = SyncSubscribeRepos_Migrate{}
22102210-22112211- cr := cbg.NewCborReader(r)
22122212-22132213- maj, extra, err := cr.ReadHeader()
22142214- if err != nil {
22152215- return err
22162216- }
22172217- defer func() {
22182218- if err == io.EOF {
22192219- err = io.ErrUnexpectedEOF
22202220- }
22212221- }()
22222222-22232223- if maj != cbg.MajMap {
22242224- return fmt.Errorf("cbor input should be of type map")
22252225- }
22262226-22272227- if extra > cbg.MaxLength {
22282228- return fmt.Errorf("SyncSubscribeRepos_Migrate: map struct too large (%d)", extra)
22292229- }
22302230-22312231- n := extra
22322232-22332233- nameBuf := make([]byte, 9)
22342234- for i := uint64(0); i < n; i++ {
22352235- nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
22362236- if err != nil {
22372237- return err
22382238- }
22392239-22402240- if !ok {
22412241- // Field doesn't exist on this type, so ignore it
22422242- if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
22432243- return err
22442244- }
22452245- continue
22462246- }
22472247-22482248- switch string(nameBuf[:nameLen]) {
22492249- // t.Did (string) (string)
22502250- case "did":
22512251-22522252- {
22532253- sval, err := cbg.ReadStringWithMax(cr, 1000000)
22542254- if err != nil {
22552255- return err
22562256- }
22572257-22582258- t.Did = string(sval)
22592259- }
22602260- // t.Seq (int64) (int64)
22612261- case "seq":
22622262- {
22632263- maj, extra, err := cr.ReadHeader()
22642264- if err != nil {
22652265- return err
22662266- }
22672267- var extraI int64
22682268- switch maj {
22692269- case cbg.MajUnsignedInt:
22702270- extraI = int64(extra)
22712271- if extraI < 0 {
22722272- return fmt.Errorf("int64 positive overflow")
22732273- }
22742274- case cbg.MajNegativeInt:
22752275- extraI = int64(extra)
22762276- if extraI < 0 {
22772277- return fmt.Errorf("int64 negative overflow")
22782278- }
22792279- extraI = -1 - extraI
22802280- default:
22812281- return fmt.Errorf("wrong type for int64 field: %d", maj)
22822282- }
22832283-22842284- t.Seq = int64(extraI)
22852285- }
22862286- // t.Time (string) (string)
22872287- case "time":
22882288-22892289- {
22902290- sval, err := cbg.ReadStringWithMax(cr, 1000000)
22912291- if err != nil {
22922292- return err
22932293- }
22942294-22952295- t.Time = string(sval)
22962296- }
22972297- // t.MigrateTo (string) (string)
22982298- case "migrateTo":
22992299-23002300- {
23012301- b, err := cr.ReadByte()
23022302- if err != nil {
23032303- return err
23042304- }
23052305- if b != cbg.CborNull[0] {
23062306- if err := cr.UnreadByte(); err != nil {
23072307- return err
23082308- }
23092309-23102310- sval, err := cbg.ReadStringWithMax(cr, 1000000)
23112311- if err != nil {
23122312- return err
23132313- }
23142314-23152315- t.MigrateTo = (*string)(&sval)
23162316- }
23172317- }
23182318-23192319- default:
23202320- // Field doesn't exist on this type, so ignore it
23212321- if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
23222322- return err
23232323- }
23242324- }
23252325- }
23262326-23272327- return nil
23282328-}
23291883func (t *SyncSubscribeRepos_RepoOp) MarshalCBOR(w io.Writer) error {
23301884 if t == nil {
23311885 _, err := w.Write(cbg.CborNull)
···2540209425412095 return nil
25422096}
25432543-func (t *SyncSubscribeRepos_Tombstone) MarshalCBOR(w io.Writer) error {
25442544- if t == nil {
25452545- _, err := w.Write(cbg.CborNull)
25462546- return err
25472547- }
2548209725492549- cw := cbg.NewCborWriter(w)
25502550-25512551- if _, err := cw.Write([]byte{163}); err != nil {
25522552- return err
25532553- }
25542554-25552555- // t.Did (string) (string)
25562556- if len("did") > 1000000 {
25572557- return xerrors.Errorf("Value in field \"did\" was too long")
25582558- }
25592559-25602560- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("did"))); err != nil {
25612561- return err
25622562- }
25632563- if _, err := cw.WriteString(string("did")); err != nil {
25642564- return err
25652565- }
25662566-25672567- if len(t.Did) > 1000000 {
25682568- return xerrors.Errorf("Value in field t.Did was too long")
25692569- }
25702570-25712571- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Did))); err != nil {
25722572- return err
25732573- }
25742574- if _, err := cw.WriteString(string(t.Did)); err != nil {
25752575- return err
25762576- }
25772577-25782578- // t.Seq (int64) (int64)
25792579- if len("seq") > 1000000 {
25802580- return xerrors.Errorf("Value in field \"seq\" was too long")
25812581- }
25822582-25832583- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("seq"))); err != nil {
25842584- return err
25852585- }
25862586- if _, err := cw.WriteString(string("seq")); err != nil {
25872587- return err
25882588- }
25892589-25902590- if t.Seq >= 0 {
25912591- if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Seq)); err != nil {
25922592- return err
25932593- }
25942594- } else {
25952595- if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Seq-1)); err != nil {
25962596- return err
25972597- }
25982598- }
25992599-26002600- // t.Time (string) (string)
26012601- if len("time") > 1000000 {
26022602- return xerrors.Errorf("Value in field \"time\" was too long")
26032603- }
26042604-26052605- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("time"))); err != nil {
26062606- return err
26072607- }
26082608- if _, err := cw.WriteString(string("time")); err != nil {
26092609- return err
26102610- }
26112611-26122612- if len(t.Time) > 1000000 {
26132613- return xerrors.Errorf("Value in field t.Time was too long")
26142614- }
26152615-26162616- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Time))); err != nil {
26172617- return err
26182618- }
26192619- if _, err := cw.WriteString(string(t.Time)); err != nil {
26202620- return err
26212621- }
26222622- return nil
26232623-}
26242624-26252625-func (t *SyncSubscribeRepos_Tombstone) UnmarshalCBOR(r io.Reader) (err error) {
26262626- *t = SyncSubscribeRepos_Tombstone{}
26272627-26282628- cr := cbg.NewCborReader(r)
26292629-26302630- maj, extra, err := cr.ReadHeader()
26312631- if err != nil {
26322632- return err
26332633- }
26342634- defer func() {
26352635- if err == io.EOF {
26362636- err = io.ErrUnexpectedEOF
26372637- }
26382638- }()
26392639-26402640- if maj != cbg.MajMap {
26412641- return fmt.Errorf("cbor input should be of type map")
26422642- }
26432643-26442644- if extra > cbg.MaxLength {
26452645- return fmt.Errorf("SyncSubscribeRepos_Tombstone: map struct too large (%d)", extra)
26462646- }
26472647-26482648- n := extra
26492649-26502650- nameBuf := make([]byte, 4)
26512651- for i := uint64(0); i < n; i++ {
26522652- nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
26532653- if err != nil {
26542654- return err
26552655- }
26562656-26572657- if !ok {
26582658- // Field doesn't exist on this type, so ignore it
26592659- if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
26602660- return err
26612661- }
26622662- continue
26632663- }
26642664-26652665- switch string(nameBuf[:nameLen]) {
26662666- // t.Did (string) (string)
26672667- case "did":
26682668-26692669- {
26702670- sval, err := cbg.ReadStringWithMax(cr, 1000000)
26712671- if err != nil {
26722672- return err
26732673- }
26742674-26752675- t.Did = string(sval)
26762676- }
26772677- // t.Seq (int64) (int64)
26782678- case "seq":
26792679- {
26802680- maj, extra, err := cr.ReadHeader()
26812681- if err != nil {
26822682- return err
26832683- }
26842684- var extraI int64
26852685- switch maj {
26862686- case cbg.MajUnsignedInt:
26872687- extraI = int64(extra)
26882688- if extraI < 0 {
26892689- return fmt.Errorf("int64 positive overflow")
26902690- }
26912691- case cbg.MajNegativeInt:
26922692- extraI = int64(extra)
26932693- if extraI < 0 {
26942694- return fmt.Errorf("int64 negative overflow")
26952695- }
26962696- extraI = -1 - extraI
26972697- default:
26982698- return fmt.Errorf("wrong type for int64 field: %d", maj)
26992699- }
27002700-27012701- t.Seq = int64(extraI)
27022702- }
27032703- // t.Time (string) (string)
27042704- case "time":
27052705-27062706- {
27072707- sval, err := cbg.ReadStringWithMax(cr, 1000000)
27082708- if err != nil {
27092709- return err
27102710- }
27112711-27122712- t.Time = string(sval)
27132713- }
27142714-27152715- default:
27162716- // Field doesn't exist on this type, so ignore it
27172717- if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
27182718- return err
27192719- }
27202720- }
27212721- }
27222722-27232723- return nil
27242724-}
27252098func (t *LabelDefs_SelfLabels) MarshalCBOR(w io.Writer) error {
27262099 if t == nil {
27272100 _, err := w.Write(cbg.CborNull)
-29
api/atproto/syncsubscribeRepos.go
···4949 TooBig bool `json:"tooBig" cborgen:"tooBig"`
5050}
51515252-// SyncSubscribeRepos_Handle is a "handle" in the com.atproto.sync.subscribeRepos schema.
5353-//
5454-// DEPRECATED -- Use #identity event instead
5555-type SyncSubscribeRepos_Handle struct {
5656- Did string `json:"did" cborgen:"did"`
5757- Handle string `json:"handle" cborgen:"handle"`
5858- Seq int64 `json:"seq" cborgen:"seq"`
5959- Time string `json:"time" cborgen:"time"`
6060-}
6161-6252// SyncSubscribeRepos_Identity is a "identity" in the com.atproto.sync.subscribeRepos schema.
6353//
6454// Represents a change to an account's identity. Could be an updated handle, signing key, or pds hosting endpoint. Serves as a prod to all downstream services to refresh their identity cache.
···7666 Name string `json:"name" cborgen:"name"`
7767}
78687979-// SyncSubscribeRepos_Migrate is a "migrate" in the com.atproto.sync.subscribeRepos schema.
8080-//
8181-// DEPRECATED -- Use #account event instead
8282-type SyncSubscribeRepos_Migrate struct {
8383- Did string `json:"did" cborgen:"did"`
8484- MigrateTo *string `json:"migrateTo" cborgen:"migrateTo"`
8585- Seq int64 `json:"seq" cborgen:"seq"`
8686- Time string `json:"time" cborgen:"time"`
8787-}
8888-8969// SyncSubscribeRepos_RepoOp is a "repoOp" in the com.atproto.sync.subscribeRepos schema.
9070//
9171// A repo operation, ie a mutation of a single record.
···11393 // time: Timestamp of when this message was originally broadcast.
11494 Time string `json:"time" cborgen:"time"`
11595}
116116-117117-// SyncSubscribeRepos_Tombstone is a "tombstone" in the com.atproto.sync.subscribeRepos schema.
118118-//
119119-// DEPRECATED -- Use #account event instead
120120-type SyncSubscribeRepos_Tombstone struct {
121121- Did string `json:"did" cborgen:"did"`
122122- Seq int64 `json:"seq" cborgen:"seq"`
123123- Time string `json:"time" cborgen:"time"`
124124-}
+6
api/bsky/feeddefs.go
···3535 Post *FeedDefs_PostView `json:"post" cborgen:"post"`
3636 Reason *FeedDefs_FeedViewPost_Reason `json:"reason,omitempty" cborgen:"reason,omitempty"`
3737 Reply *FeedDefs_ReplyRef `json:"reply,omitempty" cborgen:"reply,omitempty"`
3838+ // reqId: Unique identifier per request that may be passed back alongside interactions.
3939+ ReqId *string `json:"reqId,omitempty" cborgen:"reqId,omitempty"`
3840}
39414042type FeedDefs_FeedViewPost_Reason struct {
···104106 // feedContext: Context on a feed item that was originally supplied by the feed generator on getFeedSkeleton.
105107 FeedContext *string `json:"feedContext,omitempty" cborgen:"feedContext,omitempty"`
106108 Item *string `json:"item,omitempty" cborgen:"item,omitempty"`
109109+ // reqId: Unique identifier per request that may be passed back alongside interactions.
110110+ ReqId *string `json:"reqId,omitempty" cborgen:"reqId,omitempty"`
107111}
108112109113// FeedDefs_NotFoundPost is a "notFoundPost" in the app.bsky.feed.defs schema.
···207211type FeedDefs_ReasonRepost struct {
208212 LexiconTypeID string `json:"$type,const=app.bsky.feed.defs#reasonRepost" cborgen:"$type,const=app.bsky.feed.defs#reasonRepost"`
209213 By *ActorDefs_ProfileViewBasic `json:"by" cborgen:"by"`
214214+ Cid *string `json:"cid,omitempty" cborgen:"cid,omitempty"`
210215 IndexedAt string `json:"indexedAt" cborgen:"indexedAt"`
216216+ Uri *string `json:"uri,omitempty" cborgen:"uri,omitempty"`
211217}
212218213219// FeedDefs_ReplyRef is a "replyRef" in the app.bsky.feed.defs schema.
+2
api/bsky/feedgetFeedSkeleton.go
···1414type FeedGetFeedSkeleton_Output struct {
1515 Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"`
1616 Feed []*FeedDefs_SkeletonFeedPost `json:"feed" cborgen:"feed"`
1717+ // reqId: Unique identifier per request that may be passed back alongside interactions.
1818+ ReqId *string `json:"reqId,omitempty" cborgen:"reqId,omitempty"`
1719}
18201921// FeedGetFeedSkeleton calls the XRPC method "app.bsky.feed.getFeedSkeleton".
···1919 IndexedAt string `json:"indexedAt" cborgen:"indexedAt"`
2020 IsRead bool `json:"isRead" cborgen:"isRead"`
2121 Labels []*comatprototypes.LabelDefs_Label `json:"labels,omitempty" cborgen:"labels,omitempty"`
2222- // reason: Expected values are 'like', 'repost', 'follow', 'mention', 'reply', 'quote', 'starterpack-joined', 'verified', and 'unverified'.
2222+ // reason: The reason why this notification was delivered - e.g. your post was liked, or you received a new follower.
2323 Reason string `json:"reason" cborgen:"reason"`
2424 ReasonSubject *string `json:"reasonSubject,omitempty" cborgen:"reasonSubject,omitempty"`
2525 Record *util.LexiconTypeDecoder `json:"record" cborgen:"record"`
+8-1
api/bsky/unspeccedgetConfig.go
···1010 "github.com/bluesky-social/indigo/xrpc"
1111)
12121313+// UnspeccedGetConfig_LiveNowConfig is a "liveNowConfig" in the app.bsky.unspecced.getConfig schema.
1414+type UnspeccedGetConfig_LiveNowConfig struct {
1515+ Did string `json:"did" cborgen:"did"`
1616+ Domains []string `json:"domains" cborgen:"domains"`
1717+}
1818+1319// UnspeccedGetConfig_Output is the output of a app.bsky.unspecced.getConfig call.
1420type UnspeccedGetConfig_Output struct {
1515- CheckEmailConfirmed *bool `json:"checkEmailConfirmed,omitempty" cborgen:"checkEmailConfirmed,omitempty"`
2121+ CheckEmailConfirmed *bool `json:"checkEmailConfirmed,omitempty" cborgen:"checkEmailConfirmed,omitempty"`
2222+ LiveNow []*UnspeccedGetConfig_LiveNowConfig `json:"liveNow,omitempty" cborgen:"liveNow,omitempty"`
1623}
17241825// UnspeccedGetConfig calls the XRPC method "app.bsky.unspecced.getConfig".
-1
api/ozone/moderationdefs.go
···10431043//
10441044// Detailed view of a subject. For record subjects, the author's repo and profile will be returned.
10451045type ModerationDefs_SubjectView struct {
10461046- //Profile *ModerationDefs_SubjectView_Profile `json:"profile,omitempty" cborgen:"profile,omitempty"`
10471046 Record *ModerationDefs_RecordViewDetail `json:"record,omitempty" cborgen:"record,omitempty"`
10481047 Repo *ModerationDefs_RepoViewDetail `json:"repo,omitempty" cborgen:"repo,omitempty"`
10491048 Status *ModerationDefs_SubjectStatusView `json:"status,omitempty" cborgen:"status,omitempty"`
+4-6
api/ozone/verificationdefs.go
···2222 // handle: Handle of the subject the verification applies to at the moment of verifying, which might not be the same at the time of viewing. The verification is only valid if the current handle matches the one at the time of verifying.
2323 Handle string `json:"handle" cborgen:"handle"`
2424 // issuer: The user who issued this verification.
2525- Issuer string `json:"issuer" cborgen:"issuer"`
2626- //IssuerProfile *VerificationDefs_VerificationView_IssuerProfile `json:"issuerProfile,omitempty" cborgen:"issuerProfile,omitempty"`
2727- //IssuerRepo *VerificationDefs_VerificationView_IssuerRepo `json:"issuerRepo,omitempty" cborgen:"issuerRepo,omitempty"`
2525+ Issuer string `json:"issuer" cborgen:"issuer"`
2626+ IssuerRepo *VerificationDefs_VerificationView_IssuerRepo `json:"issuerRepo,omitempty" cborgen:"issuerRepo,omitempty"`
2827 // revokeReason: Describes the reason for revocation, also indicating that the verification is no longer valid.
2928 RevokeReason *string `json:"revokeReason,omitempty" cborgen:"revokeReason,omitempty"`
3029 // revokedAt: Timestamp when the verification was revoked.
···3231 // revokedBy: The user who revoked this verification.
3332 RevokedBy *string `json:"revokedBy,omitempty" cborgen:"revokedBy,omitempty"`
3433 // subject: The subject of the verification.
3535- Subject string `json:"subject" cborgen:"subject"`
3636- //SubjectProfile *VerificationDefs_VerificationView_SubjectProfile `json:"subjectProfile,omitempty" cborgen:"subjectProfile,omitempty"`
3737- //SubjectRepo *VerificationDefs_VerificationView_SubjectRepo `json:"subjectRepo,omitempty" cborgen:"subjectRepo,omitempty"`
3434+ Subject string `json:"subject" cborgen:"subject"`
3535+ SubjectRepo *VerificationDefs_VerificationView_SubjectRepo `json:"subjectRepo,omitempty" cborgen:"subjectRepo,omitempty"`
3836 // uri: The AT-URI of the verification record.
3937 Uri string `json:"uri" cborgen:"uri"`
4038}
···3030 // No ASN.1 or other enclosing structure is applied to the bytes.
3131 Bytes() []byte
32323333- // NOTE: should Multibase() (string, error) be part of this interface? Probably.
3333+ // String serialization of the key bytes in "Multibase" format.
3434+ Multibase() string
3435}
35363637// Common interface for all the supported atproto cryptographic systems.
···6364 // For systems with no compressed/uncompressed distinction, returns the same
6465 // value as Bytes().
6566 UncompressedBytes() []byte
6767+6868+ // Serialization as JWK struct (which can be marshalled to JSON)
6969+ JWK() (*JWK, error)
6670}
67716872var ErrInvalidSignature = errors.New("crytographic signature invalid")
···11111212func parseFloat(f float64) (int64, error) {
1313 if f != float64(int64(f)) {
1414- return 0, fmt.Errorf("number was is not a safe integer: %f", f)
1414+ return 0, fmt.Errorf("number is not a safe integer: %f", f)
1515 }
1616 return int64(f), nil
1717}
-78
bgs/bgs.go
···903903904904 repoCommitsResultCounter.WithLabelValues(host.Host, "ok").Inc()
905905 return nil
906906- case env.RepoHandle != nil:
907907- bgs.log.Info("bgs got repo handle event", "did", env.RepoHandle.Did, "handle", env.RepoHandle.Handle)
908908- // Flush any cached DID documents for this user
909909- bgs.didr.FlushCacheFor(env.RepoHandle.Did)
910910-911911- // TODO: ignoring the data in the message and just going out to the DID doc
912912- act, err := bgs.createExternalUser(ctx, env.RepoHandle.Did)
913913- if err != nil {
914914- return err
915915- }
916916-917917- if act.Handle.String != env.RepoHandle.Handle {
918918- bgs.log.Warn("handle update did not update handle to asserted value", "did", env.RepoHandle.Did, "expected", env.RepoHandle.Handle, "actual", act.Handle)
919919- }
920920-921921- // TODO: Update the ReposHandle event type to include "verified" or something
922922-923923- // Broadcast the handle update to all consumers
924924- err = bgs.events.AddEvent(ctx, &events.XRPCStreamEvent{
925925- RepoHandle: &comatproto.SyncSubscribeRepos_Handle{
926926- Did: env.RepoHandle.Did,
927927- Handle: env.RepoHandle.Handle,
928928- Time: env.RepoHandle.Time,
929929- },
930930- })
931931- if err != nil {
932932- bgs.log.Error("failed to broadcast RepoHandle event", "error", err, "did", env.RepoHandle.Did, "handle", env.RepoHandle.Handle)
933933- return fmt.Errorf("failed to broadcast RepoHandle event: %w", err)
934934- }
935935-936936- return nil
937906 case env.RepoIdentity != nil:
938907 bgs.log.Info("bgs got identity event", "did", env.RepoIdentity.Did)
939908 // Flush any cached DID documents for this user
···10351004 }
1036100510371006 return nil
10381038- case env.RepoMigrate != nil:
10391039- if _, err := bgs.createExternalUser(ctx, env.RepoMigrate.Did); err != nil {
10401040- return err
10411041- }
10421042-10431043- return nil
10441044- case env.RepoTombstone != nil:
10451045- if err := bgs.handleRepoTombstone(ctx, host, env.RepoTombstone); err != nil {
10461046- return err
10471047- }
10481048-10491049- return nil
10501007 default:
10511008 return fmt.Errorf("invalid fed event")
10521009 }
10531053-}
10541054-10551055-func (bgs *BGS) handleRepoTombstone(ctx context.Context, pds *models.PDS, evt *atproto.SyncSubscribeRepos_Tombstone) error {
10561056- u, err := bgs.lookupUserByDid(ctx, evt.Did)
10571057- if err != nil {
10581058- return err
10591059- }
10601060-10611061- if u.PDS != pds.ID {
10621062- return fmt.Errorf("unauthoritative tombstone event from %s for %s", pds.Host, evt.Did)
10631063- }
10641064-10651065- if err := bgs.db.Model(&User{}).Where("id = ?", u.ID).UpdateColumns(map[string]any{
10661066- "tombstoned": true,
10671067- "handle": nil,
10681068- }).Error; err != nil {
10691069- return err
10701070- }
10711071- u.SetTombstoned(true)
10721072-10731073- if err := bgs.db.Model(&models.ActorInfo{}).Where("uid = ?", u.ID).UpdateColumns(map[string]any{
10741074- "handle": nil,
10751075- }).Error; err != nil {
10761076- return err
10771077- }
10781078-10791079- // delete data from carstore
10801080- if err := bgs.repoman.TakeDownRepo(ctx, u.ID); err != nil {
10811081- // don't let a failure here prevent us from propagating this event
10821082- bgs.log.Error("failed to delete user data from carstore", "err", err)
10831083- }
10841084-10851085- return bgs.events.AddEvent(ctx, &events.XRPCStreamEvent{
10861086- RepoTombstone: evt,
10871087- })
10881010}
1089101110901012// TODO: rename? This also updates users, and 'external' is an old phrasing
···484484 pjob.Evt.RepoCommit.Seq = seq
485485 case pjob.Evt.RepoSync != nil:
486486 pjob.Evt.RepoSync.Seq = seq
487487- case pjob.Evt.RepoHandle != nil:
488488- pjob.Evt.RepoHandle.Seq = seq
489487 case pjob.Evt.RepoIdentity != nil:
490488 pjob.Evt.RepoIdentity.Seq = seq
491489 case pjob.Evt.RepoAccount != nil:
492490 pjob.Evt.RepoAccount.Seq = seq
493493- case pjob.Evt.RepoTombstone != nil:
494494- pjob.Evt.RepoTombstone.Seq = seq
495491 default:
496492 // only those three get peristed right now
497493 // we should not actually ever get here...
···547543 if err := xevt.RepoSync.MarshalCBOR(cw); err != nil {
548544 return fmt.Errorf("failed to marshal: %w", err)
549545 }
550550- case xevt.RepoHandle != nil:
551551- evtKind = evtKindHandle
552552- did = xevt.RepoHandle.Did
553553- if err := xevt.RepoHandle.MarshalCBOR(cw); err != nil {
554554- return fmt.Errorf("failed to marshal: %w", err)
555555- }
556546 case xevt.RepoIdentity != nil:
557547 evtKind = evtKindIdentity
558548 did = xevt.RepoIdentity.Did
···563553 evtKind = evtKindAccount
564554 did = xevt.RepoAccount.Did
565555 if err := xevt.RepoAccount.MarshalCBOR(cw); err != nil {
566566- return fmt.Errorf("failed to marshal: %w", err)
567567- }
568568- case xevt.RepoTombstone != nil:
569569- evtKind = evtKindTombstone
570570- did = xevt.RepoTombstone.Did
571571- if err := xevt.RepoTombstone.MarshalCBOR(cw); err != nil {
572556 return fmt.Errorf("failed to marshal: %w", err)
573557 }
574558 default:
···810794 if err := cb(&stream.XRPCStreamEvent{RepoSync: &evt}); err != nil {
811795 return nil, err
812796 }
813813- case evtKindHandle:
814814- var evt atproto.SyncSubscribeRepos_Handle
815815- if err := evt.UnmarshalCBOR(io.LimitReader(bufr, h.Len64())); err != nil {
816816- return nil, err
817817- }
818818- evt.Seq = h.Seq
819819- if err := cb(&stream.XRPCStreamEvent{RepoHandle: &evt}); err != nil {
820820- return nil, err
821821- }
822797 case evtKindIdentity:
823798 var evt atproto.SyncSubscribeRepos_Identity
824799 if err := evt.UnmarshalCBOR(io.LimitReader(bufr, h.Len64())); err != nil {
···835810 }
836811 evt.Seq = h.Seq
837812 if err := cb(&stream.XRPCStreamEvent{RepoAccount: &evt}); err != nil {
838838- return nil, err
839839- }
840840- case evtKindTombstone:
841841- var evt atproto.SyncSubscribeRepos_Tombstone
842842- if err := evt.UnmarshalCBOR(io.LimitReader(bufr, h.Len64())); err != nil {
843843- return nil, err
844844- }
845845- evt.Seq = h.Seq
846846- if err := cb(&stream.XRPCStreamEvent{RepoTombstone: &evt}); err != nil {
847813 return nil, err
848814 }
849815 default:
-8
cmd/relay/testing/consumer.go
···6262 c.LastSeq = evt.Seq
6363 return nil
6464 },
6565- // NOTE: this is included to test that the events are *not* passed through; can be removed in the near future
6666- RepoHandle: func(evt *comatproto.SyncSubscribeRepos_Handle) error {
6767- c.eventsLk.Lock()
6868- defer c.eventsLk.Unlock()
6969- c.Events = append(c.Events, &stream.XRPCStreamEvent{RepoHandle: evt})
7070- c.LastSeq = evt.Seq
7171- return nil
7272- },
7365 }
7466 return rsc
7567}
-36
cmd/sonar/sonar.go
···109109 case xe.RepoCommit != nil:
110110 eventsProcessedCounter.WithLabelValues("repo_commit", s.SocketURL).Inc()
111111 return s.HandleRepoCommit(ctx, xe.RepoCommit)
112112- case xe.RepoHandle != nil:
113113- eventsProcessedCounter.WithLabelValues("repo_handle", s.SocketURL).Inc()
114114- now := time.Now()
115115- s.ProgMux.Lock()
116116- s.Progress.LastSeq = xe.RepoHandle.Seq
117117- s.Progress.LastSeqProcessedAt = now
118118- s.ProgMux.Unlock()
119119- // Parse time from the event time string
120120- t, err := time.Parse(time.RFC3339, xe.RepoHandle.Time)
121121- if err != nil {
122122- s.Logger.Error("error parsing time", "err", err)
123123- return nil
124124- }
125125- lastEvtCreatedAtGauge.WithLabelValues(s.SocketURL).Set(float64(t.UnixNano()))
126126- lastEvtProcessedAtGauge.WithLabelValues(s.SocketURL).Set(float64(now.UnixNano()))
127127- lastEvtCreatedEvtProcessedGapGauge.WithLabelValues(s.SocketURL).Set(float64(now.Sub(t).Seconds()))
128128- lastSeqGauge.WithLabelValues(s.SocketURL).Set(float64(xe.RepoHandle.Seq))
129112 case xe.RepoIdentity != nil:
130113 eventsProcessedCounter.WithLabelValues("identity", s.SocketURL).Inc()
131114 now := time.Now()
···142125 s.ProgMux.Unlock()
143126 case xe.RepoInfo != nil:
144127 eventsProcessedCounter.WithLabelValues("repo_info", s.SocketURL).Inc()
145145- case xe.RepoMigrate != nil:
146146- eventsProcessedCounter.WithLabelValues("repo_migrate", s.SocketURL).Inc()
147147- now := time.Now()
148148- s.ProgMux.Lock()
149149- s.Progress.LastSeq = xe.RepoMigrate.Seq
150150- s.Progress.LastSeqProcessedAt = time.Now()
151151- s.ProgMux.Unlock()
152152- // Parse time from the event time string
153153- t, err := time.Parse(time.RFC3339, xe.RepoMigrate.Time)
154154- if err != nil {
155155- s.Logger.Error("error parsing time", "err", err)
156156- return nil
157157- }
158158- lastEvtCreatedAtGauge.WithLabelValues(s.SocketURL).Set(float64(t.UnixNano()))
159159- lastEvtProcessedAtGauge.WithLabelValues(s.SocketURL).Set(float64(now.UnixNano()))
160160- lastEvtCreatedEvtProcessedGapGauge.WithLabelValues(s.SocketURL).Set(float64(now.Sub(t).Seconds()))
161161- lastSeqGauge.WithLabelValues(s.SocketURL).Set(float64(xe.RepoHandle.Seq))
162162- case xe.RepoTombstone != nil:
163163- eventsProcessedCounter.WithLabelValues("repo_tombstone", s.SocketURL).Inc()
164128 case xe.LabelInfo != nil:
165129 eventsProcessedCounter.WithLabelValues("label_info", s.SocketURL).Inc()
166130 case xe.LabelLabels != nil:
···11+package util
22+33+import (
44+ "context"
55+ "net/http"
66+)
77+88+const (
99+ Query = http.MethodGet
1010+ Procedure = http.MethodPost
1111+)
1212+1313+// API client interface used in lexgen.
1414+//
1515+// 'method' is the HTTP method type. 'inputEncoding' is the Content-Type for bodyData in Procedure calls. 'params' are query parameters. 'bodyData' should be either 'nil', an [io.Reader], or a type which can be marshalled to JSON. 'out' is optional; if not nil it should be a pointer to a type which can be un-Marshaled as JSON, for the response body.
1616+type LexClient interface {
1717+ LexDo(ctx context.Context, method string, inputEncoding string, endpoint string, params map[string]any, bodyData any, out any) error
1818+}