Class SegmentPreloader

    • Method Detail

      • decorate

        @NotNull
        public static @NotNull PersistentCache decorate​(@NotNull
                                                        @NotNull PersistentCache delegate,
                                                        @NotNull
                                                        @NotNull PersistentCachePreloadingConfiguration config,
                                                        @NotNull
                                                        @NotNull Supplier<TarFiles> tarFiles)
        Factory method that decorates the given PersistentCache with a SegmentPreloader if the given configuration requires preloading. Otherwise, the given delegate is returned as-is.
        Parameters:
        delegate - the cache to decorate
        config - the preloading configuration
        tarFiles - a supplier of the TarFiles instance used to read segments and segment graphs
        Returns:
        the decorated cache or the given delegate if no preloading is configured
      • readSegment

        @Nullable
        public @Nullable Buffer readSegment​(long msb,
                                            long lsb,
                                            @NotNull
                                            @NotNull Callable<Buffer> loader)
        Description copied from interface: PersistentCache
        Reads the segment from cache.
        Specified by:
        readSegment in interface PersistentCache
        Overrides:
        readSegment in class DelegatingPersistentCache
        Parameters:
        msb - the most significant bits of the identifier of the segment
        lsb - the least significant bits of the identifier of the segment
        loader - in case of cache miss, with loader.call() missing element will be retrieved
        Returns:
        byte buffer containing the segment data or null if the segment doesn't exist