camlistore.org: camlistore.org/pkg/server Index | Files | Directories

package server

import "camlistore.org/pkg/server"

Package server implements the server HTTP interface for the UI, publishing, setup, status, sync, thubnailing, etc.

#fileembed pattern .+\.(ico)$

Index

Package Files

cgo_probe.go doc.go download.go fileembed.go filetree.go help.go image.go root.go root_normal.go share.go status.go sync.go thumbcache.go ui.go uploadhelper.go wizard-html.go wizard.go

Variables

var Files = &fileembed.Files{}

func ServeStaticFile Uses

func ServeStaticFile(rw http.ResponseWriter, req *http.Request, root http.FileSystem, file string)

ServeStaticFile serves file from the root virtual filesystem.

type DownloadHandler Uses

type DownloadHandler struct {
    Fetcher blob.Fetcher

    // Search is optional. If present, it's used to map a fileref
    // to a wholeref, if the Fetcher is of a type that knows how
    // to get at a wholeref more efficiently. (e.g. blobpacked)
    Search *search.Handler

    ForceMIME string // optional
    // contains filtered or unexported fields
}

func (*DownloadHandler) ServeFile Uses

func (dh *DownloadHandler) ServeFile(w http.ResponseWriter, r *http.Request, file blob.Ref)

func (*DownloadHandler) ServeHTTP Uses

