Skip to content

Commit

Permalink
Merge pull request #110 from D4ryl00/chore/update-ipfs
Browse files Browse the repository at this point in the history
chore: update kubo to 0.27.0
  • Loading branch information
D4ryl00 authored Apr 5, 2024
2 parents f638d42 + 27f4e0a commit be4faf7
Show file tree
Hide file tree
Showing 20 changed files with 948 additions and 2,306 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ jobs:
strategy:
matrix:
golang:
- '1.19.x'
- "1.21.x"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.golang }}
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3.3.0
uses: golangci/golangci-lint-action@v4
with:
go-version: ${{ matrix.golang }}
version: v1.50.1
version: v1.54
args: --timeout=10m
# only-new-issues: true

Expand All @@ -34,8 +34,8 @@ jobs:
strategy:
matrix:
golang:
- '1.19'
- '1.20'
- "1.21"
- "1.22"
env:
OS: ubuntu-latest
GOLANG: ${{ matrix.golang }}
Expand Down Expand Up @@ -80,8 +80,8 @@ jobs:
strategy:
matrix:
golang:
- '1.19'
- '1.20'
- "1.21"
- "1.22"
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.54.2
14 changes: 7 additions & 7 deletions entry/entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"sort"

"github.com/ipfs/go-cid"
core_iface "github.com/ipfs/interface-go-ipfs-core"
coreiface "github.com/ipfs/kubo/core/coreiface"
"github.com/multiformats/go-multibase"

"berty.tech/go-ipfs-log/errmsg"
Expand Down Expand Up @@ -134,7 +134,7 @@ func (e *Entry) SetAdditionalDataValue(key string, value string) {
e.AdditionalData[key] = value
}

