Skip to content
This repository has been archived by the owner on Oct 17, 2018. It is now read-only.

Commit

Permalink
Update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerome Froelich committed May 2, 2017
1 parent 3ca64fd commit dcc0585
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
3 changes: 0 additions & 3 deletions protocol/msgpack/base_iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ func newBaseIterator(
}
}

// NB(xichen): if reader is not a bufio.Reader, a bytes.Reader,
// or a bytes.Buffer, the underlying msgpack decoder creates a
// bufio.Reader wrapping the reader every time Reset() is called.
func (it *baseIterator) reset(reader io.Reader) {
bufReader := toBufReader(reader, it.readerBufferSize)
it.bufReader = bufReader
Expand Down
4 changes: 2 additions & 2 deletions protocol/msgpack/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type baseEncoderOptions struct {
compressor policy.Compressor
}

// NewBaseEncoderOptions creates a new set of base encoder options
// NewBaseEncoderOptions creates a new set of base encoder options.
func NewBaseEncoderOptions() BaseEncoderOptions {
return baseEncoderOptions{
compressor: policy.NewNoopCompressor(),
Expand Down Expand Up @@ -82,7 +82,7 @@ type baseIteratorOptions struct {
decompressor policy.Decompressor
}

// NewBaseIteratorOptions creates a new set of base iterator options
// NewBaseIteratorOptions creates a new set of base iterator options.
func NewBaseIteratorOptions() BaseIteratorOptions {
return baseIteratorOptions{
decompressor: policy.NewNoopDecompressor(),
Expand Down
4 changes: 2 additions & 2 deletions protocol/msgpack/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,11 @@ type iteratorBase interface {
// BaseIteratorOptions provide options for base iterators.
type BaseIteratorOptions interface {
// SetPolicyDecompressionEnabled determines whether the iterator will attempt
// to decode policies that have been compressed
// to decode policies that have been compressed.
SetPolicyDecompressionEnabled(enabled bool) BaseIteratorOptions

// PolicyDecompressionEnabled returns whether the iterator will attempt to
// decode policies that have been compressed
// decode policies that have been compressed.
PolicyDecompressionEnabled() bool

// SetPolicyDecompressor sets the policy Decompressor that will be used to
Expand Down
16 changes: 8 additions & 8 deletions protocol/msgpack/unaggregated_encoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func TestUnaggregatedEncoderReset(t *testing.T) {
}

func TestUnaggregatedEncoderNilOptions(t *testing.T) {
// use constructor directly here to test nil options
// Use constructor directly here to test nil options.
encoder := NewUnaggregatedEncoder(NewBufferedEncoder(), nil).(*unaggregatedEncoder)
encoder.EncodeCounterWithPolicies(unaggregated.CounterWithPolicies{
Counter: testCounter.Counter(),
Expand Down Expand Up @@ -301,7 +301,7 @@ func expectedResultsForPolicy(t *testing.T, p policy.Policy, o BaseEncoderOption
func expectedResultsForUnaggregatedMetricWithPolicies(
t *testing.T,
m unaggregated.MetricUnion,
p policy.VersionedPolicies,
vp policy.VersionedPolicies,
o BaseEncoderOptions,
) []interface{} {
results := []interface{}{
Expand Down Expand Up @@ -341,20 +341,20 @@ func expectedResultsForUnaggregatedMetricWithPolicies(
require.Fail(t, fmt.Sprintf("unrecognized metric type %v", m.Type))
}

if p.IsDefault() {
if vp.IsDefault() {
results = append(results, []interface{}{
numFieldsForType(defaultVersionedPoliciesType),
int64(defaultVersionedPoliciesType),
int64(p.Version),
p.Cutover,
int64(vp.Version),
vp.Cutover,
}...)
} else {
policies := p.Policies()
policies := vp.Policies()
results = append(results, []interface{}{
numFieldsForType(customVersionedPoliciesType),
int64(customVersionedPoliciesType),
int64(p.Version),
p.Cutover,
int64(vp.Version),
vp.Cutover,
len(policies),
}...)
for _, p := range policies {
Expand Down

0 comments on commit dcc0585

Please sign in to comment.