Package com.github.ddth.dao.nosql.lucene
Class LuceneKvStorage
- java.lang.Object
-
- com.github.ddth.dao.nosql.lucene.BaseLuceneStorage
-
- com.github.ddth.dao.nosql.lucene.LuceneKvStorage
-
- All Implemented Interfaces:
IKvStorage
,java.io.Closeable
,java.lang.AutoCloseable
public class LuceneKvStorage extends BaseLuceneStorage implements IKvStorage
Lucene implementation of {key:value} NoSQL storage.Design: value is stored in field
FIELD_VALUE
.- Since:
- 0.10.0
- Author:
- Thanh Nguyen
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
FIELD_VALUE
-
Fields inherited from class com.github.ddth.dao.nosql.lucene.BaseLuceneStorage
FIELD_ID, FIELD_KEY, FIELD_SPACE_ID
-
-
Constructor Summary
Constructors Constructor Description LuceneKvStorage()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete(java.lang.String spaceId, java.lang.String key, IDeleteCallback callback)
Delete an existing entry from storage.<T> T
get(IKvEntryMapper<T> mapper, java.lang.String spaceId, java.lang.String key)
Get/Load an entry by key.byte[]
get(java.lang.String spaceId, java.lang.String key)
Get/Load an entry by key.boolean
keyExists(java.lang.String spaceId, java.lang.String key)
Check if a key exists.void
put(java.lang.String spaceId, java.lang.String key, byte[] value, IPutCallback<byte[]> callback)
Put/Store an entry.long
size(java.lang.String spaceId)
Return number of entries.-
Methods inherited from class com.github.ddth.dao.nosql.lucene.BaseLuceneStorage
buildIdTerm, buildQuery, close, createDocument, destroy, doCount, doDelete, doGet, getAutoCommitPeriodMs, getDirectory, getIndexManager, getIndexSearcher, getIndexWriter, getIndexWriterConfig, init, isAsyncWrite, setAsyncWrite, setAutoCommitPeriodMs, setDirectory, setIndexManager, setIndexWriterConfig
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.github.ddth.dao.nosql.IKvStorage
delete, put
-
-
-
-
Field Detail
-
FIELD_VALUE
protected static final java.lang.String FIELD_VALUE
- See Also:
- Constant Field Values
-
-
Method Detail
-
delete
public void delete(java.lang.String spaceId, java.lang.String key, IDeleteCallback callback)
Delete an existing entry from storage.- Specified by:
delete
in interfaceIKvStorage
-
keyExists
public boolean keyExists(java.lang.String spaceId, java.lang.String key) throws java.io.IOException
Check if a key exists.- Specified by:
keyExists
in interfaceIKvStorage
- Returns:
- Throws:
java.io.IOException
-
get
public byte[] get(java.lang.String spaceId, java.lang.String key) throws java.io.IOException
Get/Load an entry by key.- Specified by:
get
in interfaceIKvStorage
- Returns:
- Throws:
java.io.IOException
-
get
public <T> T get(IKvEntryMapper<T> mapper, java.lang.String spaceId, java.lang.String key) throws java.io.IOException
Get/Load an entry by key.- Specified by:
get
in interfaceIKvStorage
- Returns:
- Throws:
java.io.IOException
-
put
public void put(java.lang.String spaceId, java.lang.String key, byte[] value, IPutCallback<byte[]> callback)
Put/Store an entry.- Specified by:
put
in interfaceIKvStorage
-
size
public long size(java.lang.String spaceId) throws java.io.IOException
Return number of entries.- Specified by:
size
in interfaceIKvStorage
- Returns:
- number of entries currently in the storage,
-1
if counting number entries is not supported - Throws:
java.io.IOException
-
-