Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

relay sync1.1 #961

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1c1cc49
medsky radical trim of bigsky (relay)
brianolson Feb 12, 2025
702d73f
cleanup, add getRepo 302 redirect
brianolson Feb 21, 2025
3cdf190
more induction trace log
brianolson Feb 24, 2025
979c8ea
PR feedback and other cleanup
brianolson Feb 25, 2025
6ddbf48
note subscribeRepos message deprecation
brianolson Feb 26, 2025
664eccf
pass through #sync message
brianolson Feb 27, 2025
5553351
time-seq
brianolson Feb 28, 2025
52e19de
get echo log into same io.Writer as all other log
brianolson Feb 28, 2025
990d7b2
fix logging setup
brianolson Feb 28, 2025
72ad67b
fix RelaySetting gorm usage; TODO err rate squelch
brianolson Feb 28, 2025
dae5ceb
rename everything from 'bigsky' or 'medsky' to 'relay'
brianolson Feb 28, 2025
49c9d1c
GHA for relay
brianolson Feb 28, 2025
dbe624f
PR feedback
brianolson Mar 4, 2025
9053315
don't bounce auth key off db
brianolson Mar 4, 2025
71d35e4
handleFedEvent clean-er deprecated {handle,migrate,tombstone}
brianolson Mar 5, 2025
59f6718
a bunch of rename 'user' to 'account'
brianolson Mar 5, 2025
d445904
rename RepoManager to Validator
brianolson Mar 5, 2025
021d7cf
move validator into bgs package
brianolson Mar 5, 2025
b22b0b6
Validator is val
brianolson Mar 5, 2025
109e101
sync handler exists and checks a bunch of stuff
brianolson Mar 6, 2025
4048d23
rollback irrelevant changes
brianolson Mar 6, 2025
6ff02b6
err check, nil check
brianolson Mar 7, 2025
2018bd1
error object tweak
brianolson Mar 7, 2025
5f6a208
experimental tiny ram blockstore to see if it's better for small car …
brianolson Mar 7, 2025
59ae24f
TinyBlockstore as map
brianolson Mar 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/container-relay-aws.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: container-relay-aws
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should do a container-relay-ghcr CI action as well; we will remove the bigsky GHCR soon so it won't be a net increase in container builds

on: [push]
env:
REGISTRY: ${{ secrets.AWS_ECR_REGISTRY_USEAST2_PACKAGES_REGISTRY }}
USERNAME: ${{ secrets.AWS_ECR_REGISTRY_USEAST2_PACKAGES_USERNAME }}
PASSWORD: ${{ secrets.AWS_ECR_REGISTRY_USEAST2_PACKAGES_PASSWORD }}
# github.repository as <account>/<repo>
IMAGE_NAME: relay

jobs:
container-relay-aws:
if: github.repository == 'bluesky-social/indigo'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Docker buildx
uses: docker/setup-buildx-action@v1

- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.USERNAME }}
password: ${{ env.PASSWORD }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha,enable=true,priority=100,prefix=,suffix=,format=long

- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v4
with:
context: .
file: ./cmd/relay/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
271 changes: 271 additions & 0 deletions api/atproto/cbor_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions atproto/identity/cache_directory.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/hashicorp/golang-lru/v2/expirable"
)

// CacheDirectory is an implementation of identity.Directory with local cache of Handle and DID
type CacheDirectory struct {
Inner Directory
ErrTTL time.Duration
Expand Down
5 changes: 2 additions & 3 deletions atproto/repo/car.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ import (
"github.com/bluesky-social/indigo/atproto/repo/mst"
"github.com/bluesky-social/indigo/atproto/syntax"

"github.com/ipfs/go-datastore"
blockstore "github.com/ipfs/go-ipfs-blockstore"
"github.com/ipld/go-car"
)

func LoadFromCAR(ctx context.Context, r io.Reader) (*Commit, *Repo, error) {

bs := blockstore.NewBlockstore(datastore.NewMapDatastore())
//bs := blockstore.NewBlockstore(datastore.NewMapDatastore())
bs := NewTinyBlockstore()

cr, err := car.NewCarReader(r)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion atproto/repo/mst/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func (n *Node) writeBlocks(ctx context.Context, bs blockstore.Blockstore, onlyDi
return c, nil
}

func loadNodeFromStore(ctx context.Context, bs blockstore.Blockstore, ref cid.Cid) (*Node, error) {
func loadNodeFromStore(ctx context.Context, bs MSTBlockSource, ref cid.Cid) (*Node, error) {
block, err := bs.Get(ctx, ref)
if err != nil {
return nil, err
Expand Down
8 changes: 7 additions & 1 deletion atproto/repo/mst/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"

blocks "github.com/ipfs/go-block-format"
"github.com/ipfs/go-cid"
blockstore "github.com/ipfs/go-ipfs-blockstore"
)
Expand Down Expand Up @@ -143,7 +144,7 @@ func (t *Tree) Copy() Tree {
}
}

func LoadTreeFromStore(ctx context.Context, bs blockstore.Blockstore, root cid.Cid) (*Tree, error) {
func LoadTreeFromStore(ctx context.Context, bs MSTBlockSource, root cid.Cid) (*Tree, error) {
n, err := loadNodeFromStore(ctx, bs, root)
if err != nil {
return nil, err
Expand All @@ -154,6 +155,11 @@ func LoadTreeFromStore(ctx context.Context, bs blockstore.Blockstore, root cid.C
}, nil
}

// subset of Blockstore that we actually need
type MSTBlockSource interface {
Get(ctx context.Context, cid cid.Cid) (blocks.Block, error)
}

// Walks the tree, encodes any "dirty" nodes as CBOR data, and writes that data as blocks to the provided blockstore. Returns root CID.
func (t *Tree) WriteDiffBlocks(ctx context.Context, bs blockstore.Blockstore) (*cid.Cid, error) {
return t.Root.writeBlocks(ctx, bs, true)
Expand Down
Loading
Loading