func CreateEntry(ctx context.Context, ipfsInstance core_iface.CoreAPI, identity *identityprovider.Identity, data *Entry, opts *iface.CreateEntryOptions) (iface.IPFSLogEntry, error) {
func CreateEntry(ctx context.Context, ipfsInstance coreiface.CoreAPI, identity *identityprovider.Identity, data *Entry, opts *iface.CreateEntryOptions) (iface.IPFSLogEntry, error) {
io, err := cbor.IO(&Entry{}, &LamportClock{})
if err != nil {
return nil, err
Expand All @@ -144,7 +144,7 @@ func CreateEntry(ctx context.Context, ipfsInstance core_iface.CoreAPI, identity
}

// CreateEntryWithIO creates an Entry.
func CreateEntryWithIO(ctx context.Context, ipfsInstance core_iface.CoreAPI, identity *identityprovider.Identity, data iface.IPFSLogEntry, opts *iface.CreateEntryOptions, io iface.IO) (iface.IPFSLogEntry, error) {
func CreateEntryWithIO(ctx context.Context, ipfsInstance coreiface.CoreAPI, identity *identityprovider.Identity, data iface.IPFSLogEntry, opts *iface.CreateEntryOptions, io iface.IO) (iface.IPFSLogEntry, error) {
if ipfsInstance == nil {
return nil, errmsg.ErrIPFSNotDefined
}
Expand Down Expand Up @@ -394,7 +394,7 @@ func (e *Entry) Verify(identity identityprovider.Interface, io iface.IO) error {
}

// ToMultihash gets the multihash of an Entry.
func (e *Entry) ToMultihash(ctx context.Context, ipfsInstance core_iface.CoreAPI, opts *iface.CreateEntryOptions) (cid.Cid, error) {
func (e *Entry) ToMultihash(ctx context.Context, ipfsInstance coreiface.CoreAPI, opts *iface.CreateEntryOptions) (cid.Cid, error) {
io, err := cbor.IO(&Entry{}, &LamportClock{})
if err != nil {
return cid.Undef, err
Expand All @@ -404,7 +404,7 @@ func (e *Entry) ToMultihash(ctx context.Context, ipfsInstance core_iface.CoreAPI
}

// ToMultihashWithIO gets the multihash of an Entry.
func ToMultihashWithIO(ctx context.Context, e iface.IPFSLogEntry, ipfsInstance core_iface.CoreAPI, opts *iface.CreateEntryOptions, io iface.IO) (cid.Cid, error) {
func ToMultihashWithIO(ctx context.Context, e iface.IPFSLogEntry, ipfsInstance coreiface.CoreAPI, opts *iface.CreateEntryOptions, io iface.IO) (cid.Cid, error) {
if opts == nil {
opts = &iface.CreateEntryOptions{}
}
Expand Down Expand Up @@ -468,7 +468,7 @@ func Normalize(e iface.IPFSLogEntry, opts *normalizeEntryOpts) *Entry {
}

// FromMultihash creates an Entry from a hash.
func FromMultihash(ctx context.Context, ipfs core_iface.CoreAPI, hash cid.Cid, provider identityprovider.Interface) (iface.IPFSLogEntry, error) {
func FromMultihash(ctx context.Context, ipfs coreiface.CoreAPI, hash cid.Cid, provider identityprovider.Interface) (iface.IPFSLogEntry, error) {
io, err := cbor.IO(&Entry{}, &LamportClock{})
if err != nil {
return nil, err
Expand All @@ -478,7 +478,7 @@ func FromMultihash(ctx context.Context, ipfs core_iface.CoreAPI, hash cid.Cid, p
}

// FromMultihashWithIO creates an Entry from a hash.
func FromMultihashWithIO(ctx context.Context, ipfs core_iface.CoreAPI, hash cid.Cid, provider identityprovider.Interface, io iface.IO) (iface.IPFSLogEntry, error) {
func FromMultihashWithIO(ctx context.Context, ipfs coreiface.CoreAPI, hash cid.Cid, provider identityprovider.Interface, io iface.IO) (iface.IPFSLogEntry, error) {
if ipfs == nil {
return nil, errmsg.ErrIPFSNotDefined
}
Expand Down
6 changes: 3 additions & 3 deletions entry/entry_io.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"

"github.com/ipfs/go-cid"
core_iface "github.com/ipfs/interface-go-ipfs-core"
coreiface "github.com/ipfs/kubo/core/coreiface"

"berty.tech/go-ipfs-log/iface"
)
Expand All @@ -13,13 +13,13 @@ type FetchOptions = iface.FetchOptions

// FetchParallel has the same comportement than FetchAll, we keep it for retrop
// compatibility purpose
func FetchParallel(ctx context.Context, ipfs core_iface.CoreAPI, hashes []cid.Cid, options *FetchOptions) []iface.IPFSLogEntry {
func FetchParallel(ctx context.Context, ipfs coreiface.CoreAPI, hashes []cid.Cid, options *FetchOptions) []iface.IPFSLogEntry {
fetcher := NewFetcher(ipfs, options)
return fetcher.Fetch(ctx, hashes)
}

// FetchAll gets entries from their CIDs.
func FetchAll(ctx context.Context, ipfs core_iface.CoreAPI, hashes []cid.Cid, options *FetchOptions) []iface.IPFSLogEntry {
func FetchAll(ctx context.Context, ipfs coreiface.CoreAPI, hashes []cid.Cid, options *FetchOptions) []iface.IPFSLogEntry {
fetcher := NewFetcher(ipfs, options)
return fetcher.Fetch(ctx, hashes)
}
22 changes: 11 additions & 11 deletions entry/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"berty.tech/go-ipfs-log/iface"
"berty.tech/go-ipfs-log/io/cbor"
"github.com/ipfs/go-cid"
core_iface "github.com/ipfs/interface-go-ipfs-core"
coreiface "github.com/ipfs/kubo/core/coreiface"
"golang.org/x/sync/semaphore"
)

Expand All @@ -21,7 +21,7 @@ const (
taskKindDone
)

func noopShouldExclude(hash cid.Cid) bool {
func noopShouldExclude(_ cid.Cid) bool {
return false
}

Expand All @@ -39,11 +39,11 @@ type Fetcher struct {
condProcess *sync.Cond
muProcess *sync.RWMutex
sem *semaphore.Weighted
ipfs core_iface.CoreAPI
ipfs coreiface.CoreAPI
progressChan chan iface.IPFSLogEntry
}

func NewFetcher(ipfs core_iface.CoreAPI, options *FetchOptions) *Fetcher {
func NewFetcher(ipfs coreiface.CoreAPI, options *FetchOptions) *Fetcher {
// set default
length := -1
if options.Length != nil {
Expand Down Expand Up @@ -117,11 +117,11 @@ func (f *Fetcher) processQueue(ctx context.Context, hashes []cid.Cid) []iface.IP

// run process
go func(hash cid.Cid) {
entry, err := f.fetchEntry(ctx, hash)
if err != nil { // nolint:staticcheck
// @FIXME(gfanton): log this
// fmt.Printf("unable to fetch entry: %s\n", err.Error())
}
entry, _ := f.fetchEntry(ctx, hash)
// if err != nil {
// @FIXME(gfanton): log this
// fmt.Printf("unable to fetch entry: %s\n", err.Error())
// }

// free process slot
f.processDone()
Expand Down Expand Up @@ -186,7 +186,7 @@ func (f *Fetcher) processQueue(ctx context.Context, hashes []cid.Cid) []iface.IP
return results
}

func (f *Fetcher) updateClock(ctx context.Context, entry, lastEntry iface.IPFSLogEntry) {
func (f *Fetcher) updateClock(_ context.Context, entry, lastEntry iface.IPFSLogEntry) {
f.muClock.Lock()

ts := entry.GetClock().GetTime()
Expand Down Expand Up @@ -222,7 +222,7 @@ func (f *Fetcher) exclude(hash cid.Cid) (yes bool) {
return
}

func (f *Fetcher) addNextEntry(ctx context.Context, queue processQueue, entry iface.IPFSLogEntry, results []iface.IPFSLogEntry) {
func (f *Fetcher) addNextEntry(_ context.Context, queue processQueue, entry iface.IPFSLogEntry, results []iface.IPFSLogEntry) {
ts := entry.GetClock().GetTime()

if f.length < 0 {
Expand Down
2 changes: 0 additions & 2 deletions example/example_log_append_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,5 @@ func Example_logAppend() {
fmt.Println(res.ToString(nil))

// Output:
// go-libp2p resource manager protection disabled
// go-libp2p resource manager protection disabled
// hello world
}
Loading

0 comments on commit be4faf7

Please sign in to comment.