Interface ItemStore
- All Known Implementing Classes:
AbstractItemStore, RocksDbStore, SqliteStore
public interface ItemStore
Interface for storing
Items into RocksDB/Sqlite-
Method Summary
Modifier and TypeMethodDescriptionbooleanCopies master DB to a cached DBbooleanRemove cached prototypebooleanClose connection to target DBbooleanEnforces concrete classes to implement closing connection against master DBbooleanEnforces concrete classes to implement closing connection against prototype DBboolean<T> TAllows a collection ofItemStoremethods to be executed across anItemStoremap under one lockedLinkedOperationwhose lifecycle is owned ideally by theAbstractItemStorewithLockedConnection<T> Texecute(DbTarget target, ItemStore itemStore, LinkedOperation<T> operations) Allows a collection ofItemStoremethods to be executed acrossItemStoreunder one lockedLinkedOperationwhose lifecycle is owned ideally by theAbstractItemStorewithLockedConnection<T> Texecute(DbTarget target, BulkOperation<T> work) Allows a collection ofItemStoremethods to be executed under the one lock whose lifecycle is owned ideally by theAbstractItemStorewithLockedConnectionGet allItemsGetItemby IdGet directory of ItemStoreFetch file path for cached DBgetItemsByState(DbTarget target, String state) GetItems matching queried stateFetch file path for masterDBgetPayloadById(DbTarget target, String id) Fetch the payload for anItemby an IdFetch store namebooleanChecks whether providedDbTargetis already closedbooleanChecks whether providedDbTargetis already openedbooleanOpen connection to target database if closedbooleanEnforces concrete classes to implement opening connection against master DBbooleanEnforces concrete classes to implement opening connection against prototype DBvoidSave anIteminto cached DBvoidSaveItemlist into cached DBvoidSyncs active cache to mastervoidsyncToMaster(List<Item> items) Sync list ofItemto mastervoidsyncToMaster(Item item) SyncItemStorecache to main DBboolean
-
Method Details
-
execute
<T> T execute(DbTarget target, Map<String, ItemStore> recipients, LinkedOperationMap<T> operations) throws ItemStoreCheckedException Allows a collection ofItemStoremethods to be executed across anItemStoremap under one lockedLinkedOperationwhose lifecycle is owned ideally by theAbstractItemStorewithLockedConnection- Type Parameters:
T-- Parameters:
target-recipients-operations-- Returns:
T - Throws:
ItemStoreCheckedException
-
execute
<T> T execute(DbTarget target, ItemStore itemStore, LinkedOperation<T> operations) throws ItemStoreCheckedException Allows a collection ofItemStoremethods to be executed acrossItemStoreunder one lockedLinkedOperationwhose lifecycle is owned ideally by theAbstractItemStorewithLockedConnection- Type Parameters:
T-- Parameters:
target-itemStore-operations-- Returns:
T - Throws:
ItemStoreCheckedException
-
execute
Allows a collection ofItemStoremethods to be executed under the one lock whose lifecycle is owned ideally by theAbstractItemStorewithLockedConnection- Type Parameters:
T-- Parameters:
target-work-- Returns:
T - Throws:
ItemStoreCheckedException
-
getStoreName
-
getMasterFilePath
-
getFilePath
-
getDbDirectory
-
saveItem
Save anIteminto cached DB- Parameters:
target-item-- Throws:
ItemStoreCheckedException
-
saveItems
SaveItemlist into cached DB- Parameters:
target-items-- Throws:
ItemStoreCheckedException
-
getAll
Get allItems- Parameters:
target-- Returns:
- List-
Item - Throws:
ItemStoreCheckedException
-
getById
GetItemby Id- Parameters:
target-id-- Returns:
Item- Throws:
ItemStoreCheckedException
-
getItemsByState
GetItems matching queried state- Parameters:
target-state-- Returns:
- List-
Item - Throws:
ItemStoreCheckedException
-
getPayloadById
-
delete
- Parameters:
target-item-- Returns:
- boolean
- Throws:
ExceptionItemStoreCheckedException
-
update
- Parameters:
target-item-- Returns:
- boolean
- Throws:
ExceptionItemStoreCheckedException
-
syncToMaster
SyncItemStorecache to main DB- Parameters:
item-- Throws:
ItemStoreCheckedException
-
syncToMaster
Sync list ofItemto master- Parameters:
items-- Throws:
ItemStoreCheckedException
-
syncToMaster
Syncs active cache to master- Throws:
ItemStoreCheckedException
-
cacheMaster
Copies master DB to a cached DB- Returns:
- boolean
- Throws:
ItemStoreCheckedException
-
clearPrototype
boolean clearPrototype()Remove cached prototype- Returns:
- boolean
-
closeConn
Close connection to target DB- Parameters:
target-- Returns:
- boolean
-
openConn
Open connection to target database if closed- Parameters:
target-- Returns:
- boolean
-
isOpen
-
isClosed
-
openMaster
boolean openMaster()Enforces concrete classes to implement opening connection against master DB- Returns:
- boolean
-
openPrototoype
boolean openPrototoype()Enforces concrete classes to implement opening connection against prototype DB- Returns:
- boolean
-
closeMaster
boolean closeMaster()Enforces concrete classes to implement closing connection against master DB- Returns:
- boolean
-
closePrototoype
boolean closePrototoype()Enforces concrete classes to implement closing connection against prototype DB- Returns:
- boolean
-