Signed-off-by: allencloud <allen.sun@daocloud.io>
| ... | ... |
@@ -146,7 +146,7 @@ func xzDecompress(archive io.Reader) (io.ReadCloser, <-chan struct{}, error) {
|
| 146 | 146 |
return cmdStream(exec.Command(args[0], args[1:]...), archive) |
| 147 | 147 |
} |
| 148 | 148 |
|
| 149 |
-// DecompressStream decompress the archive and returns a ReaderCloser with the decompressed archive. |
|
| 149 |
+// DecompressStream decompresses the archive and returns a ReaderCloser with the decompressed archive. |
|
| 150 | 150 |
func DecompressStream(archive io.Reader) (io.ReadCloser, error) {
|
| 151 | 151 |
p := pools.BufioReader32KPool |
| 152 | 152 |
buf := p.Get(archive) |
| ... | ... |
@@ -192,7 +192,7 @@ func DecompressStream(archive io.Reader) (io.ReadCloser, error) {
|
| 192 | 192 |
} |
| 193 | 193 |
} |
| 194 | 194 |
|
| 195 |
-// CompressStream compresses the dest with specified compression algorithm. |
|
| 195 |
+// CompressStream compresseses the dest with specified compression algorithm. |
|
| 196 | 196 |
func CompressStream(dest io.Writer, compression Compression) (io.WriteCloser, error) {
|
| 197 | 197 |
p := pools.BufioWriter32KPool |
| 198 | 198 |
buf := p.Get(dest) |
| ... | ... |
@@ -8,14 +8,14 @@ type Plugin interface {
|
| 8 | 8 |
// Name returns the registered plugin name |
| 9 | 9 |
Name() string |
| 10 | 10 |
|
| 11 |
- // AuthZRequest authorize the request from the client to the daemon |
|
| 11 |
+ // AuthZRequest authorizes the request from the client to the daemon |
|
| 12 | 12 |
AuthZRequest(*Request) (*Response, error) |
| 13 | 13 |
|
| 14 |
- // AuthZResponse authorize the response from the daemon to the client |
|
| 14 |
+ // AuthZResponse authorizes the response from the daemon to the client |
|
| 15 | 15 |
AuthZResponse(*Request) (*Response, error) |
| 16 | 16 |
} |
| 17 | 17 |
|
| 18 |
-// NewPlugins constructs and initialize the authorization plugins based on plugin names |
|
| 18 |
+// NewPlugins constructs and initializes the authorization plugins based on plugin names |
|
| 19 | 19 |
func NewPlugins(names []string) []Plugin {
|
| 20 | 20 |
plugins := []Plugin{}
|
| 21 | 21 |
pluginsMap := make(map[string]struct{})
|
| ... | ... |
@@ -69,7 +69,7 @@ func (a *authorizationPlugin) AuthZResponse(authReq *Request) (*Response, error) |
| 69 | 69 |
return authRes, nil |
| 70 | 70 |
} |
| 71 | 71 |
|
| 72 |
-// initPlugin initialize the authorization plugin if needed |
|
| 72 |
+// initPlugin initializes the authorization plugin if needed |
|
| 73 | 73 |
func (a *authorizationPlugin) initPlugin() error {
|
| 74 | 74 |
// Lazy loading of plugins |
| 75 | 75 |
if a.plugin == nil {
|
| ... | ... |
@@ -26,10 +26,10 @@ type ResponseModifier interface {
|
| 26 | 26 |
// StatusCode returns the current status code |
| 27 | 27 |
StatusCode() int |
| 28 | 28 |
|
| 29 |
- // OverrideBody replace the body of the HTTP reply |
|
| 29 |
+ // OverrideBody replaces the body of the HTTP reply |
|
| 30 | 30 |
OverrideBody(b []byte) |
| 31 | 31 |
|
| 32 |
- // OverrideHeader replace the headers of the HTTP reply |
|
| 32 |
+ // OverrideHeader replaces the headers of the HTTP reply |
|
| 33 | 33 |
OverrideHeader(b []byte) error |
| 34 | 34 |
|
| 35 | 35 |
// OverrideStatusCode replaces the status code of the HTTP reply |
| ... | ... |
@@ -89,21 +89,22 @@ func (rm *responseModifier) Header() http.Header {
|
| 89 | 89 |
return rm.header |
| 90 | 90 |
} |
| 91 | 91 |
|
| 92 |
-// Header returns the internal http header |
|
| 92 |
+// StatusCode returns the http status code |
|
| 93 | 93 |
func (rm *responseModifier) StatusCode() int {
|
| 94 | 94 |
return rm.statusCode |
| 95 | 95 |
} |
| 96 | 96 |
|
| 97 |
-// Override replace the body of the HTTP reply |
|
| 97 |
+// OverrideBody replaces the body of the HTTP response |
|
| 98 | 98 |
func (rm *responseModifier) OverrideBody(b []byte) {
|
| 99 | 99 |
rm.body = b |
| 100 | 100 |
} |
| 101 | 101 |
|
| 102 |
+// OverrideStatusCode replaces the status code of the HTTP response |
|
| 102 | 103 |
func (rm *responseModifier) OverrideStatusCode(statusCode int) {
|
| 103 | 104 |
rm.statusCode = statusCode |
| 104 | 105 |
} |
| 105 | 106 |
|
| 106 |
-// Override replace the headers of the HTTP reply |
|
| 107 |
+// OverrideHeader replaces the headers of the HTTP response |
|
| 107 | 108 |
func (rm *responseModifier) OverrideHeader(b []byte) error {
|
| 108 | 109 |
header := http.Header{}
|
| 109 | 110 |
if err := json.Unmarshal(b, &header); err != nil {
|
| ... | ... |
@@ -13,12 +13,12 @@ import ( |
| 13 | 13 |
"github.com/Sirupsen/logrus" |
| 14 | 14 |
) |
| 15 | 15 |
|
| 16 |
-// exclusion return true if the specified pattern is an exclusion |
|
| 16 |
+// exclusion returns true if the specified pattern is an exclusion |
|
| 17 | 17 |
func exclusion(pattern string) bool {
|
| 18 | 18 |
return pattern[0] == '!' |
| 19 | 19 |
} |
| 20 | 20 |
|
| 21 |
-// empty return true if the specified pattern is empty |
|
| 21 |
+// empty returns true if the specified pattern is empty |
|
| 22 | 22 |
func empty(pattern string) bool {
|
| 23 | 23 |
return pattern == "" |
| 24 | 24 |
} |
| ... | ... |
@@ -217,7 +217,7 @@ func regexpMatch(pattern, path string) (bool, error) {
|
| 217 | 217 |
} |
| 218 | 218 |
|
| 219 | 219 |
// CopyFile copies from src to dst until either EOF is reached |
| 220 |
-// on src or an error occurs. It verifies src exists and remove |
|
| 220 |
+// on src or an error occurs. It verifies src exists and removes |
|
| 221 | 221 |
// the dst if it exists. |
| 222 | 222 |
func CopyFile(src, dst string) (int64, error) {
|
| 223 | 223 |
cleanSrc := filepath.Clean(src) |