Skip to content

Commit 42eb6eb

Browse files
authored
Merge pull request #148 from D4ryl00/chore/update-kubo-0.27.0
chore: update go version + kubo + libp2p + go-ipfs-log
2 parents 0dc725a + c36f389 commit 42eb6eb

File tree

27 files changed

+533
-1196
lines changed

27 files changed

+533
-1196
lines changed

.github/workflows/go.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
matrix:
1616
golang:
17-
- '1.19.x'
17+
- "1.21.x"
1818
steps:
1919
- name: Checkout
2020
uses: actions/checkout@v3
@@ -40,8 +40,8 @@ jobs:
4040
strategy:
4141
matrix:
4242
golang:
43-
- '1.19.x'
44-
- '1.20.x'
43+
- "1.21.x"
44+
- "1.22.x"
4545
env:
4646
OS: ubuntu-latest
4747
GOLANG: ${{ matrix.golang }}
@@ -89,8 +89,8 @@ jobs:
8989
strategy:
9090
matrix:
9191
golang:
92-
- '1.19.x'
93-
- '1.20.x'
92+
- "1.21.x"
93+
- "1.22.x"
9494
env:
9595
OS: macos-latest
9696
GOLANG: ${{ matrix.golang }}

.tool-versions

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
golang 1.19.7
2-
golangci-lint 1.50.1
1+
golang 1.21.8
2+
golangci-lint 1.57.2

accesscontroller/ipfs/accesscontroller_ipfs.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"berty.tech/go-orbit-db/iface"
1515
cid "github.com/ipfs/go-cid"
1616
cbornode "github.com/ipfs/go-ipld-cbor"
17-
coreapi "github.com/ipfs/interface-go-ipfs-core"
17+
coreiface "github.com/ipfs/kubo/core/coreiface"
1818
"github.com/polydawn/refmt/obj/atlas"
1919
"go.uber.org/zap"
2020
)
@@ -24,7 +24,7 @@ type cborWriteAccess struct {
2424
}
2525

