Documentation
¶
Overview ¶
Package server implements the server HTTP interface for the UI, publishing, setup, status, sync, thubnailing, etc.
#fileembed pattern .+\.(ico)$
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrCacheMiss = errors.New("not in cache")
var Files = &fileembed.Files{}
Functions ¶
This section is empty.
Types ¶
type DownloadHandler ¶
type DownloadHandler struct {
Fetcher blobref.StreamingFetcher
Cache blobserver.Storage
ForceMime string // optional
}
func (*DownloadHandler) ServeHTTP ¶
func (dh *DownloadHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request, file *blobref.BlobRef)
type FileTreeHandler ¶
type FileTreeHandler struct {
Fetcher blobref.StreamingFetcher
// contains filtered or unexported fields
}
func (*FileTreeHandler) ServeHTTP ¶
func (fth *FileTreeHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)
type ImageHandler ¶
type ImageHandler struct {
Fetcher blobref.StreamingFetcher
Cache blobserver.Storage // optional
MaxWidth, MaxHeight int
Square bool
// contains filtered or unexported fields
}
func (*ImageHandler) ServeHTTP ¶
func (ih *ImageHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request, file *blobref.BlobRef)
type PublishHandler ¶
type PublishHandler struct {
RootName string
Search *search.Handler
Storage blobserver.Storage // of blobRoot
Cache blobserver.Storage // or nil
JSFiles, CSSFiles []string
// contains filtered or unexported fields
}
PublishHandler publishes your info to the world, if permanodes have appropriate ACLs set. (everything is private by default)
func (*PublishHandler) NewRequest ¶
func (ph *PublishHandler) NewRequest(rw http.ResponseWriter, req *http.Request) *publishRequest
func (*PublishHandler) ServeHTTP ¶
func (ph *PublishHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)
func (*PublishHandler) ViewerIsOwner ¶
func (ph *PublishHandler) ViewerIsOwner(req *http.Request) bool
type RootHandler ¶
type RootHandler struct {
// Stealth determines whether we hide from non-authenticated
// clients.
Stealth bool
OwnerName string // for display purposes only
// URL prefixes (path or full URL) to the primary blob and
// search root.
BlobRoot string
SearchRoot string
Storage blobserver.Storage // of BlobRoot, or nil
// contains filtered or unexported fields
}
RootHandler handles serving the about/splash page.
func (*RootHandler) SearchHandler ¶
func (rh *RootHandler) SearchHandler() (h *search.Handler, ok bool)
func (*RootHandler) ServeHTTP ¶
func (rh *RootHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)
type ScaledImage ¶
type ScaledImage interface {
Get(key string) (*blobref.BlobRef, error) // returns ErrCacheMiss when item not in cache
Put(key string, br *blobref.BlobRef) error
}
ScaledImage is a mapping between the blobref of an image and its scaling parameters, and the blobref of such a rescaled version of that image. Key will be some string containing the original full-sized image's blobref, its target dimensions, and any possible transformations on it (e.g. cropping it to square). This string packing should not be parsed by a ScaledImage implementation and is not guaranteed to be stable over time.
type ScaledImageLRU ¶
type ScaledImageLRU struct {
// contains filtered or unexported fields
}
func NewScaledImageLRU ¶
func NewScaledImageLRU() *ScaledImageLRU
type SetupHandler ¶
type SetupHandler struct {
// contains filtered or unexported fields
}
SetupHandler handles serving the wizard setup page.
func (*SetupHandler) ServeHTTP ¶
func (sh *SetupHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)
type StatusHandler ¶
type StatusHandler struct {
}
StatusHandler publishes server status information.
func (*StatusHandler) ServeHTTP ¶
func (sh *StatusHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)
type SyncHandler ¶
type SyncHandler struct {
// contains filtered or unexported fields
}
TODO: rate control + tunable TODO: expose copierPoolSize as tunable
func (*SyncHandler) ServeHTTP ¶
func (sh *SyncHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)
type UIHandler ¶
type UIHandler struct {
// JSONSignRoot is the optional path or full URL to the JSON
// Signing helper. Only used by the UI and thus necessary if
// UI is true.
// TODO(bradfitz): also move this up to the root handler,
// if we start having clients (like phones) that we want to upload
// but don't trust to have private signing keys?
JSONSignRoot string
PublishRoots map[string]*PublishHandler
Cache blobserver.Storage // or nil
// contains filtered or unexported fields
}
UIHandler handles serving the UI and discovery JSON.