public interface MementoService
Resource
s may be made and retrieved using this service.
Mementos may also be recorded by other means, including by the persistence layer independently of Trellis, but unless
they are retrieved via this service, Trellis will not publish them as HTTP resources. Mementos of NonRDFSources (like
any other Resource
) may also be made and retrieved here, but the associated InputStream
s are
made (like all binary InputStream
s) via a BinaryService
implementation.Modifier and Type | Method and Description |
---|---|
CompletionStage<Resource> |
get(IRI identifier,
Instant time)
Fetch a Memento resource for the given time.
|
CompletionStage<SortedSet<Instant>> |
mementos(IRI identifier)
Get the times for all of the Mementos of the given resource.
|
CompletionStage<Void> |
put(Resource resource)
Create a new Memento for a resource.
|
default CompletionStage<Void> |
put(ResourceService resourceService,
IRI identifier)
Create a new Memento for a resource, retrieved from a
ResourceService . |
default CompletionStage<Void> put(ResourceService resourceService, IRI identifier)
ResourceService
.resourceService
- the resource service.identifier
- the identifier.ResourceService
that is
external to the Memento service., An implementation may choose to store a new Memento only when this method is called,
or at other times as well, e.g. when ResourceService.replace(org.trellisldp.api.Metadata, org.apache.commons.rdf.api.Dataset)
is called.Resource
from the persistence layer, in which case this method can be
overridden as a no-op method, e.g. return completedFuture(null);
.CompletionStage<Void> put(Resource resource)
resource
- the resourceCompletionStage
will complete exceptionally and can be handled with
CompletionStage.handle(java.util.function.BiFunction<? super T, java.lang.Throwable, ? extends U>)
, CompletionStage.exceptionally(java.util.function.Function<java.lang.Throwable, ? extends T>)
or similar methods.CompletionStage<Resource> get(IRI identifier, Instant time)
identifier
- the resource identifiertime
- the requested timeCompletionStage<SortedSet<Instant>> mementos(IRI identifier)
identifier
- the resource identifier