-
Notifications
You must be signed in to change notification settings - Fork 319
journal: ability to set flags for journal instance #444
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
base: main
Are you sure you want to change the base?
Conversation
59f8778
to
16d5271
Compare
16d5271
to
1953a9e
Compare
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.
Can you please rebase to pick up the latest CI changes.
} | ||
|
||
// NewJournalWithFlags return a new Journal instance pointing to the local journal | ||
// with a list of flags indicating the scope and type of entries that will be accessed. |
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.
Can you document that the flag values are defined as SD_JOURNAL_FLAG_ and must be bitwise ORed
@@ -48,6 +48,10 @@ type JournalReaderConfig struct { | |||
// in this directory. The supplied path may be relative or absolute. | |||
Path string | |||
|
|||
// If not nil, the journal instance will point to a journal with a list | |||
// of flags indicating the scope and type of entries that will be accessed. | |||
Flags []int |
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.
Why this an array? Just let the caller do the bitwise OR. I think the issue is that the default flag will be 0 but ensure we know a user explicitly set the flags converting it to pointer may be enough so *int,
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.
@taranovegor please let us know if you want to keep working on this.
Yes, I will continue working on this, but I won’t be able to do it ASAP. |
I needed to merge journals, which involves using the
--merge
flag when callingjournalctl
. Since I couldn't find a way to do this in the current implementation, I propose the following solution.The structure
JournalReaderConfig
is augmented with a fieldFlags
that contains an array of constants. If theFlags
array is not empty, the methodNewJournalWithFlags
is called with the bitwise OR of the values in the array.