Merge pull request #4358 from gyuho/typo

*: fix minor typos, comments
This commit is contained in:
Gyu-Ho Lee 2016-01-30 18:29:03 -08:00
commit 42acd957a3
6 changed files with 13 additions and 9 deletions

View File

@ -11,6 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package clientv3 package clientv3
import ( import (

View File

@ -11,6 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package clientv3 package clientv3
import ( import (

View File

@ -20,6 +20,7 @@ import (
"strings" "strings"
) )
// URLsMap is a map from a name to its URLs.
type URLsMap map[string]URLs type URLsMap map[string]URLs
// NewURLsMap returns a URLsMap instantiated from the given string, // NewURLsMap returns a URLsMap instantiated from the given string,
@ -41,7 +42,7 @@ func NewURLsMap(s string) (URLsMap, error) {
// String returns NameURLPairs into discovery-formatted name-to-URLs sorted by name. // String returns NameURLPairs into discovery-formatted name-to-URLs sorted by name.
func (c URLsMap) String() string { func (c URLsMap) String() string {
pairs := make([]string, 0) var pairs []string
for name, urls := range c { for name, urls := range c {
for _, url := range urls { for _, url := range urls {
pairs = append(pairs, fmt.Sprintf("%s=%s", name, url.String())) pairs = append(pairs, fmt.Sprintf("%s=%s", name, url.String()))
@ -54,7 +55,7 @@ func (c URLsMap) String() string {
// URLs returns a list of all URLs. // URLs returns a list of all URLs.
// The returned list is sorted in ascending lexicographical order. // The returned list is sorted in ascending lexicographical order.
func (c URLsMap) URLs() []string { func (c URLsMap) URLs() []string {
urls := make([]string, 0) var urls []string
for _, us := range c { for _, us := range c {
for _, u := range us { for _, u := range us {
urls = append(urls, u.String()) urls = append(urls, u.String())
@ -64,6 +65,7 @@ func (c URLsMap) URLs() []string {
return urls return urls
} }
// Len returns the size of URLsMap.
func (c URLsMap) Len() int { func (c URLsMap) Len() int {
return len(c) return len(c)
} }

View File

@ -24,7 +24,7 @@ type WaitTime interface {
// The chan will be triggered when Trigger is called with a // The chan will be triggered when Trigger is called with a
// deadline that is later than the one it is waiting for. // deadline that is later than the one it is waiting for.
// The given deadline MUST be unique. The deadline should be // The given deadline MUST be unique. The deadline should be
// retrived by calling time.Now() in most cases. // retrieved by calling time.Now() in most cases.
Wait(deadline time.Time) <-chan struct{} Wait(deadline time.Time) <-chan struct{}
// Trigger triggers all the waiting chans with an earlier deadline. // Trigger triggers all the waiting chans with an earlier deadline.
Trigger(deadline time.Time) Trigger(deadline time.Time)

View File

@ -237,7 +237,7 @@ func TestProgressIsPaused(t *testing.T) {
ins: newInflights(256), ins: newInflights(256),
} }
if g := p.isPaused(); g != tt.w { if g := p.isPaused(); g != tt.w {
t.Errorf("#%d: shouldwait = %t, want %t", i, g, tt.w) t.Errorf("#%d: paused= %t, want %t", i, g, tt.w)
} }
} }
} }
@ -1323,7 +1323,7 @@ func TestBcastBeat(t *testing.T) {
} }
} }
// tests the output of the statemachine when receiving MsgBeat // tests the output of the state machine when receiving MsgBeat
func TestRecvMsgBeat(t *testing.T) { func TestRecvMsgBeat(t *testing.T) {
tests := []struct { tests := []struct {
state StateType state StateType

View File

@ -60,7 +60,7 @@ var (
crcTable = crc32.MakeTable(crc32.Castagnoli) crcTable = crc32.MakeTable(crc32.Castagnoli)
) )
// WAL is a logical repersentation of the stable storage. // WAL is a logical representation of the stable storage.
// WAL is either in read mode or append mode but not both. // WAL is either in read mode or append mode but not both.
// A newly created WAL is in append mode, and ready for appending records. // A newly created WAL is in append mode, and ready for appending records.
// A just opened WAL is in read mode, and ready for reading records. // A just opened WAL is in read mode, and ready for reading records.
@ -189,7 +189,7 @@ func openAtIndex(dirpath string, snap walpb.Snapshot, write bool) (*WAL, error)
} }
if write { if write {
// open the lastest wal file for appending // open the last wal file for appending
seq, _, err := parseWalName(names[len(names)-1]) seq, _, err := parseWalName(names[len(names)-1])
if err != nil { if err != nil {
rc.Close() rc.Close()
@ -315,7 +315,7 @@ func (w *WAL) ReadAll() (metadata []byte, state raftpb.HardState, ents []raftpb.
// cut closes current file written and creates a new one ready to append. // cut closes current file written and creates a new one ready to append.
// cut first creates a temp wal file and writes necessary headers into it. // cut first creates a temp wal file and writes necessary headers into it.
// Then cut atomtically rename temp wal file to a wal file. // Then cut atomically rename temp wal file to a wal file.
func (w *WAL) cut() error { func (w *WAL) cut() error {
// close old wal file // close old wal file
if err := w.sync(); err != nil { if err := w.sync(); err != nil {
@ -428,7 +428,7 @@ func (w *WAL) ReleaseLockTo(index uint64) error {
} }
// if no lock index is greater than the release index, we can // if no lock index is greater than the release index, we can
// release lock upto the last one(excluding). // release lock up to the last one(excluding).
if !found && len(w.locks) != 0 { if !found && len(w.locks) != 0 {
smaller = len(w.locks) - 1 smaller = len(w.locks) - 1
} }