-
Notifications
You must be signed in to change notification settings - Fork 33
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
Adds generic ring #108
base: main
Are you sure you want to change the base?
Adds generic ring #108
Conversation
Adds a generic implementation of the stdblib ring buffer so that each ring `Value` can be a concrete type. https://pkg.go.dev/container/ring Adds `Len() int` and `Keys() []K` func to the generic Map cmap. Changes `events/queue` Processor `Queueable` to be an exported type. No functional change, but consumed types should be exported. Signed-off-by: joshvanl <[email protected]>
Signed-off-by: joshvanl <[email protected]>
Signed-off-by: joshvanl <[email protected]>
Signed-off-by: joshvanl <[email protected]>
Signed-off-by: joshvanl <[email protected]>
// Copyright 2009 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to add a mention about Dapr editing the file? I don't know what the convention is here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's done 3 lines down. I assumed the editor being Dapr was assumed through context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I saw, was just wondering if the name Dapr needs to be mentioned, I genuinely don't know if that's the case.
Signed-off-by: joshvanl <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really cool stuff!! Maybe we can also consider a dynamic buffer size that starts from a low value and grows exponentially, up to a max value.
Adds a generic implementation of the stdblib ring buffer so that each ring
Value
can be a concrete type.https://pkg.go.dev/container/ring
Adds a
ring/Buffered
which implements a ring which buffers nodes, and expands/contracts based on live nodes. Used to reduce memory allocations.Adds
Len() int
andKeys() []K
func to the generic Map cmap.Changes
events/queue
ProcessorQueueable
to be an exported type. No functional change, but consumed types should be exported.