public class BackendTransaction extends Object implements LoggableTransaction
Modifier and Type | Field and Description |
---|---|
static StaticBuffer |
EDGESTORE_MAX_KEY |
static StaticBuffer |
EDGESTORE_MIN_KEY |
static int |
MIN_TASKS_TO_PARALLELIZE |
Constructor and Description |
---|
BackendTransaction(CacheTransaction storeTx,
BaseTransactionConfig txConfig,
StoreFeatures features,
KCVSCache edgeStore,
KCVSCache indexStore,
KCVSCache txLogStore,
Duration maxReadTime,
Map<String,IndexTransaction> indexTx,
Executor threadPool,
boolean cacheEnabled) |
Modifier and Type | Method and Description |
---|---|
void |
acquireEdgeLock(StaticBuffer key,
Entry entry) |
void |
acquireEdgeLock(StaticBuffer key,
StaticBuffer column)
Acquires a lock for the key-column pair on the edge store which ensures that nobody else can take a lock on that
respective entry for the duration of this lock (but somebody could potentially still overwrite
the key-value entry without taking a lock).
|
void |
acquireIndexLock(StaticBuffer key,
Entry entry) |
void |
acquireIndexLock(StaticBuffer key,
StaticBuffer column)
Acquires a lock for the key-column pair on the property index which ensures that nobody else can take a lock on that
respective entry for the duration of this lock (but somebody could potentially still overwrite
the key-value entry without taking a lock).
|
void |
commit()
Commits the transaction and persists all modifications to the backend.
|
Map<String,Throwable> |
commitIndexes() |
void |
commitStorage() |
void |
disableCache() |
KeyIterator |
edgeStoreKeys(KeyRangeQuery range) |
KeyIterator |
edgeStoreKeys(SliceQuery sliceQuery) |
Map<StaticBuffer,EntryList> |
edgeStoreMultiQuery(List<StaticBuffer> keys,
SliceQuery query) |
EntryList |
edgeStoreQuery(KeySliceQuery query) |
void |
enableCache() |
BaseTransactionConfig |
getBaseTransactionConfig() |
IndexTransaction |
getIndexTransaction(String index) |
StoreTransaction |
getStoreTransaction() |
ExternalCachePersistor |
getTxLogPersistor() |
boolean |
hasAcquiredLock() |
boolean |
hasIndexTransaction(String index) |
EntryList |
indexQuery(KeySliceQuery query) |
Stream<String> |
indexQuery(String index,
IndexQuery query) |
Number |
indexQueryAggregation(String index,
IndexQuery query,
Aggregation aggregation) |
boolean |
isCacheEnabled() |
void |
logMutations(DataOutput out) |
void |
mutateEdges(StaticBuffer key,
List<Entry> additions,
List<Entry> deletions)
Applies the specified insertion and deletion mutations on the edge store to the provided key.
|
void |
mutateIndex(StaticBuffer key,
List<Entry> additions,
List<Entry> deletions)
Applies the specified insertion and deletion mutations on the property index to the provided key.
|
Stream<RawQuery.Result<String>> |
rawQuery(String index,
RawQuery query) |
void |
rollback()
Rolls back all transactions and makes sure that this does not get cut short
by exceptions.
|
Long |
totals(String index,
RawQuery query) |
public static final int MIN_TASKS_TO_PARALLELIZE
public static final StaticBuffer EDGESTORE_MIN_KEY
public static final StaticBuffer EDGESTORE_MAX_KEY
public BackendTransaction(CacheTransaction storeTx, BaseTransactionConfig txConfig, StoreFeatures features, KCVSCache edgeStore, KCVSCache indexStore, KCVSCache txLogStore, Duration maxReadTime, Map<String,IndexTransaction> indexTx, Executor threadPool, boolean cacheEnabled)
public boolean hasAcquiredLock()
public StoreTransaction getStoreTransaction()
public ExternalCachePersistor getTxLogPersistor()
public BaseTransactionConfig getBaseTransactionConfig()
public boolean hasIndexTransaction(String index)
public IndexTransaction getIndexTransaction(String index)
public void disableCache()
public void enableCache()
public boolean isCacheEnabled()
public void commitStorage() throws BackendException
BackendException
public void commit() throws BackendException
BaseTransaction
BaseTransaction.rollback()
at most once per instance.commit
in interface BaseTransaction
BackendException
public void rollback() throws BackendException
rollback
in interface BaseTransaction
BackendException
public void logMutations(DataOutput out)
logMutations
in interface LoggableTransaction
public void mutateEdges(StaticBuffer key, List<Entry> additions, List<Entry> deletions) throws BackendException
key
- Keyadditions
- List of entries (column + value) to be addeddeletions
- List of columns to be removedBackendException
public void mutateIndex(StaticBuffer key, List<Entry> additions, List<Entry> deletions) throws BackendException
key
- Keyadditions
- List of entries (column + value) to be addeddeletions
- List of columns to be removedBackendException
public void acquireEdgeLock(StaticBuffer key, StaticBuffer column) throws BackendException
If this method is called multiple times with the same key-column pair in the same transaction, all but the first invocation are ignored.
The lock has to be released when the transaction closes (commits or aborts).
key
- Key on which to lockcolumn
- Column the column on which to lockBackendException
public void acquireEdgeLock(StaticBuffer key, Entry entry) throws BackendException
BackendException
public void acquireIndexLock(StaticBuffer key, StaticBuffer column) throws BackendException
If this method is called multiple times with the same key-column pair in the same transaction, all but the first invocation are ignored.
The lock has to be released when the transaction closes (commits or aborts).
key
- Key on which to lockcolumn
- Column the column on which to lockBackendException
public void acquireIndexLock(StaticBuffer key, Entry entry) throws BackendException
BackendException
public EntryList edgeStoreQuery(KeySliceQuery query)
public Map<StaticBuffer,EntryList> edgeStoreMultiQuery(List<StaticBuffer> keys, SliceQuery query)
public KeyIterator edgeStoreKeys(SliceQuery sliceQuery)
public KeyIterator edgeStoreKeys(KeyRangeQuery range)
public EntryList indexQuery(KeySliceQuery query)
public Stream<String> indexQuery(String index, IndexQuery query)
public Number indexQueryAggregation(String index, IndexQuery query, Aggregation aggregation)
public Stream<RawQuery.Result<String>> rawQuery(String index, RawQuery query)
Copyright © 2012–2023. All rights reserved.