+28
api/bsky/notificationunregisterPush.go
+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
+4
-2
api/ozone/moderationemitEvent.go
···
15
16
// ModerationEmitEvent_Input is the input argument to a tools.ozone.moderation.emitEvent call.
17
type ModerationEmitEvent_Input struct {
18
-
CreatedBy string `json:"createdBy" cborgen:"createdBy"`
19
-
Event *ModerationEmitEvent_Input_Event `json:"event" cborgen:"event"`
20
ModTool *ModerationDefs_ModTool `json:"modTool,omitempty" cborgen:"modTool,omitempty"`
21
Subject *ModerationEmitEvent_Input_Subject `json:"subject" cborgen:"subject"`
22
SubjectBlobCids []string `json:"subjectBlobCids,omitempty" cborgen:"subjectBlobCids,omitempty"`
···
15
16
// ModerationEmitEvent_Input is the input argument to a tools.ozone.moderation.emitEvent call.
17
type ModerationEmitEvent_Input struct {
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"`
22
ModTool *ModerationDefs_ModTool `json:"modTool,omitempty" cborgen:"modTool,omitempty"`
23
Subject *ModerationEmitEvent_Input_Subject `json:"subject" cborgen:"subject"`
24
SubjectBlobCids []string `json:"subjectBlobCids,omitempty" cborgen:"subjectBlobCids,omitempty"`
+27
atproto/identity/mock_directory.go
+27
atproto/identity/mock_directory.go
···
4
"context"
5
"encoding/json"
6
"fmt"
7
8
"github.com/bluesky-social/indigo/atproto/syntax"
9
)
10
11
// A fake identity directory, for use in tests
12
type MockDirectory struct {
13
Handles map[syntax.Handle]syntax.DID
14
Identities map[syntax.DID]Identity
15
}
···
19
20
func NewMockDirectory() MockDirectory {
21
return MockDirectory{
22
Handles: make(map[syntax.Handle]syntax.DID),
23
Identities: make(map[syntax.DID]Identity),
24
}
25
}
26
27
func (d *MockDirectory) Insert(ident Identity) {
28
if !ident.Handle.IsInvalidHandle() {
29
d.Handles[ident.Handle.Normalize()] = ident.DID
30
}
···
32
}
33
34
func (d *MockDirectory) LookupHandle(ctx context.Context, h syntax.Handle) (*Identity, error) {
35
h = h.Normalize()
36
did, ok := d.Handles[h]
37
if !ok {
···
45
}
46
47
func (d *MockDirectory) LookupDID(ctx context.Context, did syntax.DID) (*Identity, error) {
48
ident, ok := d.Identities[did]
49
if !ok {
50
return nil, ErrDIDNotFound
···
53
}
54
55
func (d *MockDirectory) Lookup(ctx context.Context, a syntax.AtIdentifier) (*Identity, error) {
56
handle, err := a.AsHandle()
57
if nil == err { // if not an error, is a Handle
58
return d.LookupHandle(ctx, handle)
···
65
}
66
67
func (d *MockDirectory) ResolveHandle(ctx context.Context, h syntax.Handle) (syntax.DID, error) {
68
h = h.Normalize()
69
did, ok := d.Handles[h]
70
if !ok {
···
74
}
75
76
func (d *MockDirectory) ResolveDID(ctx context.Context, did syntax.DID) (*DIDDocument, error) {
77
ident, ok := d.Identities[did]
78
if !ok {
79
return nil, ErrDIDNotFound
···
83
}
84
85
func (d *MockDirectory) ResolveDIDRaw(ctx context.Context, did syntax.DID) (json.RawMessage, error) {
86
ident, ok := d.Identities[did]
87
if !ok {
88
return nil, ErrDIDNotFound
···
92
}
93
94
func (d *MockDirectory) Purge(ctx context.Context, a syntax.AtIdentifier) error {
95
return nil
96
}
···
4
"context"
5
"encoding/json"
6
"fmt"
7
+
"sync"
8
9
"github.com/bluesky-social/indigo/atproto/syntax"
10
)
11
12
// A fake identity directory, for use in tests
13
type MockDirectory struct {
14
+
mu *sync.RWMutex
15
Handles map[syntax.Handle]syntax.DID
16
Identities map[syntax.DID]Identity
17
}
···
21
22
func NewMockDirectory() MockDirectory {
23
return MockDirectory{
24
+
mu: &sync.RWMutex{},
25
Handles: make(map[syntax.Handle]syntax.DID),
26
Identities: make(map[syntax.DID]Identity),
27
}
28
}
29
30
func (d *MockDirectory) Insert(ident Identity) {
31
+
d.mu.Lock()
32
+
defer d.mu.Unlock()
33
+
34
if !ident.Handle.IsInvalidHandle() {
35
d.Handles[ident.Handle.Normalize()] = ident.DID
36
}
···
38
}
39
40
func (d *MockDirectory) LookupHandle(ctx context.Context, h syntax.Handle) (*Identity, error) {
41
+
d.mu.RLock()
42
+
defer d.mu.RUnlock()
43
+
44
h = h.Normalize()
45
did, ok := d.Handles[h]
46
if !ok {
···
54
}
55
56
func (d *MockDirectory) LookupDID(ctx context.Context, did syntax.DID) (*Identity, error) {
57
+
d.mu.RLock()
58
+
defer d.mu.RUnlock()
59
+
60
ident, ok := d.Identities[did]
61
if !ok {
62
return nil, ErrDIDNotFound
···
65
}
66
67
func (d *MockDirectory) Lookup(ctx context.Context, a syntax.AtIdentifier) (*Identity, error) {
68
+
d.mu.RLock()
69
+
defer d.mu.RUnlock()
70
+
71
handle, err := a.AsHandle()
72
if nil == err { // if not an error, is a Handle
73
return d.LookupHandle(ctx, handle)
···
80
}
81
82
func (d *MockDirectory) ResolveHandle(ctx context.Context, h syntax.Handle) (syntax.DID, error) {
83
+
d.mu.RLock()
84
+
defer d.mu.RUnlock()
85
+
86
h = h.Normalize()
87
did, ok := d.Handles[h]
88
if !ok {
···
92
}
93
94
func (d *MockDirectory) ResolveDID(ctx context.Context, did syntax.DID) (*DIDDocument, error) {
95
+
d.mu.RLock()
96
+
defer d.mu.RUnlock()
97
+
98
ident, ok := d.Identities[did]
99
if !ok {
100
return nil, ErrDIDNotFound
···
104
}
105
106
func (d *MockDirectory) ResolveDIDRaw(ctx context.Context, did syntax.DID) (json.RawMessage, error) {
107
+
d.mu.RLock()
108
+
defer d.mu.RUnlock()
109
+
110
ident, ok := d.Identities[did]
111
if !ok {
112
return nil, ErrDIDNotFound
···
116
}
117
118
func (d *MockDirectory) Purge(ctx context.Context, a syntax.AtIdentifier) error {
119
+
d.mu.Lock()
120
+
defer d.mu.Unlock()
121
+
122
return nil
123
}
+3
-1
carstore/repo_test.go
+3
-1
carstore/repo_test.go
···
16
appbsky "github.com/bluesky-social/indigo/api/bsky"
17
"github.com/bluesky-social/indigo/repo"
18
"github.com/bluesky-social/indigo/util"
19
-
sqlbs "github.com/ipfs/go-bs-sqlite3"
20
"github.com/ipfs/go-cid"
21
flatfs "github.com/ipfs/go-ds-flatfs"
22
blockstore "github.com/ipfs/go-ipfs-blockstore"
···
452
}
453
}
454
455
func BenchmarkRepoWritesSqlite(b *testing.B) {
456
ctx := context.TODO()
457
···
489
head = nroot
490
}
491
}
492
493
func TestDuplicateBlockAcrossShards(ot *testing.T) {
494
ctx := context.TODO()
···
16
appbsky "github.com/bluesky-social/indigo/api/bsky"
17
"github.com/bluesky-social/indigo/repo"
18
"github.com/bluesky-social/indigo/util"
19
+
//sqlbs "github.com/ipfs/go-bs-sqlite3"
20
"github.com/ipfs/go-cid"
21
flatfs "github.com/ipfs/go-ds-flatfs"
22
blockstore "github.com/ipfs/go-ipfs-blockstore"
···
452
}
453
}
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.
456
func BenchmarkRepoWritesSqlite(b *testing.B) {
457
ctx := context.TODO()
458
···
490
head = nroot
491
}
492
}
493
+
*/
494
495
func TestDuplicateBlockAcrossShards(ot *testing.T) {
496
ctx := context.TODO()
-1
go.mod
-1
go.mod
···
25
github.com/hashicorp/golang-lru/v2 v2.0.7
26
github.com/icrowley/fake v0.0.0-20221112152111-d7b7e2276db2
27
github.com/ipfs/go-block-format v0.2.0
28
-
github.com/ipfs/go-bs-sqlite3 v0.0.0-20221122195556-bfcee1be620d
29
github.com/ipfs/go-cid v0.4.1
30
github.com/ipfs/go-datastore v0.6.0
31
github.com/ipfs/go-ds-flatfs v0.5.1
-2
go.sum
-2
go.sum
···
184
github.com/ipfs/go-block-format v0.2.0/go.mod h1:+jpL11nFx5A/SPpsoBn6Bzkra/zaArfSmsknbPMYgzM=
185
github.com/ipfs/go-blockservice v0.5.2 h1:in9Bc+QcXwd1apOVM7Un9t8tixPKdaHQFdLSUM1Xgk8=
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
github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s=
190
github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk=
191
github.com/ipfs/go-datastore v0.5.0/go.mod h1:9zhEApYMTl17C8YDp7JmU7sQZi2/wqiYh73hakZ90Bk=
···
184
github.com/ipfs/go-block-format v0.2.0/go.mod h1:+jpL11nFx5A/SPpsoBn6Bzkra/zaArfSmsknbPMYgzM=
185
github.com/ipfs/go-blockservice v0.5.2 h1:in9Bc+QcXwd1apOVM7Un9t8tixPKdaHQFdLSUM1Xgk8=
186
github.com/ipfs/go-blockservice v0.5.2/go.mod h1:VpMblFEqG67A/H2sHKAemeH9vlURVavlysbdUI632yk=
187
github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s=
188
github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk=
189
github.com/ipfs/go-datastore v0.5.0/go.mod h1:9zhEApYMTl17C8YDp7JmU7sQZi2/wqiYh73hakZ90Bk=