From 6fe38b0cd8ba3767d381f2367daa0061e166f2c8 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sat, 2 May 2015 16:22:43 +0200 Subject: [PATCH] fix comments to have the standard form --- backend/id.go | 2 +- chunker/chunker.go | 7 ++++--- node.go | 2 +- server/key.go | 4 ++-- server/server.go | 2 -- test/helpers.go | 4 ++-- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/backend/id.go b/backend/id.go index 261f4802d..e960b8eaf 100644 --- a/backend/id.go +++ b/backend/id.go @@ -10,7 +10,7 @@ import ( // IDSize contains the size of an ID, in bytes. const IDSize = hashSize -// References content within a repository. +// ID references content within a repository. type ID []byte // ParseID converts the given string to an ID. diff --git a/chunker/chunker.go b/chunker/chunker.go index a319c71f8..9d19a2e2a 100644 --- a/chunker/chunker.go +++ b/chunker/chunker.go @@ -17,8 +17,9 @@ const ( // aim to create chunks of 20 bits or about 1MiB on average. averageBits = 20 - // Chunks should be in the range of 512KiB to 8MiB. + // MinSize is the minimal size of a chunk. MinSize = 512 * KiB + // MaxSize is the maximal size of a chunk. MaxSize = 8 * MiB splitmask = (1 << averageBits) - 1 @@ -39,7 +40,7 @@ func init() { cache.entries = make(map[Pol]*tables) } -// A chunk is one content-dependent chunk of bytes whose end was cut when the +// Chunk is one content-dependent chunk of bytes whose end was cut when the // Rabin Fingerprint had the value stored in Cut. type Chunk struct { Start uint @@ -52,7 +53,7 @@ func (c Chunk) Reader(r io.ReaderAt) io.Reader { return io.NewSectionReader(r, int64(c.Start), int64(c.Length)) } -// A chunker internally holds everything needed to split content. +// Chunker split content with Rabin Fingerprints. type Chunker struct { pol Pol polShift uint diff --git a/node.go b/node.go index 958fc16e4..3060d54fb 100644 --- a/node.go +++ b/node.go @@ -102,7 +102,7 @@ func nodeTypeFromFileInfo(fi os.FileInfo) string { return "" } -// CreatAt creates the node at the given path and restores all the meta data. +// CreateAt creates the node at the given path and restores all the meta data. func (node *Node) CreateAt(path string, s *server.Server) error { switch node.Type { case "dir": diff --git a/server/key.go b/server/key.go index bcecb7719..68f00c481 100644 --- a/server/key.go +++ b/server/key.go @@ -258,13 +258,13 @@ func (k *Key) DecryptFrom(rd io.Reader) (io.ReadCloser, error) { return crypto.DecryptFrom(k.master, rd) } -// Master() returns the master keys for this repository. Only included for +// Master returns the master keys for this repository. Only included for // debug purposes. func (k *Key) Master() *crypto.Key { return k.master } -// User() returns the user keys for this key. Only included for debug purposes. +// User returns the user keys for this key. Only included for debug purposes. func (k *Key) User() *crypto.Key { return k.user } diff --git a/server/server.go b/server/server.go index da1974a99..e2a84650c 100644 --- a/server/server.go +++ b/server/server.go @@ -422,12 +422,10 @@ func (s *Server) Flush() error { return nil } -// Returns the backend used for this server. func (s *Server) Backend() backend.Backend { return s.be } -// Returns the index of this server. func (s *Server) Index() *Index { return s.idx } diff --git a/test/helpers.go b/test/helpers.go index a3e5a743c..b99f56dec 100644 --- a/test/helpers.go +++ b/test/helpers.go @@ -21,7 +21,7 @@ func Assert(tb testing.TB, condition bool, msg string, v ...interface{}) { } } -// ok fails the test if an err is not nil. +// OK fails the test if an err is not nil. func OK(tb testing.TB, err error) { if err != nil { _, file, line, _ := runtime.Caller(1) @@ -30,7 +30,7 @@ func OK(tb testing.TB, err error) { } } -// equals fails the test if exp is not equal to act. +// Equals fails the test if exp is not equal to act. func Equals(tb testing.TB, exp, act interface{}) { if !reflect.DeepEqual(exp, act) { _, file, line, _ := runtime.Caller(1)