diff --git a/cmd/rqlited/main.go b/cmd/rqlited/main.go index 7662e165..4a7a5984 100644 --- a/cmd/rqlited/main.go +++ b/cmd/rqlited/main.go @@ -205,7 +205,7 @@ func main() { dbConf.FKConstraints = fkConstraints dbConf.OnDiskPath = onDiskPath - str := store.New(raftTn, &store.StoreConfig{ + str := store.New(raftTn, &store.Config{ DBConf: dbConf, Dir: dataPath, ID: idOrRaftAddr(), diff --git a/http/service.go b/http/service.go index e191f8f7..e0f00967 100644 --- a/http/service.go +++ b/http/service.go @@ -1118,14 +1118,14 @@ func requestQueries(r *http.Request) ([]*command.Statement, error) { func createTLSConfig(certFile, keyFile, caCertFile string, tls1011 bool) (*tls.Config, error) { var err error - var minTls = uint16(tls.VersionTLS12) + var minTLS = uint16(tls.VersionTLS12) if tls1011 { - minTls = tls.VersionTLS10 + minTLS = tls.VersionTLS10 } config := &tls.Config{ NextProtos: []string{"h2", "http/1.1"}, - MinVersion: minTls, + MinVersion: minTLS, } config.Certificates = make([]tls.Certificate, 1) config.Certificates[0], err = tls.LoadX509KeyPair(certFile, keyFile) diff --git a/store/store.go b/store/store.go index 7a1b3fa8..80c760f3 100644 --- a/store/store.go +++ b/store/store.go @@ -61,16 +61,16 @@ const ( ) const ( - numSnaphots = "num_snapshots" - numBackups = "num_backups" - numRestores = "num_restores" - numUncompressedCommands = "num_uncompressed_commands" - numCompressedCommands = "num_compressed_commands" - numJoins = "num_joins" - numIgnoredJoins = "num_ignored_joins" - numRemovedBeforeJoins = "num_removed_before_joins" - snapshot_create_duration = "snapshot_create_duration" - snapshot_persist_duration = "snapshot_persist_duration" + numSnaphots = "num_snapshots" + numBackups = "num_backups" + numRestores = "num_restores" + numUncompressedCommands = "num_uncompressed_commands" + numCompressedCommands = "num_compressed_commands" + numJoins = "num_joins" + numIgnoredJoins = "num_ignored_joins" + numRemovedBeforeJoins = "num_removed_before_joins" + snapshotCreateDuration = "snapshot_create_duration" + snapshotPersistDuration = "snapshot_persist_duration" ) // BackupFormat represents the format of database backup. @@ -97,8 +97,8 @@ func init() { stats.Add(numJoins, 0) stats.Add(numIgnoredJoins, 0) stats.Add(numRemovedBeforeJoins, 0) - stats.Add(snapshot_create_duration, 0) - stats.Add(snapshot_persist_duration, 0) + stats.Add(snapshotCreateDuration, 0) + stats.Add(snapshotPersistDuration, 0) } // ClusterState defines the possible Raft states the current node can be in @@ -171,8 +171,8 @@ func IsNewNode(raftDir string) bool { return !pathExists(filepath.Join(raftDir, raftDBPath)) } -// StoreConfig represents the configuration of the underlying Store. -type StoreConfig struct { +// Config represents the configuration of the underlying Store. +type Config struct { DBConf *DBConfig // The DBConfig object for this Store. Dir string // The working directory for raft. Tn Transport // The underlying Transport for raft. @@ -181,7 +181,7 @@ type StoreConfig struct { } // New returns a new Store. -func New(ln Listener, c *StoreConfig) *Store { +func New(ln Listener, c *Config) *Store { logger := c.Logger if logger == nil { logger = log.New(os.Stderr, "[store] ", log.LstdFlags) @@ -1042,7 +1042,7 @@ func (s *Store) Snapshot() (raft.FSMSnapshot, error) { dur := time.Since(fsm.startT) stats.Add(numSnaphots, 1) - stats.Get(snapshot_create_duration).(*expvar.Int).Set(dur.Milliseconds()) + stats.Get(snapshotCreateDuration).(*expvar.Int).Set(dur.Milliseconds()) s.logger.Printf("node snapshot created in %s", dur) return fsm, nil } @@ -1173,7 +1173,7 @@ type fsmSnapshot struct { func (f *fsmSnapshot) Persist(sink raft.SnapshotSink) error { defer func() { dur := time.Since(f.startT) - stats.Get(snapshot_persist_duration).(*expvar.Int).Set(dur.Milliseconds()) + stats.Get(snapshotPersistDuration).(*expvar.Int).Set(dur.Milliseconds()) f.logger.Printf("snapshot and persist took %s", dur) }() diff --git a/store/store_test.go b/store/store_test.go index 5bd2a685..d1148cb6 100644 --- a/store/store_test.go +++ b/store/store_test.go @@ -1295,7 +1295,7 @@ func mustNewStoreAtPaths(dataPath, sqlitePath string, inmem, fk bool) *Store { cfg.FKConstraints = fk cfg.OnDiskPath = sqlitePath - s := New(mustMockLister("localhost:0"), &StoreConfig{ + s := New(mustMockLister("localhost:0"), &Config{ DBConf: cfg, Dir: dataPath, ID: dataPath, // Could be any unique string. diff --git a/system_test/helpers.go b/system_test/helpers.go index 564bf3cb..a8051edf 100644 --- a/system_test/helpers.go +++ b/system_test/helpers.go @@ -489,7 +489,7 @@ func mustNodeEncryptedOnDisk(dir string, enableSingle, httpEncrypt bool, mux *tc if id == "" { id = raftTn.Addr().String() } - node.Store = store.New(raftTn, &store.StoreConfig{ + node.Store = store.New(raftTn, &store.Config{ DBConf: dbConf, Dir: node.Dir, ID: id, diff --git a/tcp/pool/conn.go b/tcp/pool/conn.go index 693488c8..44872c66 100644 --- a/tcp/pool/conn.go +++ b/tcp/pool/conn.go @@ -14,7 +14,7 @@ type PoolConn struct { unusable bool } -// Close() puts the given connects back to the pool instead of closing it. +// Close puts the given connects back to the pool instead of closing it. func (p *PoolConn) Close() error { p.mu.RLock() defer p.mu.RUnlock() @@ -28,7 +28,7 @@ func (p *PoolConn) Close() error { return p.c.put(p.Conn) } -// MarkUnusable() marks the connection not usable any more, to let the pool close it instead of returning it to pool. +// MarkUnusable marks the connection not usable any more, to let the pool close it instead of returning it to pool. func (p *PoolConn) MarkUnusable() { p.mu.Lock() p.unusable = true