fork of indigo with slightly nicer lexgen

Merge branch 'bluesky-social:main' into plc-cmds

authored by retr0.id and committed by GitHub f88db226 a128a7e6

Changed files
+62 -6
api
atproto
carstore
+28
api/bsky/notificationunregisterPush.go
··· 1 + // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 + 3 + package bsky 4 + 5 + // schema: app.bsky.notification.unregisterPush 6 + 7 + import ( 8 + "context" 9 + 10 + "github.com/bluesky-social/indigo/lex/util" 11 + ) 12 + 13 + // NotificationUnregisterPush_Input is the input argument to a app.bsky.notification.unregisterPush call. 14 + type NotificationUnregisterPush_Input struct { 15 + AppId string `json:"appId" cborgen:"appId"` 16 + Platform string `json:"platform" cborgen:"platform"` 17 + ServiceDid string `json:"serviceDid" cborgen:"serviceDid"` 18 + Token string `json:"token" cborgen:"token"` 19 + } 20 + 21 + // NotificationUnregisterPush calls the XRPC method "app.bsky.notification.unregisterPush". 22 + func NotificationUnregisterPush(ctx context.Context, c util.LexClient, input *NotificationUnregisterPush_Input) error { 23 + if err := c.LexDo(ctx, util.Procedure, "application/json", "app.bsky.notification.unregisterPush", nil, input, nil); err != nil { 24 + return err 25 + } 26 + 27 + return nil 28 + }
+4 -2
api/ozone/moderationemitEvent.go
··· 15 15 16 16 // ModerationEmitEvent_Input is the input argument to a tools.ozone.moderation.emitEvent call. 17 17 type ModerationEmitEvent_Input struct { 18 - CreatedBy string `json:"createdBy" cborgen:"createdBy"` 19 - Event *ModerationEmitEvent_Input_Event `json:"event" cborgen:"event"` 18 + CreatedBy string `json:"createdBy" cborgen:"createdBy"` 19 + Event *ModerationEmitEvent_Input_Event `json:"event" cborgen:"event"` 20 + // externalId: An optional external ID for the event, used to deduplicate events from external systems. Fails when an event of same type with the same external ID exists for the same subject. 21 + ExternalId *string `json:"externalId,omitempty" cborgen:"externalId,omitempty"` 20 22 ModTool *ModerationDefs_ModTool `json:"modTool,omitempty" cborgen:"modTool,omitempty"` 21 23 Subject *ModerationEmitEvent_Input_Subject `json:"subject" cborgen:"subject"` 22 24 SubjectBlobCids []string `json:"subjectBlobCids,omitempty" cborgen:"subjectBlobCids,omitempty"`
+27
atproto/identity/mock_directory.go
··· 4 4 "context" 5 5 "encoding/json" 6 6 "fmt" 7 + "sync" 7 8 8 9 "github.com/bluesky-social/indigo/atproto/syntax" 9 10 ) 10 11 11 12 // A fake identity directory, for use in tests 12 13 type MockDirectory struct { 14 + mu *sync.RWMutex 13 15 Handles map[syntax.Handle]syntax.DID 14 16 Identities map[syntax.DID]Identity 15 17 } ··· 19 21 20 22 func NewMockDirectory() MockDirectory { 21 23 return MockDirectory{ 24 + mu: &sync.RWMutex{}, 22 25 Handles: make(map[syntax.Handle]syntax.DID), 23 26 Identities: make(map[syntax.DID]Identity), 24 27 } 25 28 } 26 29 27 30 func (d *MockDirectory) Insert(ident Identity) { 31 + d.mu.Lock() 32 + defer d.mu.Unlock() 33 + 28 34 if !ident.Handle.IsInvalidHandle() { 29 35 d.Handles[ident.Handle.Normalize()] = ident.DID 30 36 } ··· 32 38 } 33 39 34 40 func (d *MockDirectory) LookupHandle(ctx context.Context, h syntax.Handle) (*Identity, error) { 41 + d.mu.RLock() 42 + defer d.mu.RUnlock() 43 + 35 44 h = h.Normalize() 36 45 did, ok := d.Handles[h] 37 46 if !ok { ··· 45 54 } 46 55 47 56 func (d *MockDirectory) LookupDID(ctx context.Context, did syntax.DID) (*Identity, error) { 57 + d.mu.RLock() 58 + defer d.mu.RUnlock() 59 + 48 60 ident, ok := d.Identities[did] 49 61 if !ok { 50 62 return nil, ErrDIDNotFound ··· 53 65 } 54 66 55 67 func (d *MockDirectory) Lookup(ctx context.Context, a syntax.AtIdentifier) (*Identity, error) { 68 + d.mu.RLock() 69 + defer d.mu.RUnlock() 70 + 56 71 handle, err := a.AsHandle() 57 72 if nil == err { // if not an error, is a Handle 58 73 return d.LookupHandle(ctx, handle) ··· 65 80 } 66 81 67 82 func (d *MockDirectory) ResolveHandle(ctx context.Context, h syntax.Handle) (syntax.DID, error) { 83 + d.mu.RLock() 84 + defer d.mu.RUnlock() 85 + 68 86 h = h.Normalize() 69 87 did, ok := d.Handles[h] 70 88 if !ok { ··· 74 92 } 75 93 76 94 func (d *MockDirectory) ResolveDID(ctx context.Context, did syntax.DID) (*DIDDocument, error) { 95 + d.mu.RLock() 96 + defer d.mu.RUnlock() 97 + 77 98 ident, ok := d.Identities[did] 78 99 if !ok { 79 100 return nil, ErrDIDNotFound ··· 83 104 } 84 105 85 106 func (d *MockDirectory) ResolveDIDRaw(ctx context.Context, did syntax.DID) (json.RawMessage, error) { 107 + d.mu.RLock() 108 + defer d.mu.RUnlock() 109 + 86 110 ident, ok := d.Identities[did] 87 111 if !ok { 88 112 return nil, ErrDIDNotFound ··· 92 116 } 93 117 94 118 func (d *MockDirectory) Purge(ctx context.Context, a syntax.AtIdentifier) error { 119 + d.mu.Lock() 120 + defer d.mu.Unlock() 121 + 95 122 return nil 96 123 }
+3 -1
carstore/repo_test.go
··· 16 16 appbsky "github.com/bluesky-social/indigo/api/bsky" 17 17 "github.com/bluesky-social/indigo/repo" 18 18 "github.com/bluesky-social/indigo/util" 19 - sqlbs "github.com/ipfs/go-bs-sqlite3" 19 + //sqlbs "github.com/ipfs/go-bs-sqlite3" 20 20 "github.com/ipfs/go-cid" 21 21 flatfs "github.com/ipfs/go-ds-flatfs" 22 22 blockstore "github.com/ipfs/go-ipfs-blockstore" ··· 452 452 } 453 453 } 454 454 455 + /* NOTE(bnewbold): this depends on github.com/ipfs/go-bs-sqlite3, which rewrote git history (?) breaking the dependency tree. We can roll forward, but that will require broad dependency updates. So for now just removing this benchmark/perf test. 455 456 func BenchmarkRepoWritesSqlite(b *testing.B) { 456 457 ctx := context.TODO() 457 458 ··· 489 490 head = nroot 490 491 } 491 492 } 493 + */ 492 494 493 495 func TestDuplicateBlockAcrossShards(ot *testing.T) { 494 496 ctx := context.TODO()
-1
go.mod
··· 25 25 github.com/hashicorp/golang-lru/v2 v2.0.7 26 26 github.com/icrowley/fake v0.0.0-20221112152111-d7b7e2276db2 27 27 github.com/ipfs/go-block-format v0.2.0 28 - github.com/ipfs/go-bs-sqlite3 v0.0.0-20221122195556-bfcee1be620d 29 28 github.com/ipfs/go-cid v0.4.1 30 29 github.com/ipfs/go-datastore v0.6.0 31 30 github.com/ipfs/go-ds-flatfs v0.5.1
-2
go.sum
··· 184 184 github.com/ipfs/go-block-format v0.2.0/go.mod h1:+jpL11nFx5A/SPpsoBn6Bzkra/zaArfSmsknbPMYgzM= 185 185 github.com/ipfs/go-blockservice v0.5.2 h1:in9Bc+QcXwd1apOVM7Un9t8tixPKdaHQFdLSUM1Xgk8= 186 186 github.com/ipfs/go-blockservice v0.5.2/go.mod h1:VpMblFEqG67A/H2sHKAemeH9vlURVavlysbdUI632yk= 187 - github.com/ipfs/go-bs-sqlite3 v0.0.0-20221122195556-bfcee1be620d h1:9V+GGXCuOfDiFpdAHz58q9mKLg447xp0cQKvqQrAwYE= 188 - github.com/ipfs/go-bs-sqlite3 v0.0.0-20221122195556-bfcee1be620d/go.mod h1:pMbnFyNAGjryYCLCe59YDLRv/ujdN+zGJBT1umlvYRM= 189 187 github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= 190 188 github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk= 191 189 github.com/ipfs/go-datastore v0.5.0/go.mod h1:9zhEApYMTl17C8YDp7JmU7sQZi2/wqiYh73hakZ90Bk=