Skip to content

Commit

Permalink
Merge pull request #148 from D4ryl00/chore/update-kubo-0.27.0
Browse files Browse the repository at this point in the history
chore: update go version + kubo + libp2p + go-ipfs-log
  • Loading branch information
D4ryl00 authored Apr 19, 2024
2 parents 0dc725a + c36f389 commit 42eb6eb
Show file tree
Hide file tree
Showing 27 changed files with 533 additions and 1,196 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
golang:
- '1.19.x'
- "1.21.x"
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -40,8 +40,8 @@ jobs:
strategy:
matrix:
golang:
- '1.19.x'
- '1.20.x'
- "1.21.x"
- "1.22.x"
env:
OS: ubuntu-latest
GOLANG: ${{ matrix.golang }}
Expand Down Expand Up @@ -89,8 +89,8 @@ jobs:
strategy:
matrix:
golang:
- '1.19.x'
- '1.20.x'
- "1.21.x"
- "1.22.x"
env:
OS: macos-latest
GOLANG: ${{ matrix.golang }}
Expand Down
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
golang 1.19.7
golangci-lint 1.50.1
golang 1.21.8
golangci-lint 1.57.2
10 changes: 5 additions & 5 deletions accesscontroller/ipfs/accesscontroller_ipfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"berty.tech/go-orbit-db/iface"
cid "github.com/ipfs/go-cid"
cbornode "github.com/ipfs/go-ipld-cbor"
coreapi "github.com/ipfs/interface-go-ipfs-core"
coreiface "github.com/ipfs/kubo/core/coreiface"
"github.com/polydawn/refmt/obj/atlas"
"go.uber.org/zap"
)
Expand All @@ -24,7 +24,7 @@ type cborWriteAccess struct {
}

type ipfsAccessController struct {
ipfs coreapi.CoreAPI
ipfs coreiface.CoreAPI
writeAccess []string
muWriteAccess sync.RWMutex
logger *zap.Logger
Expand All @@ -38,7 +38,7 @@ func (i *ipfsAccessController) Address() address.Address {
return nil
}

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

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

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

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

Expand Down
6 changes: 3 additions & 3 deletions accesscontroller/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"berty.tech/go-ipfs-log/io"
cid "github.com/ipfs/go-cid"
cbornode "github.com/ipfs/go-ipld-cbor"
coreapi "github.com/ipfs/interface-go-ipfs-core"
coreiface "github.com/ipfs/kubo/core/coreiface"
"github.com/polydawn/refmt/obj/atlas"
"go.uber.org/zap"
)
Expand Down Expand Up @@ -140,7 +140,7 @@ type ManifestParams interface {
}

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

