Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): manual bump github.com/snivilised/lorax to 0.4.0 #326

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
require (
github.com/fortytw2/leaktest v1.3.0
github.com/google/uuid v1.3.1
github.com/snivilised/lorax v0.3.1
github.com/snivilised/lorax v0.4.0
)

require (
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ github.com/samber/lo v1.38.1 h1:j2XEAqXKb09Am4ebOg31SpvzUTTs6EN3VfgeLUhPdXM=
github.com/samber/lo v1.38.1/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA=
github.com/snivilised/lorax v0.3.1 h1:mjgI/yGMUAD/6tSJItbk/IF6NDZLImiq6st1J2Jne5w=
github.com/snivilised/lorax v0.3.1/go.mod h1:nlRxDGSzIxsX26W8eDNIk/TlCMuRNCWY9Shw7EeYu04=
github.com/snivilised/lorax v0.4.0 h1:9Z0be3dW+fjdws7qxfNSse6yjY64WPf44aWz6vVpF9Q=
github.com/snivilised/lorax v0.4.0/go.mod h1:ifQVyZOQgFgl7P/O23XfWAezQ+TMsdximya/SzhyEwE=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
Expand Down
54 changes: 0 additions & 54 deletions xfs/nav/navigation-accelerator.go

This file was deleted.

6 changes: 3 additions & 3 deletions xfs/nav/navigation-async-defs.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ type TraverseOutput struct {
Error error
}
type TraverseItemOutput = boost.JobOutput[TraverseOutput]
type TraverseItemOutputStream = boost.OutputStream[TraverseOutput]
type TraverseItemOutputStreamR = boost.OutputStreamR[TraverseOutput]
type TraverseItemOutputStreamW = boost.OutputStreamW[TraverseOutput]
type TraverseItemOutputStream = boost.JobOutputStream[TraverseOutput]
type TraverseItemOutputStreamR = boost.JobOutputStreamR[TraverseOutput]
type TraverseItemOutputStreamW = boost.JobOutputStreamW[TraverseOutput]

type AsyncInfo struct {
Context context.Context // this will be retired, instead passed into Run
Expand Down
6 changes: 3 additions & 3 deletions xfs/nav/navigation-async_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ const (
type Consumer[O any] struct {
waitAQ boost.AnnotatedWgAQ
RoutineName boost.GoRoutineName
OutputChIn boost.OutputStream[O]
OutputChIn boost.JobOutputStream[O]
Count int
}

func StartConsumer[O any](
ctx context.Context,
waitAQ boost.AnnotatedWgAQ,
outputChIn boost.OutputStream[O],
outputChIn boost.JobOutputStream[O],
) *Consumer[O] {
consumer := &Consumer[O]{
waitAQ: waitAQ,
Expand Down Expand Up @@ -148,7 +148,7 @@ var _ = Describe("navigation", Ordered, func() {
jroot string
fromJSONPath string
jobsChOut nav.TraverseItemJobStream
outputCh boost.OutputStream[nav.TraverseOutput]
outputCh boost.JobOutputStream[nav.TraverseOutput]
)

BeforeAll(func() {
Expand Down
12 changes: 6 additions & 6 deletions xfs/nav/navigation-runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ const (
MaxNoWorkers = 100
)

func CreateTraverseOutputCh(outputChSize int) boost.OutputStream[TraverseOutput] {
func CreateTraverseOutputCh(outputChSize int) boost.JobOutputStream[TraverseOutput] {
return lo.TernaryF(outputChSize > 0,
func() boost.OutputStream[TraverseOutput] {
return make(boost.OutputStream[TraverseOutput], outputChSize)
func() boost.JobOutputStream[TraverseOutput] {
return make(boost.JobOutputStream[TraverseOutput], outputChSize)
},
func() boost.OutputStream[TraverseOutput] {
func() boost.JobOutputStream[TraverseOutput] {
return nil
},
)
Expand All @@ -31,7 +31,7 @@ type Runnable interface {
type AccelerationOperators interface {
Runnable
NoW(now int) AccelerationOperators
Consume(outputCh boost.OutputStream[TraverseOutput]) AccelerationOperators
Consume(outputCh boost.JobOutputStream[TraverseOutput]) AccelerationOperators
}

type SessionRunner interface {
Expand Down Expand Up @@ -99,7 +99,7 @@ func (r *runner) NoW(now int) AccelerationOperators {
return r
}

func (r *runner) Consume(outputCh boost.OutputStream[TraverseOutput]) AccelerationOperators {
func (r *runner) Consume(outputCh boost.JobOutputStream[TraverseOutput]) AccelerationOperators {
r.sync.outputChOut = outputCh

return r
Expand Down
17 changes: 13 additions & 4 deletions xfs/nav/navigation-sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ type acceleratedSync struct {
baseSync
ai *AsyncInfo
noWorkers int
outputChOut boost.OutputStream[TraverseOutput]
outputChOut boost.JobOutputStream[TraverseOutput]
pool *boost.WorkerPool[TraverseItemInput, TraverseOutput]
}

Expand All @@ -81,8 +81,6 @@ func (s *acceleratedSync) Run(callback sessionCallback, nc syncable, args ...any
}

func (s *acceleratedSync) start(ctx context.Context, cancel context.CancelFunc) {
_ = cancel

s.pool = boost.NewWorkerPool[TraverseItemInput, TraverseOutput](
&boost.NewWorkerPoolParams[TraverseItemInput, TraverseOutput]{
NoWorkers: s.noWorkers,
Expand All @@ -97,7 +95,7 @@ func (s *acceleratedSync) start(ctx context.Context, cancel context.CancelFunc)
//
s.ai.WaitAQ.Add(1, s.pool.RoutineName)

go s.pool.Start(ctx, s.outputChOut)
go s.pool.Start(ctx, cancel, s.outputChOut)
}

func (s *acceleratedSync) finish(
Expand All @@ -107,3 +105,14 @@ func (s *acceleratedSync) finish(
close(ai.JobsChanOut) // ⚠️ fastward: intermittent panic on close
ai.WaitAQ.Done(ai.NavigatorRoutineName)
}

func workerExecutive(job boost.Job[TraverseItemInput]) (boost.JobOutput[TraverseOutput], error) {
err := job.Input.Fn(job.Input.Item)

return boost.JobOutput[TraverseOutput]{
Payload: TraverseOutput{
Item: job.Input.Item,
Error: err,
},
}, err
}