Skip to content

Commit

Permalink
fix spelling in comments (#778)
Browse files Browse the repository at this point in the history
  • Loading branch information
gammazero authored Dec 28, 2024
1 parent b66edee commit 85fbc3a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 22 deletions.
2 changes: 1 addition & 1 deletion namesys/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ func PublishWithEOL(eol time.Time) PublishOption {
}
}

// PublishWithEOL sets [PublishOptions.TTL].
// PublishWithTTL sets [PublishOptions.TTL].
func PublishWithTTL(ttl time.Duration) PublishOption {
return func(o *PublishOptions) {
o.TTL = ttl
Expand Down
32 changes: 16 additions & 16 deletions pinning/pinner/dspinner/pin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ func TestAddLoadPin(t *testing.T) {
t.Fatal(err)
}
if pinData.Mode != mode {
t.Error("worng pin mode")
t.Error("wrong pin mode")
}
if pinData.Cid != ak {
t.Error("wrong pin cid")
Expand Down Expand Up @@ -428,17 +428,17 @@ func TestPinAddOverwriteName(t *testing.T) {
}

func TestIsPinnedLookup(t *testing.T) {
// Test that lookups work in pins which share
// the same branches. For that construct this tree:
// Test that lookups work in pins which share the same branches. For that
// construct this tree:
//
// A5->A4->A3->A2->A1->A0
// / /
// B------- /
// \ /
// C---------------
//
// This ensures that IsPinned works for all objects both when they
// are pinned and once they have been unpinned.
// This ensures that IsPinned works for all objects both when they are
// pinned and once they have been unpinned.
aBranchLen := 6

ctx, cancel := context.WithCancel(context.Background())
Expand All @@ -449,8 +449,8 @@ func TestIsPinnedLookup(t *testing.T) {

dserv := mdag.NewDAGService(bserv)

// Create new pinner. New will not load anything since there are
// no pins saved in the datastore yet.
// Create new pinner. New will not load anything since there are no pins
// saved in the datastore yet.
p, err := New(ctx, dstore, dserv)
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -563,7 +563,7 @@ func TestPinRecursiveFail(t *testing.T) {
t.Fatal(err)
}

// NOTE: This isnt a time based test, we expect the pin to fail
// NOTE: This isn't a time based test, we expect the pin to fail
mctx, cancel := context.WithTimeout(ctx, time.Millisecond)
defer cancel()

Expand All @@ -582,7 +582,7 @@ func TestPinRecursiveFail(t *testing.T) {
t.Fatal(err)
}

// this one is time based... but shouldnt cause any issues
// this one is time based... but shouldn't cause any issues
mctx, cancel = context.WithTimeout(ctx, time.Second)
defer cancel()
err = p.Pin(mctx, a, true, "")
Expand Down Expand Up @@ -732,7 +732,7 @@ func TestLoadDirty(t *testing.T) {
t.Fatal("index should be deleted")
}

// Create new pinner on same datastore that was never flushed. This should
// Create new pinner on same datastore that was never flushed. This should
// detect the dirty flag and repair the indexes.
p, err = New(ctx, dstore, dserv)
if err != nil {
Expand Down Expand Up @@ -950,7 +950,7 @@ func makeStore() (ds.Datastore, ipld.DAGService) {
return dstore, dserv
}

// BenchmarkLoadRebuild loads a pinner that has some number of saved pins, and
// BenchmarkLoad loads a pinner that has some number of saved pins, and
// compares the load time when rebuilding indexes to loading without rebuilding
// indexes.
func BenchmarkLoad(b *testing.B) {
Expand Down Expand Up @@ -995,8 +995,8 @@ func BenchmarkLoad(b *testing.B) {
})
}

// BenchmarkNthPins shows the time it takes to create/save 1 pin when a number
// of other pins already exist. Each run in the series shows performance for
// BenchmarkNthPin shows the time it takes to create/save 1 pin when a number
// of other pins already exist. Each run in the series shows performance for
// creating a pin in a larger number of existing pins.
func BenchmarkNthPin(b *testing.B) {
dstore, dserv := makeStore()
Expand Down Expand Up @@ -1044,8 +1044,8 @@ func benchmarkNthPin(b *testing.B, count int, pinner ipfspin.Pinner, dserv ipld.
}
}

// BenchmarkNPins demonstrates creating individual pins. Each run in the
// series shows performance for a larger number of individual pins.
// BenchmarkNPins demonstrates creating individual pins. Each run in the series
// shows performance for a larger number of individual pins.
func BenchmarkNPins(b *testing.B) {
for count := 128; count < 16386; count <<= 1 {
b.Run(fmt.Sprint("PinDS-", count), func(b *testing.B) {
Expand Down Expand Up @@ -1270,7 +1270,7 @@ func TestCidIndex(t *testing.T) {
defer results.Close()

// Iterate all pins and check if the corresponding recursive or direct
// index is missing. If the index is missing then create the index.
// index is missing. If the index is missing then create the index.
seen = false
for r := range results.Next() {
if seen {
Expand Down
2 changes: 1 addition & 1 deletion routing/http/filters/filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func AddFiltersToURL(baseURL string, protocolFilter, addrFilter []string) string
return parsedURL.String()
}

// applyFiltersToIter applies the filters to the given iterator and returns a new iterator.
// ApplyFiltersToIter applies the filters to the given iterator and returns a new iterator.
//
// The function iterates over the input iterator, applying the specified filters to each record.
// It supports both positive and negative filters for both addresses and protocols.
Expand Down
10 changes: 6 additions & 4 deletions routing/http/internal/goroutines.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import (
"github.com/samber/lo"
)

// DoBatch processes a slice of items with concurrency no higher than maxConcurrency by splitting it into batches no larger than maxBatchSize.
// If an error is returned for any batch, the process is short-circuited and the error is immediately returned.
// DoBatch processes a slice of items with concurrency no higher than
// maxConcurrency by splitting it into batches no larger than maxBatchSize. If
// an error is returned for any batch, the process is short-circuited and the
// error is immediately returned.
func DoBatch[A any](ctx context.Context, maxBatchSize, maxConcurrency int, items []A, f func(context.Context, []A) error) error {
if len(items) == 0 {
return nil
Expand Down Expand Up @@ -62,8 +64,8 @@ func DoBatch[A any](ctx context.Context, maxBatchSize, maxConcurrency int, items
// we finished without any errors, congratulations
return nil
}
// short circuit on the first error we get
// canceling the worker ctx and thus all workers,
// short circuit on the first error we get canceling the worker ctx and
// thus all workers,
return err
case <-ctx.Done():
return ctx.Err()
Expand Down

0 comments on commit 85fbc3a

Please sign in to comment.