Documentation
¶
Index ¶
Constants ¶
View Source
const ( GuestLinkIDLength = 16 GuestLinkByteLimitMinimum = 1024 * 1024 )
View Source
const EntryIDLength = 10
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Authenticator ¶
type Authenticator interface {
StartSession(w http.ResponseWriter, r *http.Request)
ClearSession(w http.ResponseWriter)
Authenticate(r *http.Request) bool
}
type EntryPostResponse ¶
type EntryPostResponse struct {
ID string `json:"id"`
}
type GuestLinkPostResponse ¶
type GuestLinkPostResponse struct {
ID string `json:"id"`
}
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func New ¶
func New(authenticator Authenticator, store Store, spaceChecker SpaceChecker, collector *garbagecollect.Collector, clock Clock) Server
New creates a new server with all the state it needs to satisfy HTTP requests.
type SpaceChecker ¶
type Store ¶
type Store interface {
GetEntriesMetadata() ([]picoshare.UploadMetadata, error)
ReadEntryFile(picoshare.EntryID) (io.ReadSeeker, error)
GetEntryMetadata(id picoshare.EntryID) (picoshare.UploadMetadata, error)
InsertEntry(reader io.Reader, metadata picoshare.UploadMetadata) error
UpdateEntryMetadata(id picoshare.EntryID, metadata picoshare.UploadMetadata) error
DeleteEntry(id picoshare.EntryID) error
GetGuestLink(picoshare.GuestLinkID) (picoshare.GuestLink, error)
GetGuestLinks() ([]picoshare.GuestLink, error)
InsertGuestLink(picoshare.GuestLink) error
DeleteGuestLink(picoshare.GuestLinkID) error
DisableGuestLink(picoshare.GuestLinkID) error
EnableGuestLink(picoshare.GuestLinkID) error
InsertEntryDownload(picoshare.EntryID, picoshare.DownloadRecord) error
GetEntryDownloads(id picoshare.EntryID) ([]picoshare.DownloadRecord, error)
ReadSettings() (picoshare.Settings, error)
UpdateSettings(picoshare.Settings) error
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.