Class ObjectStorageAttachmentDataFileSystem
- java.lang.Object
-
- com.atlassian.confluence.impl.pages.attachments.filesystem.ObjectStorageAttachmentDataFileSystem
-
- All Implemented Interfaces:
AttachmentDataFileSystem,AttachmentDataFileSystemInternals
public class ObjectStorageAttachmentDataFileSystem extends Object implements AttachmentDataFileSystem, AttachmentDataFileSystemInternals
An implementation ofAttachmentDataFileSystemwhich stores the attachment data in an object storage service (for example S3), using theFileStore.PathAPI.
-
-
Constructor Summary
Constructors Constructor Description ObjectStorageAttachmentDataFileSystem(com.atlassian.dc.filestore.api.FileStore.Path path)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.atlassian.dc.filestore.api.compat.FilesystemPathcontainerPathForAttachmentVersions(long attachmentId, long containerId, Long spaceId)booleandataExistsForAttachment(AttachmentRef attachment)Indicates whether the filesystem contains data for the given attachmentvoiddeleteAllAttachmentVersions(AttachmentRef attachment, AttachmentRef.Container contentEntity)Delete all data corresponding to all versions of the given attachmentvoiddeleteSingleAttachmentVersion(AttachmentRef attachment, AttachmentRef.Container contentEntity)Delete the data corresponding to a single attachment versionvoiddeleteSingleAttachmentVersion(AttachmentRef attachment, AttachmentRef.Container contentEntity, AttachmentDataStreamType dataStreamType)Delete the data of the specified stream type corresponding to a single attachment versionAttachmentDataStreamgetAttachmentData(AttachmentRef attachment, AttachmentDataStreamType dataStreamType)Fetches the data for a given attachment version and data stream typeAttachmentDataStreamgetAttachmentData(AttachmentRef attachment, AttachmentDataStreamType dataStreamType, Optional<RangeRequest> range)Fetches the specified range of data for a given attachment version and data stream typeAttachmentDataFilegetAttachmentDataFile(long attachmentId, Long containerId, Long spaceId, Integer attachmentVersion, AttachmentDataStreamType dataStreamType)com.atlassian.dc.filestore.api.compat.FilesystemPathgetPathForSpace(Long spaceId)voidmoveAttachment(AttachmentRef oldAttachment, AttachmentRef newAttachment, AttachmentRef.Container newContentEntity)Move all data relating to one attachment to a new directory corresponding to the given new attachment and content entity.voidmoveAttachments(AttachmentRef.Container contentEntity, AttachmentRef.Space oldSpace, AttachmentRef.Space newSpace)Move all data for all versions of all attachments corresponding to the given content entity in the given space, to the same entity in a different space.voidmoveDataForAttachmentVersion(AttachmentRef sourceAttachmentVersion, AttachmentRef targetAttachmentVersion)Move the data associated with one attachment version, to being associated with a different attachment versionvoidprepareForMigrationTo()Prepare the data store for a migration from another type of data store.booleansaveAttachmentData(AttachmentRef attachment, AttachmentDataStream dataStream, boolean overwrite, org.springframework.util.unit.DataSize expectedFileSize)Save new data corresponding to the given attachment.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.atlassian.confluence.impl.pages.attachments.filesystem.AttachmentDataFileSystemInternals
containerDirectoryForAttachmentVersions, getDirectoryForSpace
-
-
-
-
Method Detail
-
dataExistsForAttachment
public boolean dataExistsForAttachment(AttachmentRef attachment)
Description copied from interface:AttachmentDataFileSystemIndicates whether the filesystem contains data for the given attachment- Specified by:
dataExistsForAttachmentin interfaceAttachmentDataFileSystem
-
moveAttachment
public void moveAttachment(AttachmentRef oldAttachment, AttachmentRef newAttachment, AttachmentRef.Container newContentEntity)
Description copied from interface:AttachmentDataFileSystemMove all data relating to one attachment to a new directory corresponding to the given new attachment and content entity.- Specified by:
moveAttachmentin interfaceAttachmentDataFileSystem- Parameters:
oldAttachment- The attachment whose data is to be movednewAttachment- The attachment to which the data should be moved tonewContentEntity- The content entity corresponding to the new attachment
-
saveAttachmentData
public boolean saveAttachmentData(AttachmentRef attachment, AttachmentDataStream dataStream, boolean overwrite, org.springframework.util.unit.DataSize expectedFileSize)
Description copied from interface:AttachmentDataFileSystemSave new data corresponding to the given attachment.- Specified by:
saveAttachmentDatain interfaceAttachmentDataFileSystem- Parameters:
attachment- The attachment to which the data should be associateddataStream- The new dataoverwrite- If true, any existing data will be overwritten. If false, does nothing if data already exists.expectedFileSize- The expected size of the data being written- Returns:
- true if the data was written, false otherwise (e.g. no overwrite)
-
deleteAllAttachmentVersions
public void deleteAllAttachmentVersions(AttachmentRef attachment, AttachmentRef.Container contentEntity)
Description copied from interface:AttachmentDataFileSystemDelete all data corresponding to all versions of the given attachment- Specified by:
deleteAllAttachmentVersionsin interfaceAttachmentDataFileSystem- Parameters:
attachment- the attachment whose data is to be deletedcontentEntity- The content entity associated with the attachment
-
moveDataForAttachmentVersion
public void moveDataForAttachmentVersion(AttachmentRef sourceAttachmentVersion, AttachmentRef targetAttachmentVersion)
Description copied from interface:AttachmentDataFileSystemMove the data associated with one attachment version, to being associated with a different attachment version- Specified by:
moveDataForAttachmentVersionin interfaceAttachmentDataFileSystem- Parameters:
sourceAttachmentVersion- The attachment version containing the datatargetAttachmentVersion- The attachment version to which the data should be moved
-
deleteSingleAttachmentVersion
public void deleteSingleAttachmentVersion(AttachmentRef attachment, AttachmentRef.Container contentEntity)
Description copied from interface:AttachmentDataFileSystemDelete the data corresponding to a single attachment version- Specified by:
deleteSingleAttachmentVersionin interfaceAttachmentDataFileSystem- Parameters:
attachment- The attachment whose data should be deletedcontentEntity- The content entity associated with the attachment
-
deleteSingleAttachmentVersion
public void deleteSingleAttachmentVersion(AttachmentRef attachment, AttachmentRef.Container contentEntity, AttachmentDataStreamType dataStreamType)
Description copied from interface:AttachmentDataFileSystemDelete the data of the specified stream type corresponding to a single attachment version- Specified by:
deleteSingleAttachmentVersionin interfaceAttachmentDataFileSystem- Parameters:
attachment- The attachment whose data should be deletedcontentEntity- The content entity associated with the attachmentdataStreamType- The attachment stream type
-
getAttachmentData
@Nullable public AttachmentDataStream getAttachmentData(AttachmentRef attachment, AttachmentDataStreamType dataStreamType)
Description copied from interface:AttachmentDataFileSystemFetches the data for a given attachment version and data stream type- Specified by:
getAttachmentDatain interfaceAttachmentDataFileSystem- Parameters:
attachment- The attachment version for which the data is to be fetcheddataStreamType- The type of the data stream to be fetched- Returns:
- The
AttachmentDataStreamcontaining the result
-
getAttachmentData
@Nullable public AttachmentDataStream getAttachmentData(AttachmentRef attachment, AttachmentDataStreamType dataStreamType, Optional<RangeRequest> range)
Description copied from interface:AttachmentDataFileSystemFetches the specified range of data for a given attachment version and data stream type- Specified by:
getAttachmentDatain interfaceAttachmentDataFileSystem- Parameters:
attachment- The attachment version for which the data is to be fetcheddataStreamType- The type of the data stream to be fetchedrange- The range of the data stream to be fetched- Returns:
- The
AttachmentDataStreamcontaining the result
-
moveAttachments
public void moveAttachments(AttachmentRef.Container contentEntity, AttachmentRef.Space oldSpace, AttachmentRef.Space newSpace)
Description copied from interface:AttachmentDataFileSystemMove all data for all versions of all attachments corresponding to the given content entity in the given space, to the same entity in a different space.- Specified by:
moveAttachmentsin interfaceAttachmentDataFileSystem- Parameters:
contentEntity- The content entity whose attachment data is to be movedoldSpace- The original space of the content entitynewSpace- The new space of the content entity
-
prepareForMigrationTo
public void prepareForMigrationTo()
Description copied from interface:AttachmentDataFileSystemPrepare the data store for a migration from another type of data store.- Specified by:
prepareForMigrationToin interfaceAttachmentDataFileSystem
-
containerPathForAttachmentVersions
@Nullable public com.atlassian.dc.filestore.api.compat.FilesystemPath containerPathForAttachmentVersions(long attachmentId, long containerId, @Nullable Long spaceId)- Specified by:
containerPathForAttachmentVersionsin interfaceAttachmentDataFileSystemInternals
-
getAttachmentDataFile
@Nullable public AttachmentDataFile getAttachmentDataFile(long attachmentId, @Nullable Long containerId, @Nullable Long spaceId, Integer attachmentVersion, AttachmentDataStreamType dataStreamType)
- Specified by:
getAttachmentDataFilein interfaceAttachmentDataFileSystemInternals
-
getPathForSpace
@Nullable public com.atlassian.dc.filestore.api.compat.FilesystemPath getPathForSpace(@Nullable Long spaceId)- Specified by:
getPathForSpacein interfaceAttachmentDataFileSystemInternals
-
-