Documentation
¶
Index ¶
- Constants
- type ActiveRemoteRequests
- type ActiveThumbnailGeneration
- type Base64Hash
- type ContentType
- type FileSizeBytes
- type Filename
- type MatrixUserID
- type MediaID
- type MediaMetadata
- type Path
- type RemoteRequestResult
- type RequestMethod
- type ThumbnailGenerationResult
- type ThumbnailMetadata
- type ThumbnailSize
Constants ¶
const Crop = "crop"
Crop indicates we should crop the thumbnail on resize
const Scale = "scale"
Scale indicates we should scale the thumbnail on resize
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActiveRemoteRequests ¶
type ActiveRemoteRequests struct {
sync.Mutex
// The string key is an mxc:// URL
MXCToResult map[string]*RemoteRequestResult
}
ActiveRemoteRequests is a lockable map of media URIs requested from remote homeservers It is used for ensuring multiple requests for the same file do not clobber each other.
type ActiveThumbnailGeneration ¶
type ActiveThumbnailGeneration struct {
sync.Mutex
// The string key is a thumbnail file path
PathToResult map[string]*ThumbnailGenerationResult
}
ActiveThumbnailGeneration is a lockable map of file paths being thumbnailed It is used to ensure thumbnails are only generated once.
type Base64Hash ¶
type Base64Hash string
Base64Hash is a base64 URLEncoding string representation of a SHA-256 hash sum
type ContentType ¶
type ContentType string
ContentType is an HTTP Content-Type header string representing the MIME type of a request body
type MatrixUserID ¶
type MatrixUserID string
MatrixUserID is a Matrix user ID string in the form @user:domain e.g. @alice:matrix.org
type MediaID ¶
type MediaID string
MediaID is a string representing the unique identifier for a file (could be a hash but does not have to be)
type MediaMetadata ¶
type MediaMetadata struct {
MediaID MediaID
Origin spec.ServerName
ContentType ContentType
FileSizeBytes FileSizeBytes
CreationTimestamp spec.Timestamp
UploadName Filename
Base64Hash Base64Hash
UserID MatrixUserID
}
MediaMetadata is metadata associated with a media file
type RemoteRequestResult ¶
type RemoteRequestResult struct {
// Condition used for the requester to signal the result to all other routines waiting on this condition
Cond *sync.Cond
// MediaMetadata of the requested file to avoid querying the database for every waiting routine
MediaMetadata *MediaMetadata
// An error, nil in case of no error.
Error error
}
RemoteRequestResult is used for broadcasting the result of a request for a remote file to routines waiting on the condition
type RequestMethod ¶
type RequestMethod string
RequestMethod is an HTTP request method i.e. GET, POST, etc
type ThumbnailGenerationResult ¶
type ThumbnailGenerationResult struct {
// Condition used for the generator to signal the result to all other routines waiting on this condition
Cond *sync.Cond
// Resulting error from the generation attempt
Err error
}
ThumbnailGenerationResult is used for broadcasting the result of thumbnail generation to routines waiting on the condition
type ThumbnailMetadata ¶
type ThumbnailMetadata struct {
MediaMetadata *MediaMetadata
ThumbnailSize ThumbnailSize
}
ThumbnailMetadata contains the metadata about an individual thumbnail
type ThumbnailSize ¶
type ThumbnailSize config.ThumbnailSize
ThumbnailSize contains a single thumbnail size configuration