mirror of
https://github.com/octoleo/restic.git
synced 2024-11-25 22:27:35 +00:00
fix comments to have the standard form
This commit is contained in:
parent
cf62eb3e15
commit
6fe38b0cd8
@ -10,7 +10,7 @@ import (
|
|||||||
// IDSize contains the size of an ID, in bytes.
|
// IDSize contains the size of an ID, in bytes.
|
||||||
const IDSize = hashSize
|
const IDSize = hashSize
|
||||||
|
|
||||||
// References content within a repository.
|
// ID references content within a repository.
|
||||||
type ID []byte
|
type ID []byte
|
||||||
|
|
||||||
// ParseID converts the given string to an ID.
|
// ParseID converts the given string to an ID.
|
||||||
|
@ -17,8 +17,9 @@ const (
|
|||||||
// aim to create chunks of 20 bits or about 1MiB on average.
|
// aim to create chunks of 20 bits or about 1MiB on average.
|
||||||
averageBits = 20
|
averageBits = 20
|
||||||
|
|
||||||
// Chunks should be in the range of 512KiB to 8MiB.
|
// MinSize is the minimal size of a chunk.
|
||||||
MinSize = 512 * KiB
|
MinSize = 512 * KiB
|
||||||
|
// MaxSize is the maximal size of a chunk.
|
||||||
MaxSize = 8 * MiB
|
MaxSize = 8 * MiB
|
||||||
|
|
||||||
splitmask = (1 << averageBits) - 1
|
splitmask = (1 << averageBits) - 1
|
||||||
@ -39,7 +40,7 @@ func init() {
|
|||||||
cache.entries = make(map[Pol]*tables)
|
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.
|
// Rabin Fingerprint had the value stored in Cut.
|
||||||
type Chunk struct {
|
type Chunk struct {
|
||||||
Start uint
|
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))
|
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 {
|
type Chunker struct {
|
||||||
pol Pol
|
pol Pol
|
||||||
polShift uint
|
polShift uint
|
||||||
|
2
node.go
2
node.go
@ -102,7 +102,7 @@ func nodeTypeFromFileInfo(fi os.FileInfo) string {
|
|||||||
return ""
|
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 {
|
func (node *Node) CreateAt(path string, s *server.Server) error {
|
||||||
switch node.Type {
|
switch node.Type {
|
||||||
case "dir":
|
case "dir":
|
||||||
|
@ -258,13 +258,13 @@ func (k *Key) DecryptFrom(rd io.Reader) (io.ReadCloser, error) {
|
|||||||
return crypto.DecryptFrom(k.master, rd)
|
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.
|
// debug purposes.
|
||||||
func (k *Key) Master() *crypto.Key {
|
func (k *Key) Master() *crypto.Key {
|
||||||
return k.master
|
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 {
|
func (k *Key) User() *crypto.Key {
|
||||||
return k.user
|
return k.user
|
||||||
}
|
}
|
||||||
|
@ -422,12 +422,10 @@ func (s *Server) Flush() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the backend used for this server.
|
|
||||||
func (s *Server) Backend() backend.Backend {
|
func (s *Server) Backend() backend.Backend {
|
||||||
return s.be
|
return s.be
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the index of this server.
|
|
||||||
func (s *Server) Index() *Index {
|
func (s *Server) Index() *Index {
|
||||||
return s.idx
|
return s.idx
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
func OK(tb testing.TB, err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
_, file, line, _ := runtime.Caller(1)
|
_, 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{}) {
|
func Equals(tb testing.TB, exp, act interface{}) {
|
||||||
if !reflect.DeepEqual(exp, act) {
|
if !reflect.DeepEqual(exp, act) {
|
||||||
_, file, line, _ := runtime.Caller(1)
|
_, file, line, _ := runtime.Caller(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user