Documentation
¶
Index ¶
- Constants
- Variables
- type ChangeFileState
- type Store
- func (store *Store) AreAllBundleFilesPublished(ctx context.Context, bundleID string) (bool, error)
- func (store *Store) AreAllCollectionFilesPublished(ctx context.Context, collectionID string) (bool, error)
- func (store *Store) BatchSendBundleKafkaMessages(ctx context.Context, cursor mongodriver.Cursor, wg *sync.WaitGroup, ...)
- func (store *Store) BatchSendCollectionKafkaMessages(ctx context.Context, cursor mongodriver.Cursor, wg *sync.WaitGroup, ...)
- func (store *Store) CreateFileEvent(ctx context.Context, event *files.FileEvent) error
- func (store *Store) GetBundlePublishedMetadata(ctx context.Context, id string) (files.StoredBundle, error)
- func (store *Store) GetCollectionPublishedMetadata(ctx context.Context, id string) (files.StoredCollection, error)
- func (store *Store) GetFileEvents(ctx context.Context, limit, offset int, path string, after, before *time.Time) (*files.EventsList, error)
- func (store *Store) GetFileMetadata(ctx context.Context, path string) (files.StoredRegisteredMetaData, error)
- func (store *Store) GetFilesMetadata(ctx context.Context, collectionID, bundleID string) ([]files.StoredRegisteredMetaData, error)
- func (store *Store) IsBundleEmpty(ctx context.Context, bundleID string) (bool, error)
- func (store *Store) IsBundlePublished(ctx context.Context, bundleID string) (bool, error)
- func (store *Store) IsBundleUploaded(ctx context.Context, bundleID string) (bool, error)
- func (store *Store) IsCollectionEmpty(ctx context.Context, collectionID string) (bool, error)
- func (store *Store) IsCollectionPublished(ctx context.Context, collectionID string) (bool, error)
- func (store *Store) IsCollectionUploaded(ctx context.Context, collectionID string) (bool, error)
- func (store *Store) MarkBundlePublished(ctx context.Context, bundleID string) error
- func (store *Store) MarkCollectionPublished(ctx context.Context, collectionID string) error
- func (store *Store) MarkFileMoved(ctx context.Context, metaData files.FileEtagChange) error
- func (store *Store) MarkFilePublished(ctx context.Context, path string) error
- func (store *Store) MarkUploadComplete(ctx context.Context, metaData files.FileEtagChange) error
- func (store *Store) NotifyBundlePublished(ctx context.Context, bundleID string)
- func (store *Store) NotifyCollectionPublished(ctx context.Context, collectionID string)
- func (store *Store) PatchFilePublishBundleMetadata(metadata *files.StoredRegisteredMetaData, bundle *files.StoredBundle)
- func (store *Store) PatchFilePublishMetadata(metadata *files.StoredRegisteredMetaData, collection *files.StoredCollection)
- func (store *Store) RegisterFileUpload(ctx context.Context, metaData files.StoredRegisteredMetaData) error
- func (store *Store) RemoveFile(ctx context.Context, path string) error
- func (store *Store) UpdateBundleID(ctx context.Context, path, bundleID string) error
- func (store *Store) UpdateCollectionID(ctx context.Context, path, collectionID string) error
Constants ¶
const ( StateCreated = "CREATED" StateUploaded = "UPLOADED" StatePublished = "PUBLISHED" StateMoved = "MOVED" )
Variables ¶
var ( ErrDuplicateFile = errors.New("duplicate file path") ErrFileNotRegistered = errors.New("file not registered") ErrFileNotInCreatedState = errors.New("file state is not in state created") ErrFileNotInUploadedState = errors.New("file state is not in state uploaded") ErrFileStateMismatch = errors.New("file state mismatch") ErrFileIsNotPublishable = errors.New("file is not set as publishable") ErrNoFilesInCollection = errors.New("no files found in collection") ErrNoFilesInBundle = errors.New("no files found in bundle") ErrCollectionIDAlreadySet = errors.New("collection ID already set") ErrCollectionIDNotSet = errors.New("collection ID not set") ErrCollectionAlreadyPublished = errors.New("collection with the given id is already published") ErrBundleAlreadyPublished = errors.New("bundle with the given id is already published") ErrCollectionMetadataNotRegistered = errors.New("collection metadata not registered") ErrBundleMetadataNotRegistered = errors.New("bundle metadata not registered") ErrEtagMismatchWhilePublishing = errors.New("etag mismatch") ErrBundleIDAlreadySet = errors.New("bundle ID already set") ErrBothCollectionAndBundleIDSet = errors.New("cannot set both collection and bundle ID") ErrFileMoved = errors.New("record cannot be updated as the file is MOVED") ErrFileIsPublished = errors.New("cannot delete file as it is already published") ErrPathNotFound = errors.New("the requested resource does not exist") ErrInvalidPagination = errors.New("unable to process request due to a malformed or invalid request body or query parameter") )
Functions ¶
This section is empty.
Types ¶
type ChangeFileState ¶ added in v1.4.0
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) AreAllBundleFilesPublished ¶ added in v1.8.0
func (*Store) AreAllCollectionFilesPublished ¶ added in v1.8.0
func (*Store) BatchSendBundleKafkaMessages ¶ added in v1.8.0
func (*Store) BatchSendCollectionKafkaMessages ¶ added in v1.8.0
func (*Store) CreateFileEvent ¶ added in v1.13.0
CreateFileEvent inserts a new file event into the file_events collection
func (*Store) GetBundlePublishedMetadata ¶ added in v1.8.0
func (*Store) GetCollectionPublishedMetadata ¶ added in v1.3.0
func (*Store) GetFileEvents ¶ added in v1.13.0
func (store *Store) GetFileEvents(ctx context.Context, limit, offset int, path string, after, before *time.Time) (*files.EventsList, error)
GetFileEvents retrieves file events with optional filters and pagination
func (*Store) GetFileMetadata ¶
func (*Store) GetFilesMetadata ¶
func (store *Store) GetFilesMetadata(ctx context.Context, collectionID, bundleID string) ([]files.StoredRegisteredMetaData, error)
GetFilesMetadata godoc @Description GETs metadata for a file @Tags File upload started @Produce json @Success 200 @Failure 400 @Failure 403 @Failure 404 @Failure 500 @Router /files [get]
func (*Store) IsBundleEmpty ¶ added in v1.8.0
func (*Store) IsBundlePublished ¶ added in v1.8.0
func (*Store) IsBundleUploaded ¶ added in v1.8.0
func (*Store) IsCollectionEmpty ¶ added in v1.2.0
func (*Store) IsCollectionPublished ¶ added in v1.3.0
func (*Store) IsCollectionUploaded ¶ added in v1.2.0
func (*Store) MarkBundlePublished ¶ added in v1.8.0
func (*Store) MarkCollectionPublished ¶
GetFilesMetadata godoc @Description PATCH metadata state for a file, (i.e. when an upload has completed). @Tags Patch metadata state @Produce json @Param file_path path string true "Filepath of required file" @Param patch_file body ChangeFileState true "Change the state of a file in the metadata" @Success 201 @Failure 400 @Failure 403 @Failure 409 @Failure 500 @Router /files/{filepath} [patch]
func (*Store) MarkFileMoved ¶ added in v1.3.0
func (*Store) MarkFilePublished ¶
func (*Store) MarkUploadComplete ¶
func (*Store) NotifyBundlePublished ¶ added in v1.8.0
func (*Store) NotifyCollectionPublished ¶ added in v1.2.0
func (*Store) PatchFilePublishBundleMetadata ¶ added in v1.8.0
func (store *Store) PatchFilePublishBundleMetadata(metadata *files.StoredRegisteredMetaData, bundle *files.StoredBundle)
For the optimisation purposes, we store the bundle publishing information in a separate DB collection. This makes the bundle publishing instantaneous by removing a need to update the publish state of all the files in the bundle, which takes a very long time for large bundles. Because of this, we need to patch the file metadata in a specific case documented below.
func (*Store) PatchFilePublishMetadata ¶ added in v1.3.0
func (store *Store) PatchFilePublishMetadata(metadata *files.StoredRegisteredMetaData, collection *files.StoredCollection)
For the optimisation purposes, we store the Florence collection publishing information in a separate DB collection. This makes the collection publishing instantaneous by removing a need to update the publish state of all the files in the collection, which takes a very long time for large collections. Because of this, we need to patch the file metadata in a specific case documented below.
func (*Store) RegisterFileUpload ¶
func (store *Store) RegisterFileUpload(ctx context.Context, metaData files.StoredRegisteredMetaData) error
GetFilesMetadata godoc @Description POSTs metadata for a file when an upload has started. @Tags File upload started @Produce json @Param request formData files.StoredRegisteredMetaData false "StoredRegisteredMetaData" @Success 200 @Failure 400 @Failure 403 @Failure 404 @Failure 500 @Router /files [post]