Package dev.getelements.elements.rt
Interface IndexContext
- All Known Implementing Classes:
SimpleIndexContext
public interface IndexContext
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
Represents an association between aPath
and theResourceId
to which it points.static interface
The result of theunlinkAsync(Path, Consumer, Consumer)
andunlink(Path)
call. -
Method Summary
Modifier and TypeMethodDescriptiondefault void
link
(ResourceId resourceId, Path destination) Performs the operations oflinkAsync(ResourceId, Path, Consumer, Consumer)
synchronously.void
linkAsync
(ResourceId resourceId, Path destination, Consumer<Void> success, Consumer<Throwable> failure) Links a singleResourceId
to aPath
destination.default void
Performs the operationslinkPathAsync(Path, Path, Consumer, Consumer)
synchronously.void
default List
<IndexContext.Listing> Performs the operations oflistAsync(Path, Consumer, Consumer)
synchronously.void
Fetches aIndexContext.Listing
of allPath
s and assocaitedResourceId
instances which match the providedPath
.default void
start()
Starts thisIndexContext
.default void
stop()
Stops thisIndexContext
.default IndexContext.Unlink
Performs the operations ofunlinkAsync(Path, Consumer, Consumer)
synchronously.void
unlinkAsync
(Path path, Consumer<IndexContext.Unlink> success, Consumer<Throwable> failure) Unlinks the providedPath
and if this is the lastPath
reference to aResourceId
, then the cluster will remove and destroy the associatedResource
.
-
Method Details
-
start
default void start()Starts thisIndexContext
. -
stop
default void stop()Stops thisIndexContext
. -
list
Performs the operations oflistAsync(Path, Consumer, Consumer)
synchronously.- Parameters:
path
- thePath
to match- Returns:
- a
List<IndexContext.Listing>
representing all matchedPath
s
-
listAsync
void listAsync(Path path, Consumer<List<IndexContext.Listing>> success, Consumer<Throwable> failure) Fetches aIndexContext.Listing
of allPath
s and assocaitedResourceId
instances which match the providedPath
. Unlike other methods for linking and unlinking, the providedPath
may be a wildcard as determined byPath.isWildcard()
. The suppliedList
should represent a complete buffering of allIndexContext.Listing
instances matching thePath
.- Parameters:
path
- thePath
to matchsuccess
- aConsumer
which receives an instance ofIndexContext.Listing
failure
- aConsumer
which receives an exception indicating a failure reason.
-
link
Performs the operations oflinkAsync(ResourceId, Path, Consumer, Consumer)
synchronously.- Parameters:
resourceId
- the sourceResourceId
to linkdestination
- thePath
of the destination to link
-
linkAsync
void linkAsync(ResourceId resourceId, Path destination, Consumer<Void> success, Consumer<Throwable> failure) Links a singleResourceId
to aPath
destination.- Parameters:
resourceId
- the sourceResourceId
to linkdestination
- thePath
of the destination to linksuccess
- aConsumer
which will be called on successful completionfailure
- aConsumer
which will be called on a failure
-
linkPath
Performs the operationslinkPathAsync(Path, Path, Consumer, Consumer)
synchronously. -
linkPathAsync
-
unlink
Performs the operations ofunlinkAsync(Path, Consumer, Consumer)
synchronously.- Parameters:
path
- the path to unlink- Returns:
- an
IndexContext.Unlink
representing the result of the operation
-
unlinkAsync
Unlinks the providedPath
and if this is the lastPath
reference to aResourceId
, then the cluster will remove and destroy the associatedResource
. Further details on the operation can be obtained through theIndexContext.Unlink
interface. If the result is a complete removal, then this will have the same end result asResourceContext.destroy(ResourceId)
orResourceContext.destroyAsync(Consumer, Consumer, ResourceId)
.- Parameters:
path
- the path to unlinksuccess
- aConsumer<IndexContext.Unlink>
to receive the successful operationfailure
- aConsumer<Throwable>
to receive an exception if one was generated
-