-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2203 from jcantrill/log4597
LOG-4597: modify vector buffer and request to have mostly parity with…
- Loading branch information
Showing
36 changed files
with
620 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package helpers | ||
|
||
import ( | ||
"fmt" | ||
"reflect" | ||
) | ||
|
||
type OptionalPair struct { | ||
key string | ||
Value interface{} | ||
} | ||
|
||
func NewOptionalPair(key string, value interface{}) OptionalPair { | ||
return OptionalPair{ | ||
key, | ||
value, | ||
} | ||
} | ||
|
||
func (op OptionalPair) String() string { | ||
if op.Value == nil { | ||
return "" | ||
} | ||
format := "%s = %v" | ||
if reflect.TypeOf(op.Value).Kind() == reflect.String { | ||
format = "%s = %q" | ||
} | ||
return fmt.Sprintf(format, op.key, op.Value) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package helpers | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
var _ = Describe("OptionalPair", func() { | ||
Context("#Template", func() { | ||
var ( | ||
pair OptionalPair | ||
) | ||
It("should return an empty template when the value is nil", func() { | ||
pair = NewOptionalPair("abc", nil) | ||
Expect(pair.String()).To(BeEmpty()) | ||
}) | ||
It("should return a formatted string config when value is a string", func() { | ||
pair = NewOptionalPair("abc", "xyz") | ||
Expect(pair.String()).To(Equal(`abc = "xyz"`)) | ||
}) | ||
It("should return a formatted numerical config when value is an int", func() { | ||
pair = NewOptionalPair("abc", 123) | ||
Expect(pair.String()).To(Equal(`abc = 123`)) | ||
}) | ||
It("should return a formatted bool config when value is bool", func() { | ||
pair = NewOptionalPair("abc", true) | ||
Expect(pair.String()).To(Equal(`abc = true`)) | ||
}) | ||
It("should return a formatted false bool config when value is bool", func() { | ||
pair = NewOptionalPair("abc", false) | ||
Expect(pair.String()).To(Equal(`abc = false`)) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package helpers | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
func TestSuite(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "[internal][generator][helpers] Suite") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package output | ||
|
||
type Buffer struct { | ||
ComponentID string | ||
WhenFull string | ||
} | ||
|
||
func NewBuffer(id string) Buffer { | ||
return Buffer{ | ||
ComponentID: id, | ||
WhenFull: "drop_newest", | ||
} | ||
} | ||
|
||
func (b Buffer) Name() string { | ||
return "buffer" | ||
} | ||
|
||
func (b Buffer) Template() string { | ||
return `{{define "` + b.Name() + `" -}} | ||
[sinks.{{.ComponentID}}.buffer] | ||
when_full = "{{.WhenFull}}" | ||
{{end}}` | ||
} |
Oops, something went wrong.