Package io.tarantool.driver.api.space
Interface TarantoolSpaceOperations<T extends Packable,R extends Collection<T>>
-
- Type Parameters:
T- tuple typeR- tuple collection type
- All Known Implementing Classes:
ProxyTarantoolSpace,ProxyTarantoolTupleSpace,RetryingTarantoolSpace,TarantoolSpace,TarantoolTupleSpace
public interface TarantoolSpaceOperations<T extends Packable,R extends Collection<T>>Tarantool space operations interface (create, insert, replace, delete...)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TarantoolCursor<T>cursor(Conditions conditions)Same ascursor(Conditions, int)but uses the default batch size.TarantoolCursor<T>cursor(Conditions conditions, int batchSize)Cursor is an iterator-like object that is able to scroll through results of a query.CompletableFuture<R>delete(Conditions conditions)Delete a tuple.TarantoolSpaceMetadatagetMetadata()Get metadata associated with this spaceCompletableFuture<R>insert(T tuple)Inserts tuple into the space, if no tuple with same unique keys exists.CompletableFuture<R>replace(T tuple)Insert a tuple into the space or replace an existing one.CompletableFuture<R>select(Conditions conditions)Select tuples matching the specified query with options.CompletableFuture<Void>truncate()Truncate space if space would be found.CompletableFuture<R>update(Conditions conditions, TupleOperations operations)Update a tuple.CompletableFuture<R>update(Conditions conditions, T tuple)Update a tuple.CompletableFuture<R>upsert(Conditions conditions, T tuple, TupleOperations operations)Update tuple if it would be found elsewhere try to insert tuple.
-
-
-
Method Detail
-
delete
CompletableFuture<R> delete(Conditions conditions) throws TarantoolClientException
Delete a tuple. Only a single primary index value condition is supported.- Parameters:
conditions- query with options- Returns:
- a future that will contain removed tuple once completed
- Throws:
TarantoolClientException- in case if the request failed
-
insert
CompletableFuture<R> insert(T tuple) throws TarantoolClientException
Inserts tuple into the space, if no tuple with same unique keys exists. Otherwise throw duplicate key error.- Parameters:
tuple- new data- Returns:
- a future that will contain all corresponding tuples once completed
- Throws:
TarantoolClientException- in case if request failed
-
replace
CompletableFuture<R> replace(T tuple) throws TarantoolClientException
Insert a tuple into the space or replace an existing one.- Parameters:
tuple- new data- Returns:
- a future that will contain all corresponding tuples once completed
- Throws:
TarantoolClientException- in case if request failed
-
select
CompletableFuture<R> select(Conditions conditions) throws TarantoolClientException
Select tuples matching the specified query with options.- Parameters:
conditions- query with options- Returns:
- a future that will contain all corresponding tuples once completed
- Throws:
TarantoolClientException- in case if the request failed
-
update
CompletableFuture<R> update(Conditions conditions, T tuple)
Update a tuple. Only a single primary index value condition is supported.- Parameters:
conditions- query with optionstuple- tuple with new field values- Returns:
- a future that will contain corresponding tuple once completed
- Throws:
TarantoolClientException- in case if the request failed
-
update
CompletableFuture<R> update(Conditions conditions, TupleOperations operations)
Update a tuple. Only a single primary index value condition is supported.- Parameters:
conditions- query with optionsoperations- the list update operations- Returns:
- a future that will contain corresponding tuple once completed
- Throws:
TarantoolClientException- in case if the request failed
-
upsert
CompletableFuture<R> upsert(Conditions conditions, T tuple, TupleOperations operations)
Update tuple if it would be found elsewhere try to insert tuple. Only a single primary index value condition is supported.- Parameters:
conditions- query with optionstuple- new data that will be insert if tuple will be not foundoperations- the list of update operations to be performed if the tuple exists- Returns:
- a future that will empty list
- Throws:
TarantoolClientException- in case if the request failed
-
truncate
CompletableFuture<Void> truncate() throws TarantoolClientException
Truncate space if space would be found. Otherwise, throw space not found error.- Returns:
- a future that will contain void.
- Throws:
TarantoolClientException- in case if request failed
-
getMetadata
TarantoolSpaceMetadata getMetadata()
Get metadata associated with this space- Returns:
- space metadata
-
cursor
TarantoolCursor<T> cursor(Conditions conditions, int batchSize)
Cursor is an iterator-like object that is able to scroll through results of a query. Unlike a single cursor loads new tuples dynamically issuing requests to server. Select will fetch tuples matching the specified query. Each request to server will fetch no more than 'batch size' tuples.- Parameters:
conditions- query with optionsbatchSize- size of a batch of single client request- Returns:
- cursor that can iterate through all corresponding tuples
-
cursor
TarantoolCursor<T> cursor(Conditions conditions)
Same ascursor(Conditions, int)but uses the default batch size.- Parameters:
conditions- query with options- Returns:
- cursor that can iterate through all corresponding tuples
-
-