Skip to content

Commit

Permalink
Rename ParsedRequest to RawRequest
Browse files Browse the repository at this point in the history
Since it contains a raw byte slice of the request data rather than a
`http.Request` object.
  • Loading branch information
dcarley committed Oct 23, 2013
1 parent e7c1d86 commit 2f049dd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion listener/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func Run() {

if Settings.FileToReplayPath != "" {
go func() {
message := utils.ParsedRequest{time.Now().UnixNano(), m.Bytes()}
message := utils.RawRequest{time.Now().UnixNano(), m.Bytes()}
fileEnc.Encode(message)
}()
} else {
Expand Down
6 changes: 3 additions & 3 deletions replay/replay_file_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/buger/gor/utils"
)

func parseReplayFile() (requests []utils.ParsedRequest, err error) {
func parseReplayFile() (requests []utils.RawRequest, err error) {
requests, err = readLines(Settings.FileToReplayPath)

if err != nil {
Expand All @@ -22,7 +22,7 @@ func parseReplayFile() (requests []utils.ParsedRequest, err error) {

// readLines reads a whole file into memory
// and returns a slice of request+timestamps.
func readLines(path string) (requests []utils.ParsedRequest, err error) {
func readLines(path string) (requests []utils.RawRequest, err error) {
file, err := ioutil.ReadFile(path)

if err != nil {
Expand All @@ -33,7 +33,7 @@ func readLines(path string) (requests []utils.ParsedRequest, err error) {
fileDec := gob.NewDecoder(fileBuf)

for err == nil {
var reqBuf utils.ParsedRequest
var reqBuf utils.RawRequest
err = fileDec.Decode(&reqBuf)

if err == io.EOF {
Expand Down
4 changes: 2 additions & 2 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"fmt"
)

type ParsedRequest struct {
type RawRequest struct {
Timestamp int64
Request []byte
}

func (self ParsedRequest) String() string {
func (self RawRequest) String() string {
return fmt.Sprintf("Request: %v, timestamp: %v", string(self.Request), self.Timestamp)
}

0 comments on commit 2f049dd

Please sign in to comment.