Class S3ProxyAccessProvider
java.lang.Object
ch.tocco.nice2.persist.s3storage.impl.S3ProxyAccessProvider
- All Implemented Interfaces:
BinaryAccessProvider
Proxy implementation of
BinaryAccessProvider
which forwards all requests
to different S3AccessProvider
.
This is used during development: Instead of copying an entire bucket, the existing bucket is available
for read requests only. All write operations will be executed on the 'overlay' bucket.-
Field Summary
-
Constructor Summary
ConstructorDescriptionS3ProxyAccessProvider
(org.slf4j.Logger logger, BinaryHashingService binaryHashingService, MainS3Configuration mainConfiguration, OverlayS3Configuration overlayConfiguration) -
Method Summary
Modifier and TypeMethodDescriptionSet
<com.google.common.hash.HashCode> findUnreferencedBinaries
(Connection connection, @Nullable Integer limit) loadBinary
(com.google.common.hash.HashCode hashCode, long size, String mimeType, String fileExtension) create aBinary
instance without executing an sql query, this method should be used if the data from _nice_binary has already been loaded.loadBinary
(com.google.common.hash.HashCode hashCode, Connection connection) load an object from the storeboolean
removeBinary
(com.google.common.hash.HashCode hashCode, Connection connection) remove a binary from storagecom.google.common.hash.HashCode
storeBinary
(Binary binary, Connection connection) save an object into the store
-
Field Details
-
mainProvider
-
overlayProvider
-
-
Constructor Details
-
S3ProxyAccessProvider
public S3ProxyAccessProvider(org.slf4j.Logger logger, BinaryHashingService binaryHashingService, MainS3Configuration mainConfiguration, OverlayS3Configuration overlayConfiguration)
-
-
Method Details
-
loadBinary
Description copied from interface:BinaryAccessProvider
load an object from the store- Specified by:
loadBinary
in interfaceBinaryAccessProvider
- Parameters:
hashCode
- hash/id of the file to loadconnection
-Connection
to use for database operations- Returns:
- the object
-
loadBinary
public Binary loadBinary(com.google.common.hash.HashCode hashCode, long size, String mimeType, String fileExtension) Description copied from interface:BinaryAccessProvider
create aBinary
instance without executing an sql query, this method should be used if the data from _nice_binary has already been loaded.- Specified by:
loadBinary
in interfaceBinaryAccessProvider
-
storeBinary
Description copied from interface:BinaryAccessProvider
save an object into the store- Specified by:
storeBinary
in interfaceBinaryAccessProvider
- Parameters:
binary
- the object to saveconnection
-Connection
to use for database operations- Returns:
- the hash/id of the saved object
-
removeBinary
Description copied from interface:BinaryAccessProvider
remove a binary from storage- Specified by:
removeBinary
in interfaceBinaryAccessProvider
- Parameters:
hashCode
- the hash of the object to removeconnection
-Connection
to use for database operations
-
findUnreferencedBinaries
public Set<com.google.common.hash.HashCode> findUnreferencedBinaries(Connection connection, @Nullable @Nullable Integer limit) - Specified by:
findUnreferencedBinaries
in interfaceBinaryAccessProvider
- Returns:
- all binary hashes that are no longer referenced and may be removed
-