Package sonia.scm.store
Interface QueryableMutableStore.MutableQuery<T,S extends QueryableMutableStore.MutableQuery<T,S>>
- Type Parameters:
T
- "Type" – type of the objects to queryS
- "Self" – specification of theQueryableMutableStore.MutableQuery
.
- All Superinterfaces:
QueryableStore.Query<T,
T, S>
- Enclosing interface:
- QueryableMutableStore<T>
public static interface QueryableMutableStore.MutableQuery<T,S extends QueryableMutableStore.MutableQuery<T,S>>
extends QueryableStore.Query<T,T,S>
-
Method Summary
-
Method Details
-
retain
void retain(long keptElements) Deletes all entries except thekeptElements
highest ones in terms of the provided order and query.
For example, callingretain(4)
after a querystore.query(CREATION_TIME.after(Instant.now().minus(5, DAYS)).orderBy(Order.DESC)
will remove every entry except those that- Match any conditions given by preceding queries (here:
store.query(...)
saying that only elements newer than five days may be kept), and - Are among the 4 first ones in terms of the order given by the query result (here: a descending order with the newest being first).
QueryableMutableStore
. For example, elements with other parent ids in some implementations are supposed to remain unaffected.
Note:deleteAll()
is identical toretain(0)
.- Parameters:
keptElements
- Quantity of entities to be retained.- Since:
- 3.9.0
- Match any conditions given by preceding queries (here:
-
deleteAll
void deleteAll()Deletes all entries matching the given query conditions.
For example, callingdeleteAll()
after a querystore.query(CREATION_TIME.before(Instant.now().minus(5, DAYS))
will remove every entry with aCREATION_TIME
property older than five days and keep those that don't match this condition (newer date).
If no conditions have been selected beforehand, all entries in the realm of thisQueryableMutableStore
instance will be removed. It does not affect the structure of the store, and new entries may be added afterwards.
This function is expected to only work in the realm of theQueryableMutableStore
. For example, elements with other parent ids are supposed to remain unaffected.
Note: Considerretain(long)
if you prefer to deliberately keep a given amounts of elements instead.- Since:
- 3.9.0
-