Documentation ¶
Overview ¶
Package dynamodb package store all the data in a single multi-tenant table:
- OWNER > Album X meta > Album Y meta
- MEDIA (OWNER#SIGNATURE) > #META > LOCATION > MOVE LOCATION > MOVE LOCATION
- MOVE TRANSACTION (...#uniqueID)
Index ¶
- Constants
- type AlbumData
- type AlbumIndexKey
- type MediaData
- type MediaDetailsData
- type MediaLocationData
- type MediaMoveOrderData
- type MediaMoveTransactionData
- type MediaMoveTransactionStatus
- type Rep
- func (r *Rep) CountMedias(folderName string) (int, error)
- func (r *Rep) CreateTableIfNecessary() error
- func (r *Rep) DeleteEmptyAlbum(folderName string) error
- func (r *Rep) DeleteEmptyMoveTransaction(transactionId string) error
- func (r *Rep) FindAlbum(folderName string) (*catalog.Album, error)
- func (r *Rep) FindAllAlbums() ([]*catalog.Album, error)
- func (r *Rep) FindExistingSignatures(signatures []*catalog.MediaSignature) ([]*catalog.MediaSignature, error)
- func (r *Rep) FindFilesToMove(transactionId, pageToken string) ([]*catalog.MovedMedia, string, error)
- func (r *Rep) FindMediaLocations(signature catalog.MediaSignature) ([]*catalog.MediaLocation, error)
- func (r *Rep) FindMediaLocationsSignatures(signatures []*catalog.MediaSignature) ([]*catalog.MediaSignatureAndLocation, error)
- func (r *Rep) FindMedias(folderName string, filter catalog.FindMediaFilter) (*catalog.MediaPage, error)
- func (r *Rep) FindReadyMoveTransactions() ([]*catalog.MoveTransaction, error)
- func (r *Rep) InsertAlbum(album catalog.Album) error
- func (r *Rep) InsertMedias(medias []catalog.CreateMediaRequest) error
- func (r *Rep) UpdateAlbum(album catalog.Album) error
- func (r *Rep) UpdateMedias(filter *catalog.UpdateMediaFilter, newFolderName string) (string, int, error)
- func (r *Rep) UpdateMediasLocation(transactionId string, moves []*catalog.MovedMedia) error
- type Stream
- type TablePk
Constants ¶
View Source
const (
IsoTime = "2006-01-02T15:04:05"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlbumIndexKey ¶
type MediaData ¶
type MediaData struct { TablePk AlbumIndexKey Type string // Type is either PHOTO or VIDEO DateTime time.Time // DateTime time used in AlbumIndexKey Details MediaDetailsData // Details are other attributes from domain model, stored as it Filename string // Filename is the original filename for display purpose only ; physical filename is in MediaLocationData SignatureSize int SignatureHash string }
type MediaDetailsData ¶
type MediaDetailsData map[string]interface{}
MediaDetailsData is a sub-object ; not stored directly
type MediaLocationData ¶
type MediaLocationData struct { TablePk FolderName string // FolderName is where the media is physically located: its current album folder or previous album if the physical move haven't been flushed yet Filename string // Filename is the physical name of the image SignatureSize int SignatureHash string }
type MediaMoveOrderData ¶
type MediaMoveOrderData struct { TablePk // TablePk.PK is the same than the media, TablePk.SK is the transaction MoveTransaction string // MoveTransaction is a copy of TablePk.SK used by 'MoveOrder' index (thus, only orders are in the index, not transactions) DestinationFolder string // DestinationFolder is the folder name of the album to which media must be moved. }
type MediaMoveTransactionData ¶
type MediaMoveTransactionData struct { TablePk MoveTransactionStatus MediaMoveTransactionStatus // MoveTransactionStatus is false until all media to be moved have a MediaMoveOrderData created and their album updated }
type MediaMoveTransactionStatus ¶
type MediaMoveTransactionStatus string
type Rep ¶
type Rep struct { RootOwner string // RootOwner is the tenant id, 'ROOT' if single tenant. // contains filtered or unexported fields }
func NewRepository ¶
NewRepository creates the repository and connect to the database
func (*Rep) CreateTableIfNecessary ¶
CreateTableIfNecessary creates the table if it doesn't exists ; or update it.
func (*Rep) DeleteEmptyAlbum ¶
func (*Rep) DeleteEmptyMoveTransaction ¶
func (*Rep) FindExistingSignatures ¶
func (r *Rep) FindExistingSignatures(signatures []*catalog.MediaSignature) ([]*catalog.MediaSignature, error)
func (*Rep) FindFilesToMove ¶
func (r *Rep) FindFilesToMove(transactionId, pageToken string) ([]*catalog.MovedMedia, string, error)
FindFilesToMove returns a page of media to move (25 like a write batch of dynamodb) and the next page token
func (*Rep) FindMediaLocations ¶
func (r *Rep) FindMediaLocations(signature catalog.MediaSignature) ([]*catalog.MediaLocation, error)
func (*Rep) FindMediaLocationsSignatures ¶
func (r *Rep) FindMediaLocationsSignatures(signatures []*catalog.MediaSignature) ([]*catalog.MediaSignatureAndLocation, error)
func (*Rep) FindMedias ¶
func (*Rep) FindReadyMoveTransactions ¶
func (r *Rep) FindReadyMoveTransactions() ([]*catalog.MoveTransaction, error)
func (*Rep) InsertMedias ¶
func (r *Rep) InsertMedias(medias []catalog.CreateMediaRequest) error
func (*Rep) UpdateMedias ¶
func (*Rep) UpdateMediasLocation ¶
func (r *Rep) UpdateMediasLocation(transactionId string, moves []*catalog.MovedMedia) error
type Stream ¶
type Stream interface { HasNext() bool // HasNext returns true if it has another element Next() map[string]*dynamodb.AttributeValue // Next return current element and move forward the cursor Error() error // Error returns the error that interrupted the Stream Count() int64 // Count return the number of element found so far }
Stream is inspired from Java streams to chain transformations in a functional programming style
func NewArrayStream ¶
func NewArrayStream(results []map[string]*dynamodb.AttributeValue) Stream
func NewGetStream ¶
func NewQueryStream ¶
func NewQueryStream(rep *Rep, queries []*dynamodb.QueryInput) Stream
Click to show internal directories.
Click to hide internal directories.