Skip to content

Commit 0f45c1c

Browse files
committed
improve Handler interface documentation
Include list of request.Methods each is used to handle.
1 parent 1073df2 commit 0f45c1c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

request-interfaces.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@ import (
88
// Interfaces are differentiated based on required returned values.
99
// All input arguments are to be pulled from Request (the only arg).
1010

11+
// The Handler interfaces all take the Request object as its only argument.
12+
// All the data you should need to handle the call are in the Request object.
13+
// The request.Method attribute is initially the most important one as it
14+
// determines which Handler gets called.
15+
1116
// FileReader should return an io.ReaderAt for the filepath
1217
// Note in cases of an error, the error text will be sent to the client.
18+
// Called for Methods: Get
1319
type FileReader interface {
1420
Fileread(*Request) (io.ReaderAt, error)
1521
}
@@ -19,18 +25,21 @@ type FileReader interface {
1925
// The request server code will call Close() on the returned io.WriterAt
2026
// ojbect if an io.Closer type assertion succeeds.
2127
// Note in cases of an error, the error text will be sent to the client.
28+
// Called for Methods: Put, Open
2229
type FileWriter interface {
2330
Filewrite(*Request) (io.WriterAt, error)
2431
}
2532

2633
// FileCmder should return an error
2734
// Note in cases of an error, the error text will be sent to the client.
35+
// Called for Methods: Setstat, Rename, Rmdir, Mkdir, Symlink, Remove
2836
type FileCmder interface {
2937
Filecmd(*Request) error
3038
}
3139

3240
// FileLister should return an object that fulfils the ListerAt interface
3341
// Note in cases of an error, the error text will be sent to the client.
42+
// Called for Methods: List, Stat, Readlink
3443
type FileLister interface {
3544
Filelist(*Request) (ListerAt, error)
3645
}

0 commit comments

Comments
 (0)