// ResolveManifest Retrieves a manifest from its address
func ResolveManifest(ctx context.Context, ipfs coreapi.CoreAPI, manifestAddress string, params ManifestParams) (*Manifest, error) {
func ResolveManifest(ctx context.Context, ipfs coreiface.CoreAPI, manifestAddress string, params ManifestParams) (*Manifest, error) {
if params.GetSkipManifest() {
if params.GetType() == "" {
return nil, fmt.Errorf("no manifest, access-controller type required")
Expand Down
6 changes: 3 additions & 3 deletions accesscontroller/orbitdb/accesscontroller_orbitdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (o *orbitDBAccessController) getAuthorizations() (map[string][]string, erro
return authorizationsLists, nil
}

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

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

Expand All @@ -261,7 +261,7 @@ func (o *orbitDBAccessController) Close() error {
return nil
}

func (o *orbitDBAccessController) onUpdate(ctx context.Context) {
func (o *orbitDBAccessController) onUpdate(_ context.Context) {
if err := o.emitterEvtUpdated.Emit(&EventUpdated{}); err != nil {
o.logger.Warn("unable to emit event updated", zap.Error(err))
}
Expand Down
10 changes: 5 additions & 5 deletions accesscontroller/simple/accesscontroller_simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@ func (o *simpleAccessController) Address() address.Address {
return nil
}

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

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

func (o *simpleAccessController) Load(ctx context.Context, address string) error {
func (o *simpleAccessController) Load(ctx context.Context, address string) error { //nolint:all
return nil
}

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

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

func (o *simpleAccessController) CanAppend(e logac.LogEntry, p identityprovider.Interface, additionalContext accesscontroller.CanAppendAdditionalContext) error {
func (o *simpleAccessController) CanAppend(e logac.LogEntry, _ identityprovider.Interface, _ accesscontroller.CanAppendAdditionalContext) error {
for _, id := range o.allowedKeys["write"] {
if e.GetIdentity().ID == id || id == "*" {
return nil
Expand Down
19 changes: 10 additions & 9 deletions baseorbitdb/orbitdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ import (
datastore "github.com/ipfs/go-datastore"
leveldb "github.com/ipfs/go-ds-leveldb"
cbornode "github.com/ipfs/go-ipld-cbor"
coreapi "github.com/ipfs/interface-go-ipfs-core"
coreiface "github.com/ipfs/kubo/core/coreiface"
"github.com/libp2p/go-libp2p/core/event"
peer "github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/p2p/host/eventbus"
"go.opentelemetry.io/otel/trace"
tracenoop "go.opentelemetry.io/otel/trace/noop"
"go.uber.org/zap"
)

Expand Down Expand Up @@ -98,7 +99,7 @@ type orbitDB struct {
cancel context.CancelFunc
storeTypes map[string]iface.StoreConstructor
accessControllerTypes map[string]iface.AccessControllerConstructor
ipfs coreapi.CoreAPI
ipfs coreiface.CoreAPI
identity *idp.Identity
id peer.ID
pubsub iface.PubSubInterface
Expand Down Expand Up @@ -136,7 +137,7 @@ func (o *orbitDB) Tracer() trace.Tracer {
return o.tracer
}

func (o *orbitDB) IPFS() coreapi.CoreAPI {
func (o *orbitDB) IPFS() coreiface.CoreAPI {
o.muIPFS.RLock()
defer o.muIPFS.RUnlock()

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

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

if options.Tracer == nil {
options.Tracer = trace.NewNoopTracerProvider().Tracer("")
options.Tracer = tracenoop.NewTracerProvider().Tracer("")
}

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

// NewOrbitDB Creates a new OrbitDB instance
func NewOrbitDB(ctx context.Context, ipfs coreapi.CoreAPI, options *NewOrbitDBOptions) (BaseOrbitDB, error) {
func NewOrbitDB(ctx context.Context, ipfs coreiface.CoreAPI, options *NewOrbitDBOptions) (BaseOrbitDB, error) {
if ipfs == nil {
return nil, fmt.Errorf("ipfs is a required argument")
}
Expand Down Expand Up @@ -571,10 +572,10 @@ func (o *orbitDB) Open(ctx context.Context, dbAddress string, options *CreateDBO
return nil, fmt.Errorf("'options.Create' set to 'false'. If you want to create a database, set 'options.Create' to 'true'")
} else if *options.Create && (options.StoreType == nil || *options.StoreType == "") {
return nil, fmt.Errorf("database type not provided! Provide a type with 'options.StoreType' (%s)", strings.Join(o.storeTypesNames(), "|"))
} else {
options.Overwrite = boolPtr(true)
return o.Create(ctx, dbAddress, *options.StoreType, options)
}

options.Overwrite = boolPtr(true)
return o.Create(ctx, dbAddress, *options.StoreType, options)
}

parsedDBAddress, err := address.Parse(dbAddress)
Expand Down
2 changes: 1 addition & 1 deletion events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type eventBox struct {

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

bus := e.getBus()
Expand Down
Loading

0 comments on commit 42eb6eb

Please sign in to comment.