1
0
Fork 0

'go lint' fixes

master
Philip O Toole 8 years ago
parent 8d10cbc798
commit bf2047b45b

@ -17,7 +17,7 @@ type Credential struct {
Perms []string `json:"perms,omitempty"`
}
// CredentialStore stores authentication and authorization information for all users.
// CredentialsStore stores authentication and authorization information for all users.
type CredentialsStore struct {
store map[string]string
perms map[string]map[string]bool

@ -11,7 +11,7 @@ import (
)
const (
ConnectionTimeout = 10 * time.Second
connectionTimeout = 10 * time.Second
)
var respOKMarshalled []byte
@ -105,7 +105,7 @@ func (s *Service) SetPeer(raftAddr, apiAddr string) error {
if leader := s.store.Leader(); leader == "" {
return fmt.Errorf("no leader available")
}
conn, err := s.tn.Dial(s.store.Leader(), ConnectionTimeout)
conn, err := s.tn.Dial(s.store.Leader(), connectionTimeout)
if err != nil {
return err
}

@ -13,6 +13,7 @@ import (
const bkDelay = 250
// DBVersion is the SQLite version.
var DBVersion string
func init() {
@ -49,7 +50,7 @@ func Open(dbPath string) (*DB, error) {
return open(fqdsn(dbPath, ""))
}
// OpenwithDSN opens a file-based database, creating it if it does not exist.
// OpenWithDSN opens a file-based database, creating it if it does not exist.
func OpenWithDSN(dbPath, dsn string) (*DB, error) {
return open(fqdsn(dbPath, dsn))
}

@ -77,6 +77,7 @@ const (
numQueries = "queries"
numBackups = "backups"
// Permissions available to users.
PermAll = "all"
PermJoin = "join"
PermExecute = "execute"
@ -490,6 +491,7 @@ func (s *Service) Addr() net.Addr {
return s.ln.Addr()
}
// FormRedirect returns the value for the "Location" header for a 301 response.
func (s *Service) FormRedirect(r *http.Request, host string) string {
protocol := "http"
if s.credentialStore != nil {

@ -24,7 +24,7 @@ import (
)
var (
// ErrFieldsRequired is returned when a node attempts to execute a leader-only
// ErrNotLeader is returned when a node attempts to execute a leader-only
// operation.
ErrNotLeader = errors.New("not leader")
)
@ -84,6 +84,7 @@ type peersSub map[string]string
// ConsistencyLevel represents the available read consistency levels.
type ConsistencyLevel int
// Represents the available consistency levels.
const (
None ConsistencyLevel = iota
Weak
@ -96,7 +97,7 @@ type clusterMeta struct {
}
// NewClusterMeta returns an initialized cluster meta store.
func NewClusterMeta() *clusterMeta {
func newClusterMeta() *clusterMeta {
return &clusterMeta{
APIPeers: make(map[string]string),
}
@ -158,7 +159,7 @@ func New(dbConf *DBConfig, dir string, tn Transport) *Store {
raftTransport: tn,
dbConf: dbConf,
dbPath: filepath.Join(dir, sqliteFile),
meta: NewClusterMeta(),
meta: newClusterMeta(),
logger: log.New(os.Stderr, "[store] ", log.LstdFlags),
}
}
@ -262,6 +263,7 @@ func (s *Store) Path() string {
return s.raftDir
}
// Addr returns the address of the store.
func (s *Store) Addr() net.Addr {
return s.raftTransport.Addr()
}

@ -24,7 +24,7 @@ func (m *mockSnapshotSink) Cancel() error {
}
func Test_ClusterMeta(t *testing.T) {
c := NewClusterMeta()
c := newClusterMeta()
c.APIPeers["localhost:4002"] = "localhost:4001"
if c.AddrForPeer("localhost:4002") != "localhost:4001" {

Loading…
Cancel
Save