mediaapi/storage: Simplify descriptions

This commit is contained in:
Robert Swain 2017-05-26 17:44:43 +02:00
parent 9678cb6ea1
commit 4f2d9a3b69

View file

@ -23,13 +23,13 @@ import (
"github.com/matrix-org/gomatrixserverlib" "github.com/matrix-org/gomatrixserverlib"
) )
// A Database is used to store metadata about a repository of media files. // Database is used to store metadata about a repository of media files.
type Database struct { type Database struct {
statements statements statements statements
db *sql.DB db *sql.DB
} }
// Open a postgres database. // Open opens a postgres database.
func Open(dataSourceName string) (*Database, error) { func Open(dataSourceName string) (*Database, error) {
var d Database var d Database
var err error var err error
@ -48,8 +48,8 @@ func (d *Database) StoreMediaMetadata(mediaMetadata *types.MediaMetadata) error
return d.statements.insertMedia(mediaMetadata) return d.statements.insertMedia(mediaMetadata)
} }
// GetMediaMetadata returns metadata about media stored on this server. The media could // GetMediaMetadata returns metadata about media stored on this server.
// have been uploaded to this server or fetched from another server and cached here. // The media could have been uploaded to this server or fetched from another server and cached here.
// Returns sql.ErrNoRows if there is no metadata associated with this media. // Returns sql.ErrNoRows if there is no metadata associated with this media.
func (d *Database) GetMediaMetadata(mediaID types.MediaID, mediaOrigin gomatrixserverlib.ServerName) (*types.MediaMetadata, error) { func (d *Database) GetMediaMetadata(mediaID types.MediaID, mediaOrigin gomatrixserverlib.ServerName) (*types.MediaMetadata, error) {
return d.statements.selectMedia(mediaID, mediaOrigin) return d.statements.selectMedia(mediaID, mediaOrigin)