Package dev.getelements.elements.rt
Interface IndexContext
- All Known Implementing Classes:
SimpleIndexContext
public interface IndexContext
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRepresents an association between aPathand theResourceIdto which it points.static interfaceThe result of theunlinkAsync(Path, Consumer, Consumer)andunlink(Path)call. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidlink(ResourceId resourceId, Path destination) Performs the operations oflinkAsync(ResourceId, Path, Consumer, Consumer)synchronously.voidlinkAsync(ResourceId resourceId, Path destination, Consumer<Void> success, Consumer<Throwable> failure) Links a singleResourceIdto aPathdestination.default voidPerforms the operationslinkPathAsync(Path, Path, Consumer, Consumer)synchronously.voiddefault List<IndexContext.Listing> Performs the operations oflistAsync(Path, Consumer, Consumer)synchronously.voidFetches aIndexContext.Listingof allPaths and assocaitedResourceIdinstances which match the providedPath.default voidstart()Starts thisIndexContext.default voidstop()Stops thisIndexContext.default IndexContext.UnlinkPerforms the operations ofunlinkAsync(Path, Consumer, Consumer)synchronously.voidunlinkAsync(Path path, Consumer<IndexContext.Unlink> success, Consumer<Throwable> failure) Unlinks the providedPathand if this is the lastPathreference 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- thePathto match- Returns:
- a
List<IndexContext.Listing>representing all matchedPaths
-
listAsync
void listAsync(Path path, Consumer<List<IndexContext.Listing>> success, Consumer<Throwable> failure) Fetches aIndexContext.Listingof allPaths and assocaitedResourceIdinstances which match the providedPath. Unlike other methods for linking and unlinking, the providedPathmay be a wildcard as determined byPath.isWildcard(). The suppliedListshould represent a complete buffering of allIndexContext.Listinginstances matching thePath.- Parameters:
path- thePathto matchsuccess- aConsumerwhich receives an instance ofIndexContext.Listingfailure- aConsumerwhich receives an exception indicating a failure reason.
-
link
Performs the operations oflinkAsync(ResourceId, Path, Consumer, Consumer)synchronously.- Parameters:
resourceId- the sourceResourceIdto linkdestination- thePathof the destination to link
-
linkAsync
void linkAsync(ResourceId resourceId, Path destination, Consumer<Void> success, Consumer<Throwable> failure) Links a singleResourceIdto aPathdestination.- Parameters:
resourceId- the sourceResourceIdto linkdestination- thePathof the destination to linksuccess- aConsumerwhich will be called on successful completionfailure- aConsumerwhich 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.Unlinkrepresenting the result of the operation
-
unlinkAsync
Unlinks the providedPathand if this is the lastPathreference to aResourceId, then the cluster will remove and destroy the associatedResource. Further details on the operation can be obtained through theIndexContext.Unlinkinterface. 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
-