[ 
https://issues.apache.org/jira/browse/IGNITE-15885?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aleksandr Polovtcev updated IGNITE-15885:
-----------------------------------------
    Description: 
h1. API

* Add {{SortedIndexStorage}} interface:

{code:java}
public interface SortedIndexStorage {
    /** Index ID. */
    IgniteUuid id();
    
    /** Index configuration. */
    TableIndexView configuration();
    
    /** Schema of the index keys. */
    SchemaDescriptor schema();
    
    /** Retrieves the key of a partition storage for the given index key. */
    SearchRow get(IndexKey row);
    
    /** Adds the given row to the index */
    void put(IndexKey row);
    
    /** Removes the given row from the index. */
    void remove(IndexKey row);
    
    /** Replaces the {@code oldRow} with the {@code newRow}. */
    void replace(IndexKey oldRow, IndexKey newRow);
    
    /** Returns a range of index rows as specified in IEP-74. */
    Cursor<SearchRow> range(SearchKey lowerBound, SearchKey upperBound, byte 
options);
}
{code}

* {{SearchKey}} can contain a smaller number of columns, than the {{IndexKey}}, 
needed for the prefix search.

{code:java}
public interface IndexKey {
    byte[] asBytes();
}

public interface SearchKey {
    byte[] asBytes();
}
{code}

* {{SearchRow}} is a class from the {{storage-api}} that represents a key from 
the partition storage.

h1. Implementation details

For the initial implementation it is suggested to use {{BinaryRow}} 
serialization mechanism (it is proposed to implement the {{IndexKey}} on top of 
it, simply ignoring the value bytes) to store it in RocksDB. First 
implementation will also use a naive comparator, that will convert each 
{{BinaryRow}} into a {{Row}} and compare individual deserialized columns.

  was:
# Add {{SortedIndexStorage}} interface:

{code:java}
public interface SortedIndexStorage {
    /** Index ID. */
    IgniteUuid id();
    
    /** Index configuration. */
    TableIndexView configuration();
    
    /** Schema of the index keys. */
    SchemaDescriptor schema();
    
    /** Retrieves the key of a partition storage for the given index key. */
    SearchRow get(IndexKey row);
    
    /** Adds the given row to the index */
    void put(IndexKey row);
    
    /** Removes the given row from the index. */
    void remove(IndexKey row);
    
    /** Replaces the {@code oldRow} with the {@code newRow}. */
    void replace(IndexKey oldRow, IndexKey newRow);
    
    /** Returns a range of index rows as specified in IEP-74. */
    Cursor<SearchRow> range(SearchKey lowerBound, SearchKey upperBound, byte 
options);
}
{code}



> Create and implement SortedIndexStorage based on RocksDB
> --------------------------------------------------------
>
>                 Key: IGNITE-15885
>                 URL: https://issues.apache.org/jira/browse/IGNITE-15885
>             Project: Ignite
>          Issue Type: Task
>            Reporter: Aleksandr Polovtcev
>            Assignee: Aleksandr Polovtcev
>            Priority: Major
>              Labels: ignite-3
>
> h1. API
> * Add {{SortedIndexStorage}} interface:
> {code:java}
> public interface SortedIndexStorage {
>     /** Index ID. */
>     IgniteUuid id();
>     
>     /** Index configuration. */
>     TableIndexView configuration();
>     
>     /** Schema of the index keys. */
>     SchemaDescriptor schema();
>     
>     /** Retrieves the key of a partition storage for the given index key. */
>     SearchRow get(IndexKey row);
>     
>     /** Adds the given row to the index */
>     void put(IndexKey row);
>     
>     /** Removes the given row from the index. */
>     void remove(IndexKey row);
>     
>     /** Replaces the {@code oldRow} with the {@code newRow}. */
>     void replace(IndexKey oldRow, IndexKey newRow);
>     
>     /** Returns a range of index rows as specified in IEP-74. */
>     Cursor<SearchRow> range(SearchKey lowerBound, SearchKey upperBound, byte 
> options);
> }
> {code}
> * {{SearchKey}} can contain a smaller number of columns, than the 
> {{IndexKey}}, needed for the prefix search.
> {code:java}
> public interface IndexKey {
>     byte[] asBytes();
> }
> public interface SearchKey {
>     byte[] asBytes();
> }
> {code}
> * {{SearchRow}} is a class from the {{storage-api}} that represents a key 
> from the partition storage.
> h1. Implementation details
> For the initial implementation it is suggested to use {{BinaryRow}} 
> serialization mechanism (it is proposed to implement the {{IndexKey}} on top 
> of it, simply ignoring the value bytes) to store it in RocksDB. First 
> implementation will also use a naive comparator, that will convert each 
> {{BinaryRow}} into a {{Row}} and compare individual deserialized columns.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to