-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TANDS-19093-transactionRegistry-interface (#1332)
* TANDS-19093-transactionRegistry-interface * TANDS-19093-transactionRegistry-interface * TANDS-19093-transactionRegistry-interface * TANDS-19093-fixing-bugs * TANDS-19093-fixing-bugs * TANDS-19093-fixing-bugs * TANDS-19093-fixing-bugs Co-authored-by: Ramsha Rao <[email protected]>
- Loading branch information
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
elide-core/src/main/java/com/yahoo/elide/core/TransactionRegistry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright 2020, Yahoo Inc. | ||
* Licensed under the Apache License, Version 2.0 | ||
* See LICENSE file in project root for terms. | ||
*/ | ||
package com.yahoo.elide.core; | ||
|
||
import lombok.Data; | ||
|
||
import java.util.Set; | ||
/** | ||
* Transaction Registry interface to surface transaction details to other parts of Elide. | ||
*/ | ||
|
||
public interface TransactionRegistry { | ||
/** | ||
* @see RequestScope | ||
* @see DataStoreTransaction | ||
*/ | ||
@Data | ||
public static class TransactionEntry { | ||
public RequestScope request; | ||
public DataStoreTransaction transaction; | ||
} | ||
|
||
/** | ||
* @return all running transactions | ||
*/ | ||
Set<TransactionEntry> getRunningTransactions(); | ||
|
||
/** | ||
* @param requestId | ||
* @return matching running transaction | ||
*/ | ||
Set<TransactionEntry> getRunningTransaction(String requestId); | ||
|
||
/** | ||
* Adds running transaction | ||
* @param transactionEntry TransactionEntry transactionEntry | ||
*/ | ||
void addRunningTransaction(TransactionEntry transactionEntry); | ||
|
||
/** | ||
* Removes running transaction when we call cancel on it | ||
* @param transactionEntry TransactionEntry transactionEntry | ||
*/ | ||
void removeRunningTransaction(TransactionEntry transactionEntry); | ||
} |