Documentation ¶
Index ¶
- type Quotas
- type Service
- func (svc *Service) CreateVideo(ctx context.Context, usr *user.User, req *model.CreateRequest) (*model.Video, error)
- func (svc *Service) DeleteVideo(ctx context.Context, usr *user.User, vid string) error
- func (svc *Service) GetQuotas(ctx context.Context, usr *user.User) (*model.UserStats, error)
- func (svc *Service) GetVideo(ctx context.Context, usr *user.User, vid string, resumeUpload bool) (*model.Video, error)
- func (svc *Service) GetVideos(ctx context.Context, usr *user.User) ([]*model.Video, error)
- func (svc *Service) GetVideosByStatus(ctx context.Context, status model.Status) ([]*model.Video, error)
- func (svc *Service) NotifyPartUpload(ctx context.Context, vid string, part *model.Part) error
- func (svc *Service) UpdateVideoStatus(ctx context.Context, vid string, status model.Status) error
- func (svc *Service) UpdateVideoStatusAndMeta(ctx context.Context, vid string, status model.Status, pbMeta []byte) error
- func (svc *Service) WatchVideo(ctx context.Context, usr *user.User, vid string, genURL bool) ([]byte, error)
- type ServiceConfig
- type SessionStore
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is a Video API service. It has two "realms": user-side API and service-side API.
User-side API provides CRUD operations with Video objects for a single user. While service-side API provides handlers for video updates by media processing services.
Besides different API handlers they also differs in authentication approach: user-side only checks for valid user id in jwt cookie, while service-API looks up jwt in Bearer token and checks for valid service role.
In production environment only user-side API should be exposed to public.
func NewService ¶
func NewService(cfg *ServiceConfig) *Service
func (*Service) CreateVideo ¶
func (*Service) DeleteVideo ¶
func (*Service) GetVideosByStatus ¶
func (*Service) NotifyPartUpload ¶
func (*Service) UpdateVideoStatus ¶
func (*Service) UpdateVideoStatusAndMeta ¶
type ServiceConfig ¶
type ServiceConfig struct { Logger *zap.Logger Store Store UploadSessionStore SessionStore WatchSessionStore SessionStore WatchURLPrefix string UploadURLPrefix string Quotas Quotas }
type SessionStore ¶
type SessionStore interface { Set(ctx context.Context, session *session.Session) error Get(ctx context.Context, id string) (*session.Session, error) }
SessionStore stores upload and watch sessions.
type Store ¶
type Store interface { Create(ctx context.Context, vi *model.Video) error Get(ctx context.Context, id string, userID string) (*model.Video, error) GetAll(ctx context.Context, userID string) ([]*model.Video, error) Delete(ctx context.Context, id string, userID string) error Usage(ctx context.Context, userID string) (*model.UserUsage, error) GetListByStatus(ctx context.Context, status model.Status) ([]*model.Video, error) Update(ctx context.Context, vi *model.Video) error UpdateStatus(ctx context.Context, vi *model.Video) error UpdatePart(ctx context.Context, vid string, part *model.Part) error DeleteUploadedParts(ctx context.Context, vid string) error }
Store is used by videoapi service to store Video and Part objects.