porting all github actions from bluesky-social/indigo to tangled CI

Implement a selective cache flush interface for handle updates

Changed files
+36 -1
api
bgs
did
plc
+4
api/plc.go
··· 54 54 return &doc, nil 55 55 } 56 56 57 + func (s *PLCServer) FlushCacheFor(did string) { 58 + return 59 + } 60 + 57 61 type CreateOp struct { 58 62 Type string `json:"type" cborgen:"type"` 59 63 SigningKey string `json:"signingKey" cborgen:"signingKey"`
+2
bgs/bgs.go
··· 785 785 786 786 return nil 787 787 case env.RepoHandle != nil: 788 + // Flush any cached DID documents for this user 789 + bgs.didr.FlushCacheFor(env.RepoHandle.Did) 788 790 789 791 // TODO: ignoring the data in the message and just going out to the DID doc 790 792 act, err := bgs.createExternalUser(ctx, env.RepoHandle.Did)
+17
did/multi.go
··· 9 9 10 10 type Resolver interface { 11 11 GetDocument(ctx context.Context, didstr string) (*did.Document, error) 12 + FlushCacheFor(did string) 12 13 } 13 14 14 15 type MultiResolver struct { ··· 23 24 24 25 func (mr *MultiResolver) AddHandler(method string, res Resolver) { 25 26 mr.handlers[method] = res 27 + } 28 + 29 + func (mr *MultiResolver) FlushCacheFor(didstr string) { 30 + pdid, err := did.ParseDID(didstr) 31 + if err != nil { 32 + return 33 + } 34 + 35 + method := pdid.Protocol() 36 + 37 + res, ok := mr.handlers[method] 38 + if !ok { 39 + return 40 + } 41 + 42 + res.FlushCacheFor(didstr) 26 43 } 27 44 28 45 func (mr *MultiResolver) GetDocument(ctx context.Context, didstr string) (*did.Document, error) {
+4
did/web.go
··· 63 63 "internal": true, 64 64 } 65 65 66 + func (wr *WebResolver) FlushCacheFor(did string) { 67 + return 68 + } 69 + 66 70 func checkValidDidWeb(val string) error { 67 71 // no ports or ipv6 68 72 if strings.Contains(val, ":") {
+5 -1
plc/caching.go
··· 4 4 "context" 5 5 "time" 6 6 7 - did "github.com/bluesky-social/indigo/did" 7 + "github.com/bluesky-social/indigo/did" 8 8 lru "github.com/hashicorp/golang-lru" 9 9 "go.opentelemetry.io/otel" 10 10 "go.opentelemetry.io/otel/attribute" ··· 32 32 cache: c, 33 33 maxAge: maxAge, 34 34 } 35 + } 36 + 37 + func (r *CachingDidResolver) FlushCacheFor(didstr string) { 38 + r.cache.Remove(didstr) 35 39 } 36 40 37 41 func (r *CachingDidResolver) tryCache(did string) (*did.Document, bool) {
+4
plc/fakedid.go
··· 66 66 }, nil 67 67 } 68 68 69 + func (fd *FakeDid) FlushCacheFor(did string) { 70 + return 71 + } 72 + 69 73 func (fd *FakeDid) CreateDID(ctx context.Context, sigkey *did.PrivKey, recovery string, handle string, service string) (string, error) { 70 74 buf := make([]byte, 8) 71 75 rand.Read(buf)