Skip to content

Commit

Permalink
Merge pull request mendersoftware#1155 from oleorhagen/remove-unused-…
Browse files Browse the repository at this point in the history
…bytecountwriter

chore: Remove unused ByteCountWriter
  • Loading branch information
oleorhagen authored Feb 21, 2023
2 parents 405cac1 + 5561aff commit dcc278f
Showing 1 changed file with 1 addition and 24 deletions.
25 changes: 1 addition & 24 deletions utils/limited_writer.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Northern.tech AS
// Copyright 2023 Northern.tech AS
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -60,26 +60,3 @@ func (lw *LimitedWriteCloser) Close() error {
}
return lw.W.Close()
}

// ByteCountWriteCloser - as the name implies, just counts how many bytes the
// Writer/WriteCloser interface has written.
type ByteCountWriteCloser struct {
BytesWritten uint64
wc io.WriteCloser
}

func NewByteCountWriteCloser(wc io.WriteCloser) *ByteCountWriteCloser {
return &ByteCountWriteCloser{wc: wc}
}

// Write - Writer/WriteCloser interface function
func (bcwc *ByteCountWriteCloser) Write(p []byte) (int, error) {
n, err := bcwc.wc.Write(p)
bcwc.BytesWritten += uint64(n)
return n, err
}

// Close - WriteCloser interface function
func (bcwc *ByteCountWriteCloser) Close() error {
return bcwc.wc.Close()
}

0 comments on commit dcc278f

Please sign in to comment.