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

Adds generic ring #108

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Adds generic ring #108

wants to merge 6 commits into from

Conversation

JoshVanL
Copy link
Contributor

@JoshVanL JoshVanL commented Nov 12, 2024

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 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.

@JoshVanL JoshVanL requested review from a team as code owners November 12, 2024 12:16
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]>
Comment on lines +1 to +3
// 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.
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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]>
Copy link
Contributor

@elena-kolevska elena-kolevska left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants