Class GridOffHeapProcessor

    • Constructor Detail

      • GridOffHeapProcessor

        public GridOffHeapProcessor​(GridKernalContext ctx)
        Parameters:
        ctx - Kernal context.
    • Method Detail

      • create

        public void create​(@Nullable
                           @Nullable String spaceName,
                           int parts,
                           long init,
                           long max,
                           @Nullable
                           @Nullable GridOffHeapEvictListener lsnr)
        Creates offheap map for given space name. Previous one will be destructed if it exists.
        Parameters:
        spaceName - Space name.
        parts - Partitions number.
        init - Initial size.
        max - Maximum size.
        lsnr - Eviction listener.
      • destruct

        public void destruct​(@Nullable
                             @Nullable String spaceName)
        Destructs offheap map for given space name.
        Parameters:
        spaceName - Space name.
      • contains

        public boolean contains​(@Nullable
                                @Nullable String spaceName,
                                int part,
                                KeyCacheObject key,
                                byte[] keyBytes)
                         throws IgniteCheckedException
        Checks if offheap space contains value for the given key.
        Parameters:
        spaceName - Space name.
        part - Partition.
        key - Key.
        keyBytes - Key bytes.
        Returns:
        true If offheap space contains value for the given key.
        Throws:
        IgniteCheckedException - If failed.
      • get

        @Nullable
        public @org.jetbrains.annotations.Nullable byte[] get​(@Nullable
                                                              @Nullable String spaceName,
                                                              int part,
                                                              KeyCacheObject key,
                                                              byte[] keyBytes)
                                                       throws IgniteCheckedException
        Gets value bytes from offheap space for the given key.
        Parameters:
        spaceName - Space name.
        part - Partition.
        key - Key.
        keyBytes - Key bytes.
        Returns:
        Value bytes.
        Throws:
        IgniteCheckedException - If failed.
      • getValue

        @Nullable
        public <T> T getValue​(@Nullable
                              @Nullable String spaceName,
                              int part,
                              KeyCacheObject key,
                              byte[] keyBytes,
                              @Nullable
                              @Nullable ClassLoader ldr)
                       throws IgniteCheckedException
        Gets value from offheap space for the given key.
        Parameters:
        spaceName - Space name.
        part - Partition.
        key - Key.
        keyBytes - Key bytes.
        ldr - Class loader.
        Returns:
        Value bytes.
        Throws:
        IgniteCheckedException - If failed.
      • remove

        @Nullable
        public @org.jetbrains.annotations.Nullable byte[] remove​(@Nullable
                                                                 @Nullable String spaceName,
                                                                 int part,
                                                                 KeyCacheObject key,
                                                                 byte[] keyBytes)
                                                          throws IgniteCheckedException
        Removes value from offheap space for the given key.
        Parameters:
        spaceName - Space name.
        part - Partition.
        key - Key.
        keyBytes - Key bytes.
        Returns:
        Value bytes.
        Throws:
        IgniteCheckedException - If failed.
      • put

        public void put​(@Nullable
                        @Nullable String spaceName,
                        int part,
                        KeyCacheObject key,
                        byte[] keyBytes,
                        byte[] valBytes)
                 throws IgniteCheckedException
        Puts the given value to offheap space for the given key.
        Parameters:
        spaceName - Space name.
        part - Partition.
        key - Key.
        keyBytes - Key bytes.
        valBytes - Value bytes.
        Throws:
        IgniteCheckedException - If failed.
      • removex

        public boolean removex​(@Nullable
                               @Nullable String spaceName,
                               int part,
                               KeyCacheObject key,
                               byte[] keyBytes)
                        throws IgniteCheckedException
        Removes value from offheap space for the given key.
        Parameters:
        spaceName - Space name.
        part - Partition.
        key - Key.
        keyBytes - Key bytes.
        Returns:
        true If succeeded.
        Throws:
        IgniteCheckedException - If failed.
      • removex

        public boolean removex​(@Nullable
                               @Nullable String spaceName,
                               int part,
                               KeyCacheObject key,
                               byte[] keyBytes,
                               IgniteBiPredicate<Long,​Integer> p)
                        throws IgniteCheckedException
        Removes value from offheap space for the given key.
        Parameters:
        spaceName - Space name.
        part - Partition.
        key - Key.
        keyBytes - Key bytes.
        p - Value predicate (arguments are value address and value length).
        Returns:
        true If succeeded.
        Throws:
        IgniteCheckedException - If failed.
      • iterator

        public GridCloseableIterator<IgniteBiTuple<byte[],​byte[]>> iterator​(@Nullable
                                                                                  @Nullable String spaceName)
        Gets iterator over contents of the given space.
        Parameters:
        spaceName - Space name.
        Returns:
        Iterator.
      • iterator

        public <T> GridCloseableIterator<T> iterator​(@Nullable
                                                     @Nullable String spaceName,
                                                     CX2<T2<Long,​Integer>,​T2<Long,​Integer>,​T> c)
        Gets iterator over contents of the given space.
        Parameters:
        spaceName - Space name.
        c - Key/value closure.
        Returns:
        Iterator.
      • iterator

        public <T> GridCloseableIterator<T> iterator​(@Nullable
                                                     @Nullable String spaceName,
                                                     CX2<T2<Long,​Integer>,​T2<Long,​Integer>,​T> c,
                                                     int part)
        Gets iterator over contents of the given space.
        Parameters:
        spaceName - Space name.
        c - Key/value closure.
        part - Partition.
        Returns:
        Iterator.
      • entriesCount

        public long entriesCount​(@Nullable
                                 @Nullable String spaceName)
        Gets number of elements in the given space.
        Parameters:
        spaceName - Space name. Optional.
        Returns:
        Number of elements or -1 if no space with the given name has been found.
      • entriesCount

        public long entriesCount​(@Nullable
                                 @Nullable String spaceName,
                                 Set<Integer> parts)
        Gets number of elements in the given space.
        Parameters:
        spaceName - Space name. Optional.
        parts - Partitions.
        Returns:
        Number of elements or -1 if no space with the given name has been found.
      • allocatedSize

        public long allocatedSize​(@Nullable
                                  @Nullable String spaceName)
        Gets size of a memory allocated for the entries of the given space.
        Parameters:
        spaceName - Space name. Optional.
        Returns:
        Allocated memory size or -1 if no space with the given name has been found.
      • iterator

        public GridCloseableIterator<IgniteBiTuple<byte[],​byte[]>> iterator​(@Nullable
                                                                                  @Nullable String spaceName,
                                                                                  int part)
        Gets iterator over contents of partition.
        Parameters:
        spaceName - Space name.
        part - Partition.
        Returns:
        Iterator.