[ 
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 extends AutoCloseable {
    /** Index key factory */
    IndexKeyFactory indexKeyFactory();

    /** Index descriptor */
    SortedIndexDescriptor indexDescriptor();

    /** Adds a value */
    void put(IndexKey key, SearchRow value);

    /** Removes a value */
    void remove(IndexKey key);

    /** Range scan */
    Cursor<SearchRow> range(IndexKeyPrefix lowerBound, IndexKeyPrefix 
upperBound);

    /** Removes all values */
    void destroy();
}

{code}

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

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

public interface IndexKeyPrefix {
    Object[] prefixColumnValues();
}
{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. 

It is also proposed to store partition storage keys as values in the index 
storage.

  was:
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. 

It is also proposed to store partition storage keys as values in the index 
storage.


> 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
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> h1. API
> * Add {{SortedIndexStorage}} interface:
> {code:java}
> public interface SortedIndexStorage extends AutoCloseable {
>     /** Index key factory */
>     IndexKeyFactory indexKeyFactory();
>     /** Index descriptor */
>     SortedIndexDescriptor indexDescriptor();
>     /** Adds a value */
>     void put(IndexKey key, SearchRow value);
>     /** Removes a value */
>     void remove(IndexKey key);
>     /** Range scan */
>     Cursor<SearchRow> range(IndexKeyPrefix lowerBound, IndexKeyPrefix 
> upperBound);
>     /** Removes all values */
>     void destroy();
> }
> {code}
> * {{IndexKeyPrefix}} can contain a smaller number of columns, than the 
> {{IndexKey}}, needed for the prefix search.
> {code:java}
> public interface IndexKey {
>     byte[] asBytes();
> }
> public interface IndexKeyPrefix {
>     Object[] prefixColumnValues();
> }
> {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. 
> It is also proposed to store partition storage keys as values in the index 
> storage.



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

Reply via email to