]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. |
2 | // This source code is licensed under both the GPLv2 (found in the | |
3 | // COPYING file in the root directory) and Apache 2.0 License | |
4 | // (found in the LICENSE.Apache file in the root directory). | |
5 | ||
6 | package org.rocksdb; | |
7 | ||
1e59de90 | 8 | interface TransactionalDB<T extends TransactionalOptions<T>> extends AutoCloseable { |
11fdf7f2 TL |
9 | /** |
10 | * Starts a new Transaction. | |
11 | * | |
12 | * Caller is responsible for calling {@link #close()} on the returned | |
13 | * transaction when it is no longer needed. | |
14 | * | |
15 | * @param writeOptions Any write options for the transaction | |
16 | * @return a new transaction | |
17 | */ | |
18 | Transaction beginTransaction(final WriteOptions writeOptions); | |
19 | ||
20 | /** | |
21 | * Starts a new Transaction. | |
22 | * | |
23 | * Caller is responsible for calling {@link #close()} on the returned | |
24 | * transaction when it is no longer needed. | |
25 | * | |
26 | * @param writeOptions Any write options for the transaction | |
27 | * @param transactionOptions Any options for the transaction | |
28 | * @return a new transaction | |
29 | */ | |
30 | Transaction beginTransaction(final WriteOptions writeOptions, | |
31 | final T transactionOptions); | |
32 | ||
33 | /** | |
34 | * Starts a new Transaction. | |
35 | * | |
36 | * Caller is responsible for calling {@link #close()} on the returned | |
37 | * transaction when it is no longer needed. | |
38 | * | |
39 | * @param writeOptions Any write options for the transaction | |
40 | * @param oldTransaction this Transaction will be reused instead of allocating | |
41 | * a new one. This is an optimization to avoid extra allocations | |
42 | * when repeatedly creating transactions. | |
43 | * @return The oldTransaction which has been reinitialized as a new | |
44 | * transaction | |
45 | */ | |
46 | Transaction beginTransaction(final WriteOptions writeOptions, | |
47 | final Transaction oldTransaction); | |
48 | ||
49 | /** | |
50 | * Starts a new Transaction. | |
51 | * | |
52 | * Caller is responsible for calling {@link #close()} on the returned | |
53 | * transaction when it is no longer needed. | |
54 | * | |
55 | * @param writeOptions Any write options for the transaction | |
56 | * @param transactionOptions Any options for the transaction | |
57 | * @param oldTransaction this Transaction will be reused instead of allocating | |
58 | * a new one. This is an optimization to avoid extra allocations | |
59 | * when repeatedly creating transactions. | |
60 | * @return The oldTransaction which has been reinitialized as a new | |
61 | * transaction | |
62 | */ | |
63 | Transaction beginTransaction(final WriteOptions writeOptions, | |
64 | final T transactionOptions, final Transaction oldTransaction); | |
65 | } |