diff --git a/command/execute_command.go b/command/execute_command.go index 6e52647e..0310ba52 100644 --- a/command/execute_command.go +++ b/command/execute_command.go @@ -12,19 +12,19 @@ type ExecuteCommand struct { Stmt string `json:"stmt"` } -// Creates a new write command. +// NewExecuteCommand creates a new Execute command. func NewExecuteCommand(stmt string) *ExecuteCommand { return &ExecuteCommand{ Stmt: stmt, } } -// The name of the command in the log. +// The name of the ExecuteCommand in the log. func (c *ExecuteCommand) CommandName() string { return "write" } -// Executes an sqlite statement. +// Apply executes an sqlite statement. func (c *ExecuteCommand) Apply(server raft.Server) (interface{}, error) { log.Trace("Applying ExecuteCommand: '%s'", c.Stmt) db := server.Context().(*db.DB) @@ -37,19 +37,20 @@ type TransactionExecuteCommandSet struct { Stmts []string `json:"stmts"` } -// Creates a new set of sqlite commands, which execute within a transaction. +// NewTransactionExecuteCommandSet Creates a new set of sqlite commands, which +// execute within a transaction. func NewTransactionExecuteCommandSet(stmts []string) *TransactionExecuteCommandSet { return &TransactionExecuteCommandSet{ Stmts: stmts, } } -// The name of the command in the log. +// The name of the TransactionExecute command in the log. func (c *TransactionExecuteCommandSet) CommandName() string { return "transaction_execute" } -// Executes a set of sqlite statements, within a transaction. All statements +// Apply executes a set of sqlite statements, within a transaction. All statements // will take effect, or none. func (c *TransactionExecuteCommandSet) Apply(server raft.Server) (interface{}, error) { log.Trace("Applying TransactionExecuteCommandSet of size %d", len(c.Stmts)) diff --git a/server/server.go b/server/server.go index aa6892cf..a4ff238c 100644 --- a/server/server.go +++ b/server/server.go @@ -110,7 +110,7 @@ func isTransaction(req *http.Request) (bool, error) { return queryParam(req, "transaction") } -// Creates a new ServerMetrics object. +// NewServerMetrics creates a new ServerMetrics object. func NewServerMetrics() *ServerMetrics { m := &ServerMetrics{ registry: metrics.NewRegistry(), @@ -139,6 +139,7 @@ func NewServerMetrics() *ServerMetrics { return m } +// NewServerDiagnostics creates a new NewServerDiagnostics object. func NewServerDiagnostics() *ServerDiagnostics { d := &ServerDiagnostics{ startTime: time.Now(), @@ -146,7 +147,7 @@ func NewServerDiagnostics() *ServerDiagnostics { return d } -// Creates a new server. +// NewServer creates a new server. func NewServer(dataDir string, dbfile string, snapAfter int, host string, port int) *Server { dbPath := path.Join(dataDir, dbfile) @@ -181,7 +182,7 @@ func (s *Server) GetStatistics() (metrics.Registry, error) { return s.metrics.registry, nil } -// Returns the connection string. +// connectionString returns the string used to connect to this server. func (s *Server) connectionString() string { return fmt.Sprintf("http://%s:%d", s.host, s.port) } @@ -196,7 +197,7 @@ func (s *Server) logSnapshot(err error, currentIndex, count uint64) { } } -// Starts the server. +// ListenAndServe starts the server. func (s *Server) ListenAndServe(leader string) error { var err error