Skip to content

Commit 4cda768

Browse files
committed
Merge pull request #73 from mgatny/filestore
Implement FileStore
2 parents 36c0526 + 2e7de40 commit 4cda768

File tree

13 files changed

+708
-167
lines changed

13 files changed

+708
-167
lines changed

Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
all: vet test
22

33
get:
4-
go get github.com/golang/lint/golint
4+
go get -t -d ./...
55

66
GEN_MESSAGES = go run _gen/generate-messages/main.go
77
GEN_COMPONENTS = go run _gen/generate-components/main.go
@@ -20,15 +20,16 @@ vet:
2020
go vet ./...
2121

2222
lint:
23+
go get github.com/golang/lint/golint
2324
golint .
2425

25-
test:
26+
test: get
2627
go test -v -cover . ./datadictionary
2728

28-
_build_all:
29+
_build_all: get
2930
go build -v ./...
3031

31-
build_accept:
32+
build_accept: get
3233
cd _test; go build -o echo_server
3334

3435
build: _build_all build_accept

config/configuration.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ const (
1515
ResetOnLogon string = "ResetOnLogon"
1616
HeartBtInt string = "HeartBtInt"
1717
FileLogPath string = "FileLogPath"
18+
FileStorePath string = "FileStorePath"
1819
)

config/doc.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,9 @@ Socket port for listening to incoming connections, Only used with for acceptors.
118118
FileLogPath
119119
120120
Directory to store logs. Value must be valid directory for storing files, application must have write access.
121+
122+
FileStorePath
123+
124+
Directory to store sequence number and message files. Only used with FileStoreFactory.
121125
*/
122126
package config

field_map.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,24 @@ func (m FieldMap) GetField(tag Tag, parser FieldValueReader) MessageRejectError
103103
return nil
104104
}
105105

106+
// GetInt is a GetField wrapper for int fields
107+
func (m FieldMap) GetInt(tag Tag) (int, MessageRejectError) {
108+
var val FIXInt
109+
if err := m.GetField(tag, &val); err != nil {
110+
return 0, err
111+
}
112+
return int(val), nil
113+
}
114+
115+
// GetString is a GetField wrapper for string fields
116+
func (m FieldMap) GetString(tag Tag) (string, MessageRejectError) {
117+
var val FIXString
118+
if err := m.GetField(tag, &val); err != nil {
119+
return "", err
120+
}
121+
return string(val), nil
122+
}
123+
106124
func (m FieldMap) GetGroup(parser *RepeatingGroup) MessageRejectError {
107125
tagValues, ok := m.tagLookup[parser.Tag]
108126
if !ok {

file_log.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ package quickfix
22

33
import (
44
"fmt"
5-
"github.com/quickfixgo/quickfix/config"
65
"log"
76
"os"
87
"path"
9-
"strings"
8+
9+
"github.com/quickfixgo/quickfix/config"
1010
)
1111

1212
type fileLog struct {
@@ -96,10 +96,6 @@ func (f fileLogFactory) CreateSessionLog(sessionID SessionID) (Log, error) {
9696
return nil, fmt.Errorf("logger not defined for %v", sessionID)
9797
}
9898

99-
prefixParts := []string{sessionID.BeginString, sessionID.SenderCompID, sessionID.TargetCompID}
100-
if len(sessionID.Qualifier) > 0 {
101-
prefixParts = append(prefixParts, sessionID.Qualifier)
102-
}
103-
104-
return newFileLog(strings.Join(prefixParts, "-"), logPath)
99+
prefix := sessionIDFilenamePrefix(sessionID)
100+
return newFileLog(prefix, logPath)
105101
}

0 commit comments

Comments
 (0)