A ScriptNotFoundError indicates that the requested script file does not exist. (It typically wraps a "stat" error for the script file.)
type ScriptNotFoundError struct {
// contains filtered or unexported fields
}
func (e ScriptNotFoundError) Error() string
func (e ScriptNotFoundError) Unwrap() error
A Server serves cached, dynamically-generated version control repositories.
type Server struct {
// contains filtered or unexported fields
}
func NewServer(scriptDir, workDir string, logger *log.Logger) (*Server, error)
NewServer returns a Server that generates and serves repositories in workDir using the scripts found in scriptDir and its subdirectories.
A request for the path /foo/bar/baz will be handled by the first script along that path that exists: $scriptDir/foo.txt, $scriptDir/foo/bar.txt, or $scriptDir/foo/bar/baz.txt.
func (s *Server) Close() error
func (s *Server) HandleScript(scriptRelPath string, logger *log.Logger, f func(http.Handler)) error
HandleScript ensures that the script at scriptRelPath has been evaluated with its current contents.
If the script completed successfully, HandleScript invokes f on the handler with the script's result still read-locked, and waits for it to return. (That ensures that cache invalidation does not race with an in-flight handler.)
Otherwise, HandleScript returns the (cached) error from executing the script.
func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request)
ServeHTTP implements http.Handler for version-control repositories.
A ServerNotInstalledError indicates that the server binary required for the indicated VCS does not exist.
type ServerNotInstalledError struct {
// contains filtered or unexported fields
}
func (v ServerNotInstalledError) Error() string
Name | Synopsis |
---|---|
.. |