Package com.exedio.cope.vault
Interface VaultService
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
VaultFileService,VaultReferenceService
Implementations of VaultService must conform to the requirements set by
Properties.valueService.
It is highly recommended to override toString with a informative message
containing essential configuration of the service.
For instance, this message is included into the result of ConnectProperties.probe().
All methods are guaranteed not to be called for the empty byte sequence - this special case must be handled by the caller.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()Overrides method fromAutoCloseableto add empty default implementation.byte[]voidget(String hash, OutputStream sink) longdefault voidpurgeSchema(JobContext ctx) Gives this service the chance to purge / cleanup whatever it needs to.booleanput(String hash, byte[] value, VaultPutInfo info) Is not called, if service instance was created withVaultServiceParameters.isWritable()==false.booleanput(String hash, InputStream value, VaultPutInfo info) Is not called, if service instance was created withVaultServiceParameters.isWritable()==false.booleanput(String hash, Path value, VaultPutInfo info) The caller must make sure, thatvalueis not modified during the call.
-
Method Details
-
purgeSchema
Gives this service the chance to purge / cleanup whatever it needs to. Is called byModel.purgeSchema(JobContext). The default implementation does nothing. -
close
default void close()Overrides method fromAutoCloseableto add empty default implementation. Also requires implementations not to declare any checked exception to be thrown.- Specified by:
closein interfaceAutoCloseable
-
getLength
- Throws:
VaultNotFoundException
-
get
- Throws:
VaultNotFoundException
-
get
void get(@Nonnull String hash, @Nonnull OutputStream sink) throws VaultNotFoundException, IOException Must notcloseorflushsink.If this method throws a
VaultNotFoundException, it MUST not have modifiedsinkin any way. In particular it must not have written any byte tosink.- Throws:
VaultNotFoundExceptionIOException
-
put
Is not called, if service instance was created withVaultServiceParameters.isWritable()==false.- Returns:
trueifhashhas been initially stored in the vault by this call. The result is used for statistics only. If the implementation does not have this information available, simply returntrue.
-
put
boolean put(@Nonnull String hash, @Nonnull InputStream value, @Nonnull VaultPutInfo info) throws IOException Is not called, if service instance was created withVaultServiceParameters.isWritable()==false.- Returns:
trueifhashhas been initially stored in the vault by this call. The result is used for statistics only. If the implementation does not have this information available, simply returntrue.- Throws:
IOException
-
put
boolean put(@Nonnull String hash, @Nonnull Path value, @Nonnull VaultPutInfo info) throws IOException The caller must make sure, thatvalueis not modified during the call. Is not called, if service instance was created withVaultServiceParameters.isWritable()==false.- Returns:
trueifhashhas been initially stored in the vault by this call. The result is used for statistics only. If the implementation does not have this information available, simply returntrue.- Throws:
IOException
-