Documentation ¶
Index ¶
- type AlbumReCounter
- type AlbumSize
- type AlbumSizeDiff
- type AlbumSizeInMemoryRepository
- func (r *AlbumSizeInMemoryRepository) DeleteAlbumSize(ctx context.Context, availability Availability, albumId catalog.AlbumId) error
- func (r *AlbumSizeInMemoryRepository) GetAlbumSizes(ctx context.Context, userId usermodel.UserId, owner ...ownermodel.Owner) ([]UserAlbumSize, error)
- func (r *AlbumSizeInMemoryRepository) GetAvailabilitiesByUser(ctx context.Context, userId usermodel.UserId) ([]UserAlbumSize, error)
- func (r *AlbumSizeInMemoryRepository) InsertAlbumSize(ctx context.Context, albumSize []MultiUserAlbumSize) error
- func (r *AlbumSizeInMemoryRepository) UpdateAlbumSize(ctx context.Context, albumCountUpdates []AlbumSizeDiff) error
- type AlbumView
- type Availability
- type CommandHandlerAlbumSize
- func (c *CommandHandlerAlbumSize) AlbumShared(ctx context.Context, albumId catalog.AlbumId, userId usermodel.UserId) error
- func (c *CommandHandlerAlbumSize) AlbumUnShared(ctx context.Context, albumId catalog.AlbumId, userId usermodel.UserId) error
- func (c *CommandHandlerAlbumSize) OnMediasInserted(ctx context.Context, medias map[catalog.AlbumId][]catalog.MediaId) error
- func (c *CommandHandlerAlbumSize) OnTransferredMedias(ctx context.Context, transfers catalog.TransferredMedias) error
- type DeleteAlbumSizePort
- type Drift
- type DriftDetector
- type DriftObserver
- type DriftOption
- type DriftSynchronizerObserver
- type DriftSynchronizerPort
- type FindAlbumByOwnerFunc
- type FindAlbumByOwnerPort
- type FindAlbumsByIdsFunc
- type FindAlbumsByIdsPort
- type GetAlbumSharingGridFunc
- type GetAlbumSharingGridPort
- type GetAvailabilitiesByUserPort
- type GetCurrentAlbumSizesPort
- type InsertAlbumSizePort
- type ListAlbumsFilter
- type ListAlbumsProvider
- type ListAlbumsProviderFunc
- type ListUserWhoCanAccessAlbumPort
- type LoggerDriftObserver
- type LoggingInsertAlbumSizeObserver
- type MediaCounterFromView
- type MediaCounterFunc
- type MediaCounterInjector
- type MediaCounterPort
- type MissingOrInvalidDrift
- type MultiUserAlbumSize
- type NotExpectedDrift
- type OwnedAlbumListProvider
- type OwnerDriftReconciler
- type ProviderFactory
- type ProviderFactoryFunc
- type SharedAlbumListProvider
- type SharedWithUserFunc
- type SharedWithUserPort
- type UserAlbumSize
- type ViewWriteRepository
- type VisibleAlbum
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlbumReCounter ¶ added in v1.6.7
type AlbumReCounter struct { ListUserWhoCanAccessAlbumPort ListUserWhoCanAccessAlbumPort MediaCounterPort MediaCounterPort }
func (*AlbumReCounter) ReCountMedias ¶ added in v1.6.7
func (c *AlbumReCounter) ReCountMedias(ctx context.Context, albumIds []catalog.AlbumId, observers ...InsertAlbumSizePort) error
type AlbumSizeDiff ¶ added in v1.6.4
type AlbumSizeDiff struct { AlbumId catalog.AlbumId Users []Availability MediaCountDiff int // MediaCountDiff is the difference between the number of media added, or removed, to the album }
type AlbumSizeInMemoryRepository ¶ added in v1.6.7
type AlbumSizeInMemoryRepository struct {
Sizes []UserAlbumSize
}
func (*AlbumSizeInMemoryRepository) DeleteAlbumSize ¶ added in v1.6.7
func (r *AlbumSizeInMemoryRepository) DeleteAlbumSize(ctx context.Context, availability Availability, albumId catalog.AlbumId) error
func (*AlbumSizeInMemoryRepository) GetAlbumSizes ¶ added in v1.6.7
func (r *AlbumSizeInMemoryRepository) GetAlbumSizes(ctx context.Context, userId usermodel.UserId, owner ...ownermodel.Owner) ([]UserAlbumSize, error)
func (*AlbumSizeInMemoryRepository) GetAvailabilitiesByUser ¶ added in v1.6.7
func (r *AlbumSizeInMemoryRepository) GetAvailabilitiesByUser(ctx context.Context, userId usermodel.UserId) ([]UserAlbumSize, error)
func (*AlbumSizeInMemoryRepository) InsertAlbumSize ¶ added in v1.6.7
func (r *AlbumSizeInMemoryRepository) InsertAlbumSize(ctx context.Context, albumSize []MultiUserAlbumSize) error
func (*AlbumSizeInMemoryRepository) UpdateAlbumSize ¶ added in v1.6.7
func (r *AlbumSizeInMemoryRepository) UpdateAlbumSize(ctx context.Context, albumCountUpdates []AlbumSizeDiff) error
type AlbumView ¶
type AlbumView struct {
Providers []ListAlbumsProvider
}
func NewAlbumView ¶ added in v1.5.49
func NewAlbumView( FindAlbumByOwnerPort FindAlbumByOwnerPort, GetAlbumSharingGridPort GetAlbumSharingGridPort, FindAlbumsByIdsPort FindAlbumsByIdsPort, SharedWithUserPort SharedWithUserPort, GetAvailabilitiesByUserPort GetAvailabilitiesByUserPort, ) *AlbumView
func (*AlbumView) ListAlbums ¶
func (v *AlbumView) ListAlbums(ctx context.Context, user usermodel.CurrentUser, filter ListAlbumsFilter) ([]*VisibleAlbum, error)
ListAlbums returns albums visible by the user (owned by current user, and shared to him)
type Availability ¶ added in v1.6.4
type Availability struct { UserId usermodel.UserId AsOwner bool // AsOwner is true if the user is the owner of the album }
func OwnerAvailability ¶ added in v1.6.4
func OwnerAvailability(userId usermodel.UserId) Availability
func VisitorAvailability ¶ added in v1.6.4
func VisitorAvailability(userId usermodel.UserId) Availability
func (Availability) String ¶ added in v1.6.7
func (a Availability) String() string
type CommandHandlerAlbumSize ¶ added in v1.6.4
type CommandHandlerAlbumSize struct { MediaCounterPort MediaCounterPort ListUserWhoCanAccessAlbumPort ListUserWhoCanAccessAlbumPort ViewWriteRepository ViewWriteRepository }
func (*CommandHandlerAlbumSize) AlbumShared ¶ added in v1.6.4
func (*CommandHandlerAlbumSize) AlbumUnShared ¶ added in v1.6.4
func (*CommandHandlerAlbumSize) OnMediasInserted ¶ added in v1.6.4
func (*CommandHandlerAlbumSize) OnTransferredMedias ¶ added in v1.6.4
func (c *CommandHandlerAlbumSize) OnTransferredMedias(ctx context.Context, transfers catalog.TransferredMedias) error
type DeleteAlbumSizePort ¶ added in v1.6.7
type Drift ¶ added in v1.6.7
type Drift struct { Expected *MissingOrInvalidDrift // Expected is exclusive from NotExpected, they can not be set together NotExpected *NotExpectedDrift // NotExpected is exclusive from Expected, they can not be set together }
func NewMissingDrift ¶ added in v1.6.7
func NewMissingDrift(size UserAlbumSize) Drift
func NewNotExpectedDrift ¶ added in v1.6.7
func NewNotExpectedDrift(availability Availability, albumId catalog.AlbumId) Drift
func NewOverrideDrift ¶ added in v1.6.7
func NewOverrideDrift(size UserAlbumSize) Drift
type DriftDetector ¶ added in v1.6.7
type DriftDetector struct { GetCurrentAlbumSizesPort GetCurrentAlbumSizesPort DriftObservers []DriftObserver }
func (*DriftDetector) InsertAlbumSize ¶ added in v1.6.7
func (d *DriftDetector) InsertAlbumSize(ctx context.Context, sizes []MultiUserAlbumSize) error
type DriftObserver ¶ added in v1.6.7
type DriftOption ¶ added in v1.6.7
type DriftOption struct {
// contains filtered or unexported fields
}
func DriftOptionDryMode ¶ added in v1.6.7
func DriftOptionDryMode(dry bool, synchronizer DriftSynchronizerPort) DriftOption
DriftOptionDryMode enable or not the DRY mode.
func DriftOptionObserver ¶ added in v1.6.7
func DriftOptionObserver(observer DriftObserver) DriftOption
DriftOptionObserver adds a custom observer.
func DriftOptionSynchronizer ¶ added in v1.6.7
func DriftOptionSynchronizer(synchronizer DriftSynchronizerPort) DriftOption
func (*DriftOption) Observer ¶ added in v1.6.7
func (o *DriftOption) Observer() DriftObserver
type DriftSynchronizerObserver ¶ added in v1.6.7
type DriftSynchronizerObserver struct {
DriftSynchronizerPort DriftSynchronizerPort
}
func (*DriftSynchronizerObserver) OnDetectedDrifts ¶ added in v1.6.7
func (d *DriftSynchronizerObserver) OnDetectedDrifts(ctx context.Context, drifts []Drift) error
type DriftSynchronizerPort ¶ added in v1.6.7
type DriftSynchronizerPort interface { InsertAlbumSizePort DeleteAlbumSizePort }
type FindAlbumByOwnerFunc ¶ added in v1.5.49
type FindAlbumByOwnerFunc func(ctx context.Context, owner ownermodel.Owner) ([]*catalog.Album, error)
func (FindAlbumByOwnerFunc) FindAlbumsByOwner ¶ added in v1.5.49
func (f FindAlbumByOwnerFunc) FindAlbumsByOwner(ctx context.Context, owner ownermodel.Owner) ([]*catalog.Album, error)
type FindAlbumByOwnerPort ¶
type FindAlbumsByIdsFunc ¶ added in v1.5.49
func (FindAlbumsByIdsFunc) FindAlbumsById ¶ added in v1.5.49
type FindAlbumsByIdsPort ¶
type GetAlbumSharingGridFunc ¶ added in v1.5.49
type GetAlbumSharingGridFunc func(ctx context.Context, owner ownermodel.Owner) (map[catalog.AlbumId][]usermodel.UserId, error)
func (GetAlbumSharingGridFunc) GetAlbumSharingGrid ¶ added in v1.5.49
func (f GetAlbumSharingGridFunc) GetAlbumSharingGrid(ctx context.Context, owner ownermodel.Owner) (map[catalog.AlbumId][]usermodel.UserId, error)
type GetAlbumSharingGridPort ¶ added in v1.5.49
type GetAvailabilitiesByUserPort ¶ added in v1.6.4
type GetCurrentAlbumSizesPort ¶ added in v1.6.7
type GetCurrentAlbumSizesPort interface {
GetAlbumSizes(ctx context.Context, userId usermodel.UserId, owner ...ownermodel.Owner) ([]UserAlbumSize, error)
}
type InsertAlbumSizePort ¶ added in v1.6.7
type InsertAlbumSizePort interface {
InsertAlbumSize(ctx context.Context, albumSize []MultiUserAlbumSize) error
}
type ListAlbumsFilter ¶
type ListAlbumsFilter struct {
OnlyDirectlyOwned bool // OnlyDirectlyOwned provides a sub-view where only resources directly owned by user are displayed and accessible
}
type ListAlbumsProvider ¶ added in v1.5.49
type ListAlbumsProvider interface {
ListAlbums(ctx context.Context, user usermodel.CurrentUser, filter ListAlbumsFilter) ([]*VisibleAlbum, error)
}
type ListAlbumsProviderFunc ¶ added in v1.5.49
type ListAlbumsProviderFunc func(ctx context.Context, user usermodel.CurrentUser, filter ListAlbumsFilter) ([]*VisibleAlbum, error)
func (ListAlbumsProviderFunc) ListAlbums ¶ added in v1.5.49
func (f ListAlbumsProviderFunc) ListAlbums(ctx context.Context, user usermodel.CurrentUser, filter ListAlbumsFilter) ([]*VisibleAlbum, error)
type ListUserWhoCanAccessAlbumPort ¶ added in v1.6.4
type LoggerDriftObserver ¶ added in v1.6.7
type LoggerDriftObserver struct{}
func (LoggerDriftObserver) OnDetectedDrifts ¶ added in v1.6.7
func (l LoggerDriftObserver) OnDetectedDrifts(ctx context.Context, drifts []Drift) error
type LoggingInsertAlbumSizeObserver ¶ added in v1.6.7
type LoggingInsertAlbumSizeObserver struct { }
func (*LoggingInsertAlbumSizeObserver) InsertAlbumSize ¶ added in v1.6.7
func (l *LoggingInsertAlbumSizeObserver) InsertAlbumSize(ctx context.Context, albumSizes []MultiUserAlbumSize) error
type MediaCounterFromView ¶ added in v1.6.4
type MediaCounterFromView struct {
AlbumSizes []AlbumSize
}
type MediaCounterFunc ¶ added in v1.5.50
type MediaCounterInjector ¶ added in v1.6.4
type MediaCounterInjector struct { GetAvailabilitiesByUserPort GetAvailabilitiesByUserPort ProviderFactories []ProviderFactory }
MediaCounterInjector is covering the function while the view only contains some of the data (the counts)
func (*MediaCounterInjector) ListAlbums ¶ added in v1.6.4
func (o *MediaCounterInjector) ListAlbums(ctx context.Context, user usermodel.CurrentUser, filter ListAlbumsFilter) ([]*VisibleAlbum, error)
type MediaCounterPort ¶ added in v1.5.50
type MissingOrInvalidDrift ¶ added in v1.6.7
type MissingOrInvalidDrift struct { AvailableAlbumSize UserAlbumSize Missing bool }
type MultiUserAlbumSize ¶ added in v1.6.7
type MultiUserAlbumSize struct { AlbumSize Users []Availability }
func (MultiUserAlbumSize) String ¶ added in v1.6.7
func (a MultiUserAlbumSize) String() string
type NotExpectedDrift ¶ added in v1.6.7
type NotExpectedDrift struct { Availability Availability AlbumId catalog.AlbumId }
type OwnedAlbumListProvider ¶ added in v1.5.49
type OwnedAlbumListProvider struct { FindAlbumByOwnerPort FindAlbumByOwnerPort GetAlbumSharingGridPort GetAlbumSharingGridPort MediaCounterPort MediaCounterPort }
func (*OwnedAlbumListProvider) ListAlbums ¶ added in v1.5.49
func (o *OwnedAlbumListProvider) ListAlbums(ctx context.Context, user usermodel.CurrentUser, filter ListAlbumsFilter) ([]*VisibleAlbum, error)
type OwnerDriftReconciler ¶ added in v1.6.7
type OwnerDriftReconciler struct { FindAlbumByOwnerPort FindAlbumByOwnerPort GetCurrentAlbumSizesPort GetCurrentAlbumSizesPort AlbumReCounter AlbumReCounter DriftDetector *DriftDetector }
func NewDriftReconciler ¶ added in v1.6.7
func NewDriftReconciler( findAlbumByOwnerPort FindAlbumByOwnerPort, getCurrentAlbumSizesPort GetCurrentAlbumSizesPort, listUserWhoCanAccessAlbumPort ListUserWhoCanAccessAlbumPort, mediaCounterPort MediaCounterPort, DriftObservers ...DriftOption, ) *OwnerDriftReconciler
NewDriftReconciler creates a new DriftReconciler in DRY mode ; use the option DriftOptionSynchronizer to reconcile.
func (*OwnerDriftReconciler) Reconcile ¶ added in v1.6.7
func (d *OwnerDriftReconciler) Reconcile(ctx context.Context, owner ownermodel.Owner) error
Reconcile is re-computing counts for each album
type ProviderFactory ¶ added in v1.6.4
type ProviderFactory interface {
NewProvider(ctx context.Context, mediaCounterPort MediaCounterPort) ListAlbumsProvider
}
type ProviderFactoryFunc ¶ added in v1.6.4
type ProviderFactoryFunc func(ctx context.Context, mediaCounterPort MediaCounterPort) ListAlbumsProvider
func (ProviderFactoryFunc) NewProvider ¶ added in v1.6.4
func (f ProviderFactoryFunc) NewProvider(ctx context.Context, mediaCounterPort MediaCounterPort) ListAlbumsProvider
type SharedAlbumListProvider ¶ added in v1.5.49
type SharedAlbumListProvider struct {}
func (*SharedAlbumListProvider) ListAlbums ¶ added in v1.5.49
func (s *SharedAlbumListProvider) ListAlbums(ctx context.Context, user usermodel.CurrentUser, filter ListAlbumsFilter) ([]*VisibleAlbum, error)
type SharedWithUserFunc ¶ added in v1.5.49
type SharedWithUserFunc func(ctx context.Context, userId usermodel.UserId) ([]catalog.AlbumId, error)
func (SharedWithUserFunc) ListAlbumIdsSharedWithUser ¶ added in v1.5.49
type SharedWithUserPort ¶
type SharedWithUserPort interface {
}type UserAlbumSize ¶ added in v1.6.7
type UserAlbumSize struct { AlbumSize AlbumSize Availability Availability }
func (UserAlbumSize) ToMultiUser ¶ added in v1.6.7
func (s UserAlbumSize) ToMultiUser() MultiUserAlbumSize
type ViewWriteRepository ¶ added in v1.6.4
type ViewWriteRepository interface { InsertAlbumSizePort DeleteAlbumSizePort UpdateAlbumSize(ctx context.Context, albumCountUpdates []AlbumSizeDiff) error }
type VisibleAlbum ¶
type VisibleAlbum struct { catalog.Album MediaCount int // MediaCount is the number of medias on the album Visitors []usermodel.UserId // Visitors are the users that can see the album ; only visible to the owner of the album OwnedByCurrentUser bool // OwnedByCurrentUser is set to true when the user is an owner of the album }
Click to show internal directories.
Click to hide internal directories.