2626
type ipfsAccessController struct {
27-
ipfs coreapi.CoreAPI
27+
ipfs coreiface.CoreAPI
2828
writeAccess []string
2929
muWriteAccess sync.RWMutex
3030
logger *zap.Logger
@@ -38,7 +38,7 @@ func (i *ipfsAccessController) Address() address.Address {
3838
return nil
3939
}
4040

41-
func (i *ipfsAccessController) CanAppend(entry logac.LogEntry, p identityprovider.Interface, additionalContext accesscontroller.CanAppendAdditionalContext) error {
41+
func (i *ipfsAccessController) CanAppend(entry logac.LogEntry, p identityprovider.Interface, _ accesscontroller.CanAppendAdditionalContext) error {
4242
i.muWriteAccess.RLock()
4343
defer i.muWriteAccess.RUnlock()
4444

@@ -63,11 +63,11 @@ func (i *ipfsAccessController) GetAuthorizedByRole(role string) ([]string, error
6363
return nil, nil
6464
}
6565

66-
func (i *ipfsAccessController) Grant(ctx context.Context, capability string, keyID string) error {
66+
func (i *ipfsAccessController) Grant(ctx context.Context, capability string, keyID string) error { //nolint:all
6767
return fmt.Errorf("not implemented - does not exist in JS version")
6868
}
6969

70-
func (i *ipfsAccessController) Revoke(ctx context.Context, capability string, keyID string) error {
70+
func (i *ipfsAccessController) Revoke(ctx context.Context, capability string, keyID string) error { //nolint:all
7171
return fmt.Errorf("not implemented - does not exist in JS version")
7272
}
7373

accesscontroller/manifest.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"berty.tech/go-ipfs-log/io"
1010
cid "github.com/ipfs/go-cid"
1111
cbornode "github.com/ipfs/go-ipld-cbor"
12-
coreapi "github.com/ipfs/interface-go-ipfs-core"
12+
coreiface "github.com/ipfs/kubo/core/coreiface"
1313
"github.com/polydawn/refmt/obj/atlas"
1414
"go.uber.org/zap"
1515
)
@@ -140,7 +140,7 @@ type ManifestParams interface {
140140
}
141141

142142
// CreateManifest Creates a new manifest and returns its CID
143-
func CreateManifest(ctx context.Context, ipfs coreapi.CoreAPI, controllerType string, params ManifestParams) (cid.Cid, error) {
143+
func CreateManifest(ctx context.Context, ipfs coreiface.CoreAPI, controllerType string, params ManifestParams) (cid.Cid, error) {
144144
if params.GetSkipManifest() {
145145
return params.GetAddress(), nil
146146
}
@@ -157,7 +157,7 @@ func CreateManifest(ctx context.Context, ipfs coreapi.CoreAPI, controllerType st
157157
}
158158

159159
// ResolveManifest Retrieves a manifest from its address
160-
func ResolveManifest(ctx context.Context, ipfs coreapi.CoreAPI, manifestAddress string, params ManifestParams) (*Manifest, error) {
160+
func ResolveManifest(ctx context.Context, ipfs coreiface.CoreAPI, manifestAddress string, params ManifestParams) (*Manifest, error) {
161161
if params.GetSkipManifest() {
162162
if params.GetType() == "" {
163163
return nil, fmt.Errorf("no manifest, access-controller type required")

accesscontroller/orbitdb/accesscontroller_orbitdb.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func (o *orbitDBAccessController) getAuthorizations() (map[string][]string, erro
112112
return authorizationsLists, nil
113113
}
114114

115-
func (o *orbitDBAccessController) CanAppend(entry logac.LogEntry, p identityprovider.Interface, additionalContext accesscontroller.CanAppendAdditionalContext) error {
115+
func (o *orbitDBAccessController) CanAppend(entry logac.LogEntry, p identityprovider.Interface, _ accesscontroller.CanAppendAdditionalContext) error {
116116
writeAccess, err := o.GetAuthorizedByRole("write")
117117
if err != nil {
118118
return fmt.Errorf("unable to get keys with write access: %w", err)
@@ -249,7 +249,7 @@ func (o *orbitDBAccessController) Load(ctx context.Context, address string) erro
249249
return nil
250250
}
251251

252-
func (o *orbitDBAccessController) Save(ctx context.Context) (accesscontroller.ManifestParams, error) {
252+
func (o *orbitDBAccessController) Save(_ context.Context) (accesscontroller.ManifestParams, error) {
253253
return accesscontroller.NewManifestParams(o.kvStore.Address().GetRoot(), false, "orbitdb"), nil
254254
}
255255

@@ -261,7 +261,7 @@ func (o *orbitDBAccessController) Close() error {
261261
return nil
262262
}
263263

264-
func (o *orbitDBAccessController) onUpdate(ctx context.Context) {
264+
func (o *orbitDBAccessController) onUpdate(_ context.Context) {
265265
if err := o.emitterEvtUpdated.Emit(&EventUpdated{}); err != nil {
266266
o.logger.Warn("unable to emit event updated", zap.Error(err))
267267
}

accesscontroller/simple/accesscontroller_simple.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,19 @@ func (o *simpleAccessController) Address() address.Address {
3838
return nil
3939
}
4040

41-
func (o *simpleAccessController) Grant(ctx context.Context, capability string, keyID string) error {
41+
func (o *simpleAccessController) Grant(ctx context.Context, capability string, keyID string) error { //nolint:all
4242
return nil
4343
}
4444

45-
func (o *simpleAccessController) Revoke(ctx context.Context, capability string, keyID string) error {
45+
func (o *simpleAccessController) Revoke(ctx context.Context, capability string, keyID string) error { //nolint:all
4646
return nil
4747
}
4848

49-
func (o *simpleAccessController) Load(ctx context.Context, address string) error {
49+
func (o *simpleAccessController) Load(ctx context.Context, address string) error { //nolint:all
5050
return nil
5151
}
5252

53-
func (o *simpleAccessController) Save(ctx context.Context) (accesscontroller.ManifestParams, error) {
53+
func (o *simpleAccessController) Save(_ context.Context) (accesscontroller.ManifestParams, error) {
5454
return accesscontroller.NewManifestParams(cid.Cid{}, true, "simple"), nil
5555
}
5656

@@ -66,7 +66,7 @@ func (o *simpleAccessController) GetAuthorizedByRole(role string) ([]string, err
6666
return o.allowedKeys[role], nil
6767
}
6868

69-
func (o *simpleAccessController) CanAppend(e logac.LogEntry, p identityprovider.Interface, additionalContext accesscontroller.CanAppendAdditionalContext) error {
69+
func (o *simpleAccessController) CanAppend(e logac.LogEntry, _ identityprovider.Interface, _ accesscontroller.CanAppendAdditionalContext) error {
7070
for _, id := range o.allowedKeys["write"] {
7171
if e.GetIdentity().ID == id || id == "*" {
7272
return nil

baseorbitdb/orbitdb.go

+10-9
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@ import (
2626
datastore "github.com/ipfs/go-datastore"
2727
leveldb "github.com/ipfs/go-ds-leveldb"
2828
cbornode "github.com/ipfs/go-ipld-cbor"
29-
coreapi "github.com/ipfs/interface-go-ipfs-core"
29+
coreiface "github.com/ipfs/kubo/core/coreiface"
3030
"github.com/libp2p/go-libp2p/core/event"
3131
peer "github.com/libp2p/go-libp2p/core/peer"
3232
"github.com/libp2p/go-libp2p/p2p/host/eventbus"
3333
"go.opentelemetry.io/otel/trace"
34+
tracenoop "go.opentelemetry.io/otel/trace/noop"
3435
"go.uber.org/zap"
3536
)
3637

@@ -98,7 +99,7 @@ type orbitDB struct {
9899
cancel context.CancelFunc
99100
storeTypes map[string]iface.StoreConstructor
100101
accessControllerTypes map[string]iface.AccessControllerConstructor
101-
ipfs coreapi.CoreAPI
102+
ipfs coreiface.CoreAPI
102103
identity *idp.Identity
103104
id peer.ID
104105
pubsub iface.PubSubInterface
@@ -136,7 +137,7 @@ func (o *orbitDB) Tracer() trace.Tracer {
136137
return o.tracer
137138
}
138139

139-
func (o *orbitDB) IPFS() coreapi.CoreAPI {
140+
func (o *orbitDB) IPFS() coreiface.CoreAPI {
140141
o.muIPFS.RLock()
141142
defer o.muIPFS.RUnlock()
142143

@@ -316,7 +317,7 @@ func (o *orbitDB) getStoreConstructor(s string) (iface.StoreConstructor, bool) {
316317
return constructor, ok
317318
}
318319

319-
func newOrbitDB(ctx context.Context, is coreapi.CoreAPI, identity *idp.Identity, options *NewOrbitDBOptions) (BaseOrbitDB, error) {
320+
func newOrbitDB(ctx context.Context, is coreiface.CoreAPI, identity *idp.Identity, options *NewOrbitDBOptions) (BaseOrbitDB, error) {
320321
if is == nil {
321322
return nil, fmt.Errorf("ipfs is a required argument")
322323
}
@@ -334,7 +335,7 @@ func newOrbitDB(ctx context.Context, is coreapi.CoreAPI, identity *idp.Identity,
334335
}
335336

336337
if options.Tracer == nil {
337-
options.Tracer = trace.NewNoopTracerProvider().Tracer("")
338+
options.Tracer = tracenoop.NewTracerProvider().Tracer("")
338339
}
339340

340341
if options.EventBus == nil {
@@ -408,7 +409,7 @@ func newOrbitDB(ctx context.Context, is coreapi.CoreAPI, identity *idp.Identity,
408409
}
409410

410411
// NewOrbitDB Creates a new OrbitDB instance
411-
func NewOrbitDB(ctx context.Context, ipfs coreapi.CoreAPI, options *NewOrbitDBOptions) (BaseOrbitDB, error) {
412+
func NewOrbitDB(ctx context.Context, ipfs coreiface.CoreAPI, options *NewOrbitDBOptions) (BaseOrbitDB, error) {
412413
if ipfs == nil {
413414
return nil, fmt.Errorf("ipfs is a required argument")
414415
}
@@ -571,10 +572,10 @@ func (o *orbitDB) Open(ctx context.Context, dbAddress string, options *CreateDBO
571572
return nil, fmt.Errorf("'options.Create' set to 'false'. If you want to create a database, set 'options.Create' to 'true'")
572573
} else if *options.Create && (options.StoreType == nil || *options.StoreType == "") {
573574
return nil, fmt.Errorf("database type not provided! Provide a type with 'options.StoreType' (%s)", strings.Join(o.storeTypesNames(), "|"))
574-
} else {
575-
options.Overwrite = boolPtr(true)
576-
return o.Create(ctx, dbAddress, *options.StoreType, options)
577575
}
576+
577+
options.Overwrite = boolPtr(true)
578+
return o.Create(ctx, dbAddress, *options.StoreType, options)
578579
}
579580

580581
parsedDBAddress, err := address.Parse(dbAddress)

events/events.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ type eventBox struct {
4646

4747
// Deprecated: use event bus directly
4848
// Emit Sends an event to the subscribed listeners
49-
func (e *EventEmitter) Emit(ctx context.Context, evt Event) {
49+
func (e *EventEmitter) Emit(_ context.Context, evt Event) {
5050
e.muEmitters.Lock()
5151

5252
bus := e.getBus()

0 commit comments

Comments
 (0)