func (dh *DownloadHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP answers the following queries:

POST:

?files=sha1-foo,sha1-bar,sha1-baz

Creates a zip archive of the provided files and serves it in the response.

GET:

/<file-schema-blobref>

Serves the file described by the requested file schema blobref.

type FileTreeHandler Uses

type FileTreeHandler struct {
    Fetcher blob.Fetcher
    // contains filtered or unexported fields
}

func (*FileTreeHandler) ServeHTTP Uses

func (fth *FileTreeHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type FileTreeNode Uses

type FileTreeNode struct {
    // Name is the basename of the node.
    Name string `json:"name"`
    // Type is the camliType of the node. This may be "file", "directory", "symlink"
    // or other in the future.
    Type string `json:"type"`
    // BlobRef is the blob.Ref of the node.
    BlobRef blob.Ref `json:"blobRef"`
}

FileTreeNode represents a file in a file tree. It is part of the FileTreeResponse.

type FileTreeResponse Uses

type FileTreeResponse struct {
    // Children is the list of children files of a directory.
    Children []FileTreeNode `json:"children"`
}

FileTreeResponse is the JSON response for the FileTreeHandler.

type HelpHandler Uses

type HelpHandler struct {
    // contains filtered or unexported fields
}

HelpHandler publishes information related to accessing the server

func (*HelpHandler) InitHandler Uses

func (hh *HelpHandler) InitHandler(hl blobserver.FindHandlerByTyper) error

func (*HelpHandler) ServeHTTP Uses

func (hh *HelpHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)

func (*HelpHandler) SetServerConfig Uses

func (hh *HelpHandler) SetServerConfig(config jsonconfig.Obj)

SetServerConfig enables the handler to receive the server config before InitHandler, which generates a client config from the server config, is called.

type ImageHandler Uses

type ImageHandler struct {
    Fetcher             blob.Fetcher
    Search              *search.Handler    // optional
    Cache               blobserver.Storage // optional
    MaxWidth, MaxHeight int
    Square              bool
    ThumbMeta           *ThumbMeta    // optional cache index for scaled images
    ResizeSem           *syncutil.Sem // Limit peak RAM used by concurrent image thumbnail calls.
}

func (*ImageHandler) ServeHTTP Uses

func (ih *ImageHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request, file blob.Ref)

type RootHandler Uses

type RootHandler struct {
    // Stealth determines whether we hide from non-authenticated
    // clients.
    Stealth bool

    OwnerName string // for display purposes only.
    Username  string // default user for mobile setup.

    // URL prefixes (path or full URL) to the primary blob and
    // search root.
    BlobRoot   string
    SearchRoot string

    Prefix string // root handler's prefix

    // JSONSignRoot is the optional path or full URL to the JSON
    // Signing helper.
    JSONSignRoot string

    Storage blobserver.Storage // of BlobRoot, or nil
    // contains filtered or unexported fields
}

RootHandler handles serving the about/splash page.

func (*RootHandler) SearchHandler Uses

func (rh *RootHandler) SearchHandler() (h *search.Handler, ok bool)

func (*RootHandler) ServeHTTP Uses

func (rh *RootHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type SetupHandler Uses

type SetupHandler struct {
    // contains filtered or unexported fields
}

SetupHandler handles serving the wizard setup page.

func (*SetupHandler) ServeHTTP Uses

func (sh *SetupHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type StatusHandler Uses

type StatusHandler struct {
    // contains filtered or unexported fields
}

StatusHandler publishes server status information.

func (*StatusHandler) InitHandler Uses

func (sh *StatusHandler) InitHandler(hl blobserver.FindHandlerByTyper) error

func (*StatusHandler) ServeHTTP Uses

func (sh *StatusHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type SyncHandler Uses

type SyncHandler struct {
    // contains filtered or unexported fields
}

The SyncHandler handles async replication in one direction between a pair storage targets, a source and target.

SyncHandler is a BlobReceiver but doesn't actually store incoming blobs; instead, it records blobs it has received and queues them for async replication soon, or whenever it can.

func NewSyncHandler Uses

func NewSyncHandler(srcName, destName string,
    src blobserver.Storage, dest blobReceiverEnumerator,
    pendingQueue sorted.KeyValue) *SyncHandler

NewSyncHandler returns a handler that will asynchronously and continuously copy blobs from src to dest, if missing on dest. Blobs waiting to be copied are stored on pendingQueue. srcName and destName are only used for status and debugging messages. N.B: blobs should be added to src with a method that notifies the blob hub, such as blobserver.Receive.

func (*SyncHandler) EnumerateBlobs Uses

func (sh *SyncHandler) EnumerateBlobs(ctx context.Context, dest chan<- blob.SizedRef, after string, limit int) error

func (*SyncHandler) Fetch Uses

func (sh *SyncHandler) Fetch(blob.Ref) (file io.ReadCloser, size uint32, err error)

func (*SyncHandler) IdleWait Uses

func (sh *SyncHandler) IdleWait()

IdleWait waits until the sync handler has finished processing the currently queued blobs.

func (*SyncHandler) InitHandler Uses

func (sh *SyncHandler) InitHandler(hl blobserver.FindHandlerByTyper) error

func (*SyncHandler) ReceiveBlob Uses

func (sh *SyncHandler) ReceiveBlob(br blob.Ref, r io.Reader) (sb blob.SizedRef, err error)

func (*SyncHandler) RemoveBlobs Uses

func (sh *SyncHandler) RemoveBlobs(blobs []blob.Ref) error

func (*SyncHandler) ServeHTTP Uses

func (sh *SyncHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)

func (*SyncHandler) StatBlobs Uses

func (sh *SyncHandler) StatBlobs(dest chan<- blob.SizedRef, blobs []blob.Ref) error

func (*SyncHandler) String Uses

func (sh *SyncHandler) String() string

type ThumbMeta Uses

type ThumbMeta struct {
    // contains filtered or unexported fields
}

ThumbMeta is a mapping from an image's scaling parameters (encoding as an opaque "key" string) and the blobref of the thumbnail (currently its file schema blob). ThumbMeta is safe for concurrent use by multiple goroutines.

The 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).

func NewThumbMeta Uses

func NewThumbMeta(kv sorted.KeyValue) *ThumbMeta

NewThumbMeta returns a new in-memory ThumbMeta, backed with the optional kv. If kv is nil, key/value pairs are stored in memory only.

func (*ThumbMeta) Get Uses

func (m *ThumbMeta) Get(key string) (blob.Ref, error)

func (*ThumbMeta) Put Uses

func (m *ThumbMeta) Put(key string, br blob.Ref) error

type UIHandler Uses

type UIHandler struct {

    // Cache optionally specifies a cache blob server, used for
    // caching image thumbnails and other emphemeral data.
    Cache blobserver.Storage // or nil
    // contains filtered or unexported fields
}

UIHandler handles serving the UI and discovery JSON.

func (*UIHandler) InitHandler Uses

func (ui *UIHandler) InitHandler(hl blobserver.FindHandlerByTyper) error

InitHandler goes through all the other configured handlers to discover the publisher ones, and uses them to populate ui.publishRoots.

func (*UIHandler) ServeHTTP Uses

func (ui *UIHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)

Directories

PathSynopsis
appPackage app helps with configuring and starting server applications from Camlistore.

Package server imports 69 packages (graph) and is imported by 43 packages. Updated 2018-01-16. Refresh now. Tools for package owners.

The go get command cannot install this package because of the following issues: