Class S3FileStorePlugin

java.lang.Object
io.vertigo.datastore.plugins.filestore.s3.S3FileStorePlugin
All Implemented Interfaces:
io.vertigo.core.node.component.Activeable, io.vertigo.core.node.component.CoreComponent, io.vertigo.core.node.component.Plugin, io.vertigo.core.node.definition.DefinitionProvider, io.vertigo.core.node.definition.SimpleDefinitionProvider, FileStorePlugin

public final class S3FileStorePlugin extends Object implements FileStorePlugin, io.vertigo.core.node.component.Activeable, io.vertigo.core.node.definition.SimpleDefinitionProvider
Store file data in S3 and metadatas in database.
Author:
skerdudou, xdurand, mlaroche
  • Constructor Details

    • S3FileStorePlugin

      @Inject public S3FileStorePlugin(Optional<String> name, String storeDataDefinitionName, String bucketName, String fileInfoClassName, Optional<Boolean> readOnlyOpt, Optional<Boolean> useTagsOpt, Optional<Integer> purgeDelayMinutesOpt, io.vertigo.commons.transaction.VTransactionManager transactionManager, io.vertigo.connectors.s3.S3Connector s3Connector, io.vertigo.core.analytics.AnalyticsManager analyticsManager)
      Constructor.
      Parameters:
      name - Store name
      purgeDelayMinutesOpt - purge files older than this delay. In S3, if you can, you should use the lifecycle policy to automatically delete old file. But some CSP don't have this feature implemented yet and in that case you should use this algorithmic purge. Also note that this algorithmic purge will perform many API call, so be aware that this purge could incurs extra costs.
      transactionManager - used to stick at Vertigo transaction level
      s3Connector - S3 connector
      analyticsManager - Analytics Manager
      storeDtName - Database entity
      bucket - S3 bucket name
      fileInfoClass - file info class
      readOnly - read only store. Default to false
      useTags - tag state on s3 files (state = uncommited|commited). Default to true. Can hang in some race conditions. Ex: during a transaction, create a file, re-read the same file but do not consume input stream, then commit transaction
  • Method Details

    • start

      public void start()
      Specified by:
      start in interface io.vertigo.core.node.component.Activeable
    • stop

      public void stop()
      Specified by:
      stop in interface io.vertigo.core.node.component.Activeable
    • provideDefinitions

      public List<? extends io.vertigo.core.node.definition.Definition> provideDefinitions(io.vertigo.core.node.definition.DefinitionSpace definitionSpace)
      Specified by:
      provideDefinitions in interface io.vertigo.core.node.definition.SimpleDefinitionProvider
    • deleteOldFiles

      public void deleteOldFiles()
      Call by Daemon to purge old files
    • getName

      public String getName()
      Specified by:
      getName in interface FileStorePlugin
      Returns:
      Store name
    • read

      public FileInfo read(FileInfoURI uri)
      Load a file by its URI.
      Specified by:
      read in interface FileStorePlugin
      Parameters:
      uri - FileURI requested
      Returns:
      FileInfo for this uri (null if not found).
    • create

      public FileInfo create(FileInfo fileInfo)
      Save a file. Input FileInfo must have an empty URI : insert mode
      Specified by:
      create in interface FileStorePlugin
      Parameters:
      fileInfo - File to save (creation)
      Returns:
      the created FileInfo
    • update

      public void update(FileInfo fileInfo)
      Save a file. Input FileInfo must have an URI : update mode
      Specified by:
      update in interface FileStorePlugin
      Parameters:
      fileInfo - File to save (modification)
    • delete

      public void delete(FileInfoURI uri)
      Delete a file.
      Specified by:
      delete in interface FileStorePlugin
      Parameters:
      uri - File's URI to remove
    • getFileInfoClass

      public Class<? extends FileInfo> getFileInfoClass()
      Get's the FileInfo Class that are handled by the particular plugin
      Specified by:
      getFileInfoClass in interface FileStorePlugin
      Returns:
    • checkIo

      public io.vertigo.core.analytics.health.HealthMeasure checkIo()
      Returns:
      HealthMeasure of this plugin