Updates documentation to follow godoc conventions

This commit is contained in:
Brian Bland 2014-10-29 12:14:19 -07:00
parent ca0084fad1
commit 0e5d41ff9b
9 changed files with 84 additions and 64 deletions

View file

@ -10,7 +10,7 @@ import (
"github.com/docker/libchan"
)
// Defines a remote method call request
// Request defines a remote method call request
// A return value struct is to be sent over the ResponseChannel
type Request struct {
Type string
@ -18,8 +18,9 @@ type Request struct {
ResponseChannel libchan.Sender
}
// A simple wrapper around an io.ReadCloser that implements the io.ReadWriteCloser interface
// Writes are disallowed and will return an error if ever called
// noWriteReadWriteCloser is a simple wrapper around an io.ReadCloser that implements the
// io.ReadWriteCloser interface
// Calls to Write are disallowed and will return an error
type noWriteReadWriteCloser struct {
io.ReadCloser
}
@ -28,7 +29,7 @@ func (r noWriteReadWriteCloser) Write(p []byte) (n int, err error) {
return 0, errors.New("Write unsupported")
}
// Wraps an io.Reader as an io.ReadWriteCloser with a nop Close and unsupported Write method
// WrapReader wraps an io.Reader as an io.ReadWriteCloser with a nop Close and unsupported Write
// Has no effect when an io.ReadWriteCloser is passed in
func WrapReader(reader io.Reader) io.ReadWriteCloser {
if readWriteCloser, ok := reader.(io.ReadWriteCloser); ok {
@ -45,7 +46,7 @@ type responseError struct {
Message string
}
// Wraps an error in a serializable struct containing the error's type and message
// ResponseError wraps an error in a serializable struct containing the error's type and message
func ResponseError(err error) *responseError {
if err == nil {
return nil
@ -62,35 +63,35 @@ func (err *responseError) Error() string {
// IPC method call response object definitions
// Response for a ReadStream request
// ReadStreamResponse is a response for a ReadStream request
type ReadStreamResponse struct {
Reader io.ReadWriteCloser
Error *responseError
}
// Response for a WriteStream request
// WriteStreamResponse is a response for a WriteStream request
type WriteStreamResponse struct {
Error *responseError
}
// Response for a ResumeWritePosition request
// ResumeWritePositionResponse is a response for a ResumeWritePosition request
type ResumeWritePositionResponse struct {
Position uint64
Error *responseError
}
// Response for a List request
// ListResponse is a response for a List request
type ListResponse struct {
Keys []string
Error *responseError
}
// Response for a Move request
// MoveResponse is a response for a Move request
type MoveResponse struct {
Error *responseError
}
// Response for a Delete request
// DeleteResponse is a response for a Delete request
type DeleteResponse struct {
Error *responseError
}