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 void
close()
Overrides method fromAutoCloseable
to add empty default implementation.byte[]
void
get
(String hash, OutputStream sink) long
default void
purgeSchema
(JobContext ctx) Gives this service the chance to purge / cleanup whatever it needs to.boolean
put
(String hash, byte[] value, VaultPutInfo info) Is not called, if service instance was created withVaultServiceParameters.isWritable()
==false.boolean
put
(String hash, InputStream value, VaultPutInfo info) Is not called, if service instance was created withVaultServiceParameters.isWritable()
==false.boolean
put
(String hash, Path value, VaultPutInfo info) The caller must make sure, thatvalue
is 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 fromAutoCloseable
to add empty default implementation. Also requires implementations not to declare any checked exception to be thrown.- Specified by:
close
in interfaceAutoCloseable
-
getLength
- Throws:
VaultNotFoundException
-
get
- Throws:
VaultNotFoundException
-
get
void get(@Nonnull String hash, @Nonnull OutputStream sink) throws VaultNotFoundException, IOException Must notclose
orflush
sink
.If this method throws a
VaultNotFoundException
, it MUST not have modifiedsink
in any way. In particular it must not have written any byte tosink
.- Throws:
VaultNotFoundException
IOException
-
put
Is not called, if service instance was created withVaultServiceParameters.isWritable()
==false.- Returns:
true
ifhash
has 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:
true
ifhash
has 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, thatvalue
is not modified during the call. Is not called, if service instance was created withVaultServiceParameters.isWritable()
==false.- Returns:
true
ifhash
has 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
-