Package com.codingchili.core.storage
Class ElasticMap<Value extends Storable>
java.lang.Object
com.codingchili.core.storage.ElasticMap<Value>
- All Implemented Interfaces:
AsyncStorage<Value>
Map implementation that uses ElasticSearch.
Does not support case sensitivity for equals.
Does not support ordering nested fields without server configuration
-
Field Summary
-
Constructor Summary
ConstructorDescriptionElasticMap(io.vertx.core.Promise<AsyncStorage<Value>> promise, StorageContext<Value> context)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
removes all existing entries from the storage.context()
Get the context for the storage.void
get an entry with the given key, if the key does not match a value fails with #ValueMissingException
void
set the entry identified by the given key to the given valuevoid
putIfAbsent(Value value, io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
set the entry if it does not already exists.query()
initialize the construction of a query.void
Removes an entry by its key.void
returns the amount of entries in the storage.void
updates the value of the given key if a value already exists.void
Get all values contained within the storage as a stream.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.codingchili.core.storage.AsyncStorage
contains, query
-
Field Details
-
ARRAY_NOTATION
- See Also:
- Constant Field Values
-
-
Constructor Details
-
ElasticMap
public ElasticMap(io.vertx.core.Promise<AsyncStorage<Value>> promise, StorageContext<Value> context)
-
-
Method Details
-
get
Description copied from interface:AsyncStorage
get an entry with the given key, if the key does not match a value fails with #ValueMissingException
- Specified by:
get
in interfaceAsyncStorage<Value extends Storable>
- Parameters:
key
- a unique key identifying an entryhandler
- callback
-
put
Description copied from interface:AsyncStorage
set the entry identified by the given key to the given value- Specified by:
put
in interfaceAsyncStorage<Value extends Storable>
- Parameters:
value
- the value to be set for the given keyhandler
- callback
-
putIfAbsent
public void putIfAbsent(Value value, io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)Description copied from interface:AsyncStorage
set the entry if it does not already exists. fails with #ValueAlreadyPresentException
if the key already has a value.- Specified by:
putIfAbsent
in interfaceAsyncStorage<Value extends Storable>
- Parameters:
value
- the value to be set if the entry does not exist.handler
- callback
-
remove
Description copied from interface:AsyncStorage
Removes an entry by its key.- Specified by:
remove
in interfaceAsyncStorage<Value extends Storable>
- Parameters:
key
- identifies the entry to be removed.handler
- callback
-
update
Description copied from interface:AsyncStorage
updates the value of the given key if a value already exists.- Specified by:
update
in interfaceAsyncStorage<Value extends Storable>
- Parameters:
value
- the new value of the entryhandler
- callback
-
values
Description copied from interface:AsyncStorage
Get all values contained within the storage as a stream. Not recommended to use on large maps.- Specified by:
values
in interfaceAsyncStorage<Value extends Storable>
- Parameters:
handler
- callback
-
clear
Description copied from interface:AsyncStorage
removes all existing entries from the storage.- Specified by:
clear
in interfaceAsyncStorage<Value extends Storable>
- Parameters:
handler
- callback
-
size
Description copied from interface:AsyncStorage
returns the amount of entries in the storage.- Specified by:
size
in interfaceAsyncStorage<Value extends Storable>
- Parameters:
handler
- callback
-
query
Description copied from interface:AsyncStorage
initialize the construction of a query.- Specified by:
query
in interfaceAsyncStorage<Value extends Storable>
- Returns:
- a builder String for constructing the query.
-
context
Description copied from interface:AsyncStorage
Get the context for the storage.- Specified by:
context
in interfaceAsyncStorage<Value extends Storable>
- Returns:
- a storage context.
-
addIndex
- Specified by:
addIndex
in interfaceAsyncStorage<Value extends Storable>
- Parameters:
field
- the path to the attribute to index, must include the array token in #CoreStrings.STORAGE_ARRAY
.
-