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

Fix truncating and batch backends integration. #65823

Merged
merged 1 commit into from Jul 9, 2018
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+4 −3
Diff settings

Always

Just for now

Fix truncating and buffering backends integration.

  • Loading branch information...
loburm committed Jul 9, 2018
commit 20fb0b5eb180fb4cb9be18ab3fc8cd259c7f7bf0
@@ -102,6 +102,7 @@ type bufferedBackend struct {
var _ audit.Backend = &bufferedBackend{}

// NewBackend returns a buffered audit backend that wraps delegate backend.
// Buffered backend automatically runs and shuts down the delegate backend.
func NewBackend(delegate audit.Backend, config BatchConfig) audit.Backend {
var throttle flowcontrol.RateLimiter
if config.ThrottleEnable {
@@ -62,6 +62,7 @@ type backend struct {
var _ audit.Backend = &backend{}

// NewBackend returns a new truncating backend, using configuration passed in the parameters.
// Truncate backend automatically runs and shut downs the delegate backend.
func NewBackend(delegateBackend audit.Backend, config Config, groupVersion schema.GroupVersion) audit.Backend {
return &backend{
delegateBackend: delegateBackend,
@@ -128,12 +129,11 @@ func truncate(e *auditinternal.Event) *auditinternal.Event {
}

func (b *backend) Run(stopCh <-chan struct{}) error {
// Nothing to do here
return nil
return b.delegateBackend.Run(stopCh)

This comment has been minimized.

Copy link
@sttts

sttts Jul 6, 2018

Contributor

can we add that to the (not existing) godoc? Either here or above for the constructor at least: It runs and shuts down the delegate.

This comment has been minimized.

Copy link
@loburm

loburm Jul 6, 2018

Author Contributor

I have added comment both to the truncate and buffered backends.

}

func (b *backend) Shutdown() {

This comment has been minimized.

Copy link
@CaoShuFeng

CaoShuFeng Jul 5, 2018

Member

Should also call b.delegateBackend.Shutdown() here.

This comment has been minimized.

Copy link
@loburm

loburm Jul 5, 2018

Author Contributor

Done.

// Nothing to do here
b.delegateBackend.Shutdown()
}

func (b *backend) calcSize(e *auditinternal.Event) (int64, error) {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.