-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[libbeat] [cleanup] make spool.{Spool, Settings} internal #16693
Conversation
// NewSpool creates and initializes a new file based queue. | ||
func NewSpool(logger logger, path string, settings Settings) (*Spool, error) { | ||
// newDiskSpool creates and initializes a new file based queue. | ||
func newDiskSpool(logger logger, path string, settings settings) (*diskSpool, error) { |
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.
These have been public on purpose, so to allow us to reuse the Spool as is as a library. The 'Factory' approach to generate a queue.Queue would require us to go with an untyped config.
This might become interesting for the docker logging plugin in the future, maybe, maybe not :)
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.
Well, memqueue.NewQueue
is exported for similar reasons (it is used in only one place to create an explicit queue with hard-coded settings). But I suspect the need to create a transactional on-disk queue is relatively rare -- at least, it wouldn't be a lightweight or casual choice -- so it's easy to revisit the exported API once such an application does arise.
My preference, since this feature is beta and other planned uses don't yet have solid requirements, is to start with things internal and make elements public as we're confident about the interface we want to support in the future. But if you feel strongly I can re-export Settings
and wrap this helper in spool.NewQueue
as in the memqueue case, which would at least restrict external dependencies to the queue interface instead of the specific implementing type.
) (cherry picked from commit 76b6bdc)
What does this PR do?
Similar to #16667,
spool.Spool
is an implementation of thequeue.Queue
interface that is unreferenced outside its own package. This PR renames both the spool and its settings to internal types:spool.Spool -> spool.diskSpool
spool.Settings -> spool.settings
so that the disk spool can only be referenced via its
queue.Queue
implementation in the beats registry.This PR has no user-visible effects.
Checklist
I have commented my code, particularly in hard-to-understand areasI have made corresponding changes to the documentationI have made corresponding change to the default configuration filesI have added tests that prove my fix is effective or that my feature works