Documentation ¶
Index ¶
- Variables
- func BusySleep(duration time.Duration)
- func DoesFileExist(path string) (bool, error)
- func GetListenerPort(listener net.Listener) (int, error)
- func GetRandUint64() (uint64, error)
- func IsDir(path string) (bool, error)
- func ListenWebSocket(port uint, logger *log.Logger) chan *WebSocket
- func NewDefaultLogger() (*log.Logger, error)
- func NewLogger(loggerOptions LoggerOptions) (*log.Logger, error)
- func NewPrefixLogger(prefix string) (*log.Logger, error)
- func ParseJsonFile(path string, object interface{}) error
- func PostJson(host string, port uint, object interface{}) (*http.Response, error)
- func StartServer(port uint, logger *log.Logger) (chan JsonRequest, error)
- func WriteJsonFile(path string, object interface{}) error
- type JsonRequest
- type LoggerOptions
- type Node
- type WebSocket
- type ZeroReader
Constants ¶
This section is empty.
Variables ¶
var (
ErrIrregularFileFound = errors.New("filetree contains an irregular file")
)
Functions ¶
func DoesFileExist ¶
func GetRandUint64 ¶
func ListenWebSocket ¶
Starts one goroutine to listen for sockets. Starts one goroutine to handle each socket. Exits when Complete is called.
You can receive and use sockets concurrently.
func NewDefaultLogger ¶
func NewLogger ¶
func NewLogger(loggerOptions LoggerOptions) (*log.Logger, error)
Logger can be used concurrently.
func ParseJsonFile ¶
func StartServer ¶
func StartServer(port uint, logger *log.Logger) (chan JsonRequest, error)
Starts one goroutine to listen for requests. Starts a goroutine to handle each request. Exits when Complete is called.
You can receive requests concurrently. You can complete requests concurrently and in any order.
func WriteJsonFile ¶
Types ¶
type JsonRequest ¶
type JsonRequest struct { Json interface{} Response http.ResponseWriter // contains filtered or unexported fields }
func (JsonRequest) Complete ¶
func (jsonRequest JsonRequest) Complete()
func (JsonRequest) RespondJson ¶
func (jsonRequest JsonRequest) RespondJson(object interface{}) error
type LoggerOptions ¶
type Node ¶
type Node struct { // Go's os package represents filenames as strings, // so we assume that all OSes can convert their filenames // to Go strings. Name *string Data []byte Children []*Node }
The wire representation of a filetree: UTF-8 encoded JSON. File names are Unicode and UTF-8 encoded. File contents are byte streams which are base64 encoded and UTF-8 encoded. Go's json.Marshal already does this, but you can implement an en/decoder in any language.
func ConvertFilesToNode ¶
type ZeroReader ¶
type ZeroReader struct{}