Skip to content

Commit

Permalink
deps(backend): adopt sqlite package
Browse files Browse the repository at this point in the history
Instead of treating our SQLite bindings as a fork of crawshaw.io/sqlite we now adopt the package directly into our code base.
The upstream is abandoned, and we've made modifications to it beyond the point of converging the forks.

We'll be making even more changes in the face of new features introduced in Go 1.23, so it make sense to adopt the package now and start ownging it entirely.
  • Loading branch information
burdiyan committed Aug 17, 2024
1 parent df25171 commit 0f8a4af
Show file tree
Hide file tree
Showing 116 changed files with 149 additions and 272 deletions.
1 change: 0 additions & 1 deletion .plzconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ SelfUpdate = false
[parse]
BlacklistDirs = "node_modules"
BlacklistDirs = "target"
BlacklistDirs = "third_party"
BuildDefsDir = "build/rules"
BuildFileName = "BUILD.plz"
GitFunctions = true
Expand Down
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
"-",
"-plz-out",
"+backend",
"+third_party",
"+proto",
"+build"
]
Expand Down
18 changes: 10 additions & 8 deletions backend/BUILD.plz
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ subinclude("//build/rules/go:defs", "//build/rules/codegen:defs")
go_binary(
name = "seed-daemon",
srcs = glob(
["**/*.go"],
[
"**/*.go",
"**/*.c",
"**/*.h",
],
exclude = ["**/*_test.go"],
) + [
"//backend/lndhub/lndhubsql:go_library",
Expand All @@ -17,9 +21,6 @@ go_binary(
gomod = "//:gomod",
package = "./cmd/seed-daemon",
visibility = ["PUBLIC"],
deps = [
"//third_party:sqlite",
],
)

go_binary(
Expand All @@ -35,7 +36,11 @@ go_binary(
go_binary(
name = "seed-gateway",
srcs = glob(
["**/*.go"],
[
"**/*.go",
"**/*.c",
"**/*.h",
],
exclude = ["**/*_test.go"],
) + [
"//backend/lndhub/lndhubsql:go_library",
Expand All @@ -47,7 +52,4 @@ go_binary(
gomod = "//:gomod",
package = "./cmd/seed-gateway",
visibility = ["PUBLIC"],
deps = [
"//third_party:sqlite",
],
)
3 changes: 2 additions & 1 deletion backend/api/activity/v1alpha/activity.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import (
activity "seed/backend/genproto/activity/v1alpha"
"time"

"crawshaw.io/sqlite/sqlitex"
"seed/backend/util/sqlite/sqlitex"

"google.golang.org/grpc"
)

Expand Down
3 changes: 2 additions & 1 deletion backend/api/apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import (
"seed/backend/mttnet"
"seed/backend/syncing"

"crawshaw.io/sqlite/sqlitex"
"seed/backend/util/sqlite/sqlitex"

"google.golang.org/grpc"
)

Expand Down
5 changes: 3 additions & 2 deletions backend/api/documents/v3alpha/documents.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ import (
"seed/backend/util/dqb"
"seed/backend/util/errutil"

"crawshaw.io/sqlite"
"crawshaw.io/sqlite/sqlitex"
"seed/backend/util/sqlite"
"seed/backend/util/sqlite/sqlitex"

blocks "github.com/ipfs/go-block-format"
"github.com/ipfs/go-cid"
cbornode "github.com/ipfs/go-ipld-cbor"
Expand Down
5 changes: 3 additions & 2 deletions backend/api/entities/v1alpha/entities.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ import (
"google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"

"crawshaw.io/sqlite"
"crawshaw.io/sqlite/sqlitex"
"seed/backend/util/sqlite"
"seed/backend/util/sqlite/sqlitex"

"golang.org/x/exp/slices"
"google.golang.org/grpc"
)
Expand Down
4 changes: 2 additions & 2 deletions backend/api/groups/v1alpha/db.go.off
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"seed/backend/pkg/errutil"
"time"

"crawshaw.io/sqlite"
"crawshaw.io/sqlite/sqlitex"
"seed/backend/util/sqlite"
"seed/backend/util/sqlite/sqlitex"
"github.com/ipfs/go-cid"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand Down
4 changes: 2 additions & 2 deletions backend/api/groups/v1alpha/groups.go.off
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import (
"sync"
"time"

"crawshaw.io/sqlite"
"crawshaw.io/sqlite/sqlitex"
"seed/backend/util/sqlite"
"seed/backend/util/sqlite/sqlitex"
"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/multiformats/go-multiaddr"
Expand Down
4 changes: 2 additions & 2 deletions backend/api/networking/v1alpha/networking.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"seed/backend/util/dqb"
"strings"

"crawshaw.io/sqlite"
"crawshaw.io/sqlite/sqlitex"
"seed/backend/util/sqlite"
"seed/backend/util/sqlite/sqlitex"

"github.com/libp2p/go-libp2p/core/peer"
"google.golang.org/grpc"
Expand Down
1 change: 0 additions & 1 deletion backend/cmd/monitord/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
FROM golang:1.23.0-alpine AS builder
WORKDIR /code
COPY go.mod go.sum ./
COPY third_party ./third_party
RUN go mod download
COPY backend ./backend
RUN apk add build-base
Expand Down
1 change: 0 additions & 1 deletion backend/cmd/relayd/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
FROM golang:1.23.0-alpine AS builder
WORKDIR /code
COPY go.mod go.sum ./
COPY third_party ./third_party
RUN go mod download
COPY backend ./backend
RUN go install ./backend/cmd/relayd/
Expand Down
1 change: 0 additions & 1 deletion backend/cmd/seed-daemon/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ ARG COMMIT_HASH
ARG BRANCH
ARG DATE
COPY go.mod go.sum ./
COPY third_party ./third_party
RUN go mod download
COPY backend ./backend
COPY monitoring ./monitoring
Expand Down
1 change: 0 additions & 1 deletion backend/cmd/seed-site/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ ARG COMMIT_HASH
ARG BRANCH
ARG DATE
COPY go.mod go.sum ./
COPY third_party ./third_party
RUN go mod download
COPY backend ./backend
COPY monitoring ./monitoring
Expand Down
2 changes: 1 addition & 1 deletion backend/cmd/seed-site/sites/daemon.go.off
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"seed/backend/pkg/future"
"seed/backend/pkg/libp2px"

"crawshaw.io/sqlite/sqlitex"
"seed/backend/util/sqlite/sqlitex"
"github.com/multiformats/go-multiaddr"
"google.golang.org/grpc"
)
Expand Down
4 changes: 2 additions & 2 deletions backend/cmd/seed-site/sites/sites.go.off
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
rpcpeer "google.golang.org/grpc/peer"
"google.golang.org/grpc/status"

"crawshaw.io/sqlite"
"crawshaw.io/sqlite/sqlitex"
"seed/backend/util/sqlite"
"seed/backend/util/sqlite/sqlitex"
"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/multiformats/go-multiaddr"
Expand Down
3 changes: 2 additions & 1 deletion backend/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import (
"seed/backend/util/future"
"seed/backend/wallet"

"crawshaw.io/sqlite/sqlitex"
"seed/backend/util/sqlite/sqlitex"

"github.com/ipfs/boxo/exchange"
"github.com/ipfs/boxo/exchange/offline"
"go.opentelemetry.io/otel"
Expand Down
3 changes: 2 additions & 1 deletion backend/daemon/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ package daemon
import (
"runtime"

"crawshaw.io/sqlite"
"seed/backend/util/sqlite"

"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/collectors"
"github.com/prometheus/client_golang/prometheus/promauto"
Expand Down
5 changes: 3 additions & 2 deletions backend/index/blockstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import (
"seed/backend/ipfs"
"seed/backend/util/dqb"

"crawshaw.io/sqlite"
"crawshaw.io/sqlite/sqlitex"
"seed/backend/util/sqlite"
"seed/backend/util/sqlite/sqlitex"

blockstore "github.com/ipfs/boxo/blockstore"
blocks "github.com/ipfs/go-block-format"
"github.com/ipfs/go-cid"
Expand Down
3 changes: 2 additions & 1 deletion backend/index/blockstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import (
"seed/backend/util/must"
"testing"

"crawshaw.io/sqlite/sqlitex"
"seed/backend/util/sqlite/sqlitex"

blocks "github.com/ipfs/go-block-format"
"github.com/ipfs/go-cid"
cbornode "github.com/ipfs/go-ipld-cbor"
Expand Down
5 changes: 3 additions & 2 deletions backend/index/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ import (
"strings"
"time"

"crawshaw.io/sqlite"
"crawshaw.io/sqlite/sqlitex"
"seed/backend/util/sqlite"
"seed/backend/util/sqlite/sqlitex"

blockstore "github.com/ipfs/boxo/blockstore"
"github.com/ipfs/boxo/provider"
"github.com/ipfs/go-cid"
Expand Down
3 changes: 2 additions & 1 deletion backend/index/index_blockstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import (
"context"
"seed/backend/ipfs"

"crawshaw.io/sqlite/sqlitex"
"seed/backend/util/sqlite/sqlitex"

blocks "github.com/ipfs/go-block-format"
"github.com/ipfs/go-cid"
"github.com/multiformats/go-multicodec"
Expand Down
4 changes: 2 additions & 2 deletions backend/index/index_sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"seed/backend/util/maybe"
"seed/backend/util/sqlitegen"

"crawshaw.io/sqlite"
"crawshaw.io/sqlite/sqlitex"
"seed/backend/util/sqlite"
"seed/backend/util/sqlite/sqlitex"
)

// dbStructuralBlobsInsert inserts a structural blob.
Expand Down
5 changes: 3 additions & 2 deletions backend/index/reindex.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
"slices"
"time"

"crawshaw.io/sqlite"
"crawshaw.io/sqlite/sqlitex"
"seed/backend/util/sqlite"
"seed/backend/util/sqlite/sqlitex"

"github.com/ipfs/go-cid"
"github.com/multiformats/go-multicodec"
"go.uber.org/zap"
Expand Down
4 changes: 2 additions & 2 deletions backend/lndhub/lndhub.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ import (
"time"
"unicode"

"crawshaw.io/sqlite"
"crawshaw.io/sqlite/sqlitex"
"github.com/btcsuite/btcd/chaincfg"
"github.com/lightningnetwork/lnd/zpay32"
"github.com/mitchellh/mapstructure"
"seed/backend/util/sqlite"
"seed/backend/util/sqlite/sqlitex"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions backend/lndhub/lndhub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import (
"testing"
"time"

"crawshaw.io/sqlite"
"crawshaw.io/sqlite/sqlitex"
"github.com/btcsuite/btcd/btcutil"
"github.com/stretchr/testify/require"
"seed/backend/util/sqlite"
"seed/backend/util/sqlite/sqlitex"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion backend/lndhub/lndhubsql/lndhub.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"errors"
"fmt"

"crawshaw.io/sqlite"
"seed/backend/util/sqlite"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion backend/lndhub/lndhubsql/queries.gen.go

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

4 changes: 2 additions & 2 deletions backend/mttnet/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (

"time"

"crawshaw.io/sqlite"
"crawshaw.io/sqlite/sqlitex"
"seed/backend/util/sqlite"
"seed/backend/util/sqlite/sqlitex"

"github.com/libp2p/go-libp2p/core/event"
"github.com/libp2p/go-libp2p/core/network"
Expand Down
3 changes: 2 additions & 1 deletion backend/mttnet/last_seen.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import (
"math/rand"
"time"

"crawshaw.io/sqlite/sqlitex"
"seed/backend/util/sqlite/sqlitex"

"github.com/libp2p/go-libp2p/core/host"
)

Expand Down
5 changes: 3 additions & 2 deletions backend/mttnet/list_blobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
p2p "seed/backend/genproto/p2p/v1alpha"
"seed/backend/util/dqb"

"crawshaw.io/sqlite"
"crawshaw.io/sqlite/sqlitex"
"seed/backend/util/sqlite"
"seed/backend/util/sqlite/sqlitex"

"github.com/ipfs/go-cid"
"go.uber.org/zap"
)
Expand Down
5 changes: 3 additions & 2 deletions backend/mttnet/list_peers.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import (
"seed/backend/util/dqb"
"strings"

"crawshaw.io/sqlite"
"crawshaw.io/sqlite/sqlitex"
"seed/backend/util/sqlite"
"seed/backend/util/sqlite/sqlitex"

"github.com/libp2p/go-libp2p/core/peer"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand Down
3 changes: 2 additions & 1 deletion backend/mttnet/mttnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import (
"seed/backend/util/must"
"time"

"crawshaw.io/sqlite/sqlitex"
"seed/backend/util/sqlite/sqlitex"

provider "github.com/ipfs/boxo/provider"
"github.com/ipfs/go-datastore"
dssync "github.com/ipfs/go-datastore/sync"
Expand Down
5 changes: 3 additions & 2 deletions backend/mttnet/providing.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import (
"seed/backend/util/dqb"
"time"

"crawshaw.io/sqlite"
"crawshaw.io/sqlite/sqlitex"
"seed/backend/util/sqlite"
"seed/backend/util/sqlite/sqlitex"

"github.com/ipfs/boxo/provider"
"github.com/ipfs/go-cid"
"github.com/multiformats/go-multicodec"
Expand Down
5 changes: 3 additions & 2 deletions backend/mttnet/syncing.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
"seed/backend/syncing/rbsr"
"seed/backend/util/dqb"

"crawshaw.io/sqlite"
"crawshaw.io/sqlite/sqlitex"
"seed/backend/util/sqlite"
"seed/backend/util/sqlite/sqlitex"

"github.com/ipfs/go-cid"
)

Expand Down
Loading

0 comments on commit 0f8a4af

Please sign in to comment.