fix typos

Signed-off-by: allencloud <allen.sun@daocloud.io>
This commit is contained in:
allencloud 2016-05-03 23:12:38 +08:00
parent 9bde837926
commit a658947af4
4 changed files with 15 additions and 14 deletions

View file

@ -146,7 +146,7 @@ func xzDecompress(archive io.Reader) (io.ReadCloser, <-chan struct{}, error) {
return cmdStream(exec.Command(args[0], args[1:]...), archive) return cmdStream(exec.Command(args[0], args[1:]...), archive)
} }
// DecompressStream decompress the archive and returns a ReaderCloser with the decompressed archive. // DecompressStream decompresses the archive and returns a ReaderCloser with the decompressed archive.
func DecompressStream(archive io.Reader) (io.ReadCloser, error) { func DecompressStream(archive io.Reader) (io.ReadCloser, error) {
p := pools.BufioReader32KPool p := pools.BufioReader32KPool
buf := p.Get(archive) buf := p.Get(archive)
@ -192,7 +192,7 @@ func DecompressStream(archive io.Reader) (io.ReadCloser, error) {
} }
} }
// CompressStream compresses the dest with specified compression algorithm. // CompressStream compresseses the dest with specified compression algorithm.
func CompressStream(dest io.Writer, compression Compression) (io.WriteCloser, error) { func CompressStream(dest io.Writer, compression Compression) (io.WriteCloser, error) {
p := pools.BufioWriter32KPool p := pools.BufioWriter32KPool
buf := p.Get(dest) buf := p.Get(dest)

View file

@ -8,14 +8,14 @@ type Plugin interface {
// Name returns the registered plugin name // Name returns the registered plugin name
Name() string Name() string
// AuthZRequest authorize the request from the client to the daemon // AuthZRequest authorizes the request from the client to the daemon
AuthZRequest(*Request) (*Response, error) AuthZRequest(*Request) (*Response, error)
// AuthZResponse authorize the response from the daemon to the client // AuthZResponse authorizes the response from the daemon to the client
AuthZResponse(*Request) (*Response, error) AuthZResponse(*Request) (*Response, error)
} }
// NewPlugins constructs and initialize the authorization plugins based on plugin names // NewPlugins constructs and initializes the authorization plugins based on plugin names
func NewPlugins(names []string) []Plugin { func NewPlugins(names []string) []Plugin {
plugins := []Plugin{} plugins := []Plugin{}
pluginsMap := make(map[string]struct{}) pluginsMap := make(map[string]struct{})
@ -69,7 +69,7 @@ func (a *authorizationPlugin) AuthZResponse(authReq *Request) (*Response, error)
return authRes, nil return authRes, nil
} }
// initPlugin initialize the authorization plugin if needed // initPlugin initializes the authorization plugin if needed
func (a *authorizationPlugin) initPlugin() error { func (a *authorizationPlugin) initPlugin() error {
// Lazy loading of plugins // Lazy loading of plugins
if a.plugin == nil { if a.plugin == nil {

View file

@ -26,10 +26,10 @@ type ResponseModifier interface {
// StatusCode returns the current status code // StatusCode returns the current status code
StatusCode() int StatusCode() int
// OverrideBody replace the body of the HTTP reply // OverrideBody replaces the body of the HTTP reply
OverrideBody(b []byte) OverrideBody(b []byte)
// OverrideHeader replace the headers of the HTTP reply // OverrideHeader replaces the headers of the HTTP reply
OverrideHeader(b []byte) error OverrideHeader(b []byte) error
// OverrideStatusCode replaces the status code of the HTTP reply // OverrideStatusCode replaces the status code of the HTTP reply
@ -89,21 +89,22 @@ func (rm *responseModifier) Header() http.Header {
return rm.header return rm.header
} }
// Header returns the internal http header // StatusCode returns the http status code
func (rm *responseModifier) StatusCode() int { func (rm *responseModifier) StatusCode() int {
return rm.statusCode return rm.statusCode
} }
// Override replace the body of the HTTP reply // OverrideBody replaces the body of the HTTP response
func (rm *responseModifier) OverrideBody(b []byte) { func (rm *responseModifier) OverrideBody(b []byte) {
rm.body = b rm.body = b
} }
// OverrideStatusCode replaces the status code of the HTTP response
func (rm *responseModifier) OverrideStatusCode(statusCode int) { func (rm *responseModifier) OverrideStatusCode(statusCode int) {
rm.statusCode = statusCode rm.statusCode = statusCode
} }
// Override replace the headers of the HTTP reply // OverrideHeader replaces the headers of the HTTP response
func (rm *responseModifier) OverrideHeader(b []byte) error { func (rm *responseModifier) OverrideHeader(b []byte) error {
header := http.Header{} header := http.Header{}
if err := json.Unmarshal(b, &header); err != nil { if err := json.Unmarshal(b, &header); err != nil {

View file

@ -13,12 +13,12 @@ import (
"github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
) )
// exclusion return true if the specified pattern is an exclusion // exclusion returns true if the specified pattern is an exclusion
func exclusion(pattern string) bool { func exclusion(pattern string) bool {
return pattern[0] == '!' return pattern[0] == '!'
} }
// empty return true if the specified pattern is empty // empty returns true if the specified pattern is empty
func empty(pattern string) bool { func empty(pattern string) bool {
return pattern == "" return pattern == ""
} }
@ -217,7 +217,7 @@ func regexpMatch(pattern, path string) (bool, error) {
} }
// CopyFile copies from src to dst until either EOF is reached // CopyFile copies from src to dst until either EOF is reached
// on src or an error occurs. It verifies src exists and remove // on src or an error occurs. It verifies src exists and removes
// the dst if it exists. // the dst if it exists.
func CopyFile(src, dst string) (int64, error) { func CopyFile(src, dst string) (int64, error) {
cleanSrc := filepath.Clean(src) cleanSrc := filepath.Clean(src)