summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/transaction_coordinator_document.idl
blob: 39f1bd0bef3c22527a951e78c64f7cdaee2a47e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Copyright (C) 2018-present MongoDB, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the Server Side Public License, version 1,
# as published by MongoDB, Inc.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# Server Side Public License for more details.
#
# You should have received a copy of the Server Side Public License
# along with this program. If not, see
# <http://www.mongodb.com/licensing/server-side-public-license>.
#
# As a special exception, the copyright holders give permission to link the
# code of portions of this program with the OpenSSL library under certain
# conditions as described in each individual source file and distribute
# linked combinations including the program with the OpenSSL library. You
# must comply with the Server Side Public License in all respects for
# all of the code used other than as permitted herein. If you modify file(s)
# with this exception, you may extend this exception to your version of the
# file(s), but you are not obligated to do so. If you do not wish to do so,
# delete this exception statement from your version. If you delete this
# exception statement from all source files in the program, then also delete
# it in the license file.
#

global:
    cpp_namespace: "mongo::txn"
    cpp_includes:
        - "mongo/db/s/transaction_coordinator_structures.h"

imports:
    - "mongo/idl/basic_types.idl"
    - "mongo/db/logical_session_id.idl"
    - "mongo/s/sharding_types.idl"

types:
    commit_decision_enum:
        bson_serialization_type: string
        description: "Ensures that the commit decision serializes/deserializes to a fixed set of
                      string values"
        cpp_type: "txn::CommitDecision"
        serializer: "::mongo::txn::writeCommitDecisionEnumProperty"
        deserializer: "::mongo::txn::readCommitDecisionEnumProperty"

    status:
        bson_serialization_type: any
        description: "Serializes/deserializes the general server Status type"
        cpp_type: "::mongo::Status"
        serializer: "::mongo::txn::writeStatusProperty"
        deserializer: "::mongo::txn::readStatusProperty"

structs:
    CoordinatorCommitDecision:
        description: "An object representing the coordinator's commit decision."
        strict: true
        fields:
            decision:
                type: commit_decision_enum
                description: "See the values in txn::CommitDecision for details. Can only be commit
                              or abort."
            commitTimestamp:
                optional: true
                type: timestamp
                description: "If the decision is 'commit', contains the chosen commit timestamp,
                              otherwise it will not be set"
            abortStatus:
                optional: true
                type: status
                description: "If the decision is 'abort', contains the reason the shard aborted,
                              otherwise it will not be set"

    TransactionCoordinatorDocument:
        description: "A document used for majority confirming the coordinator's state changes"
        strict: true
        fields:
            _id:
                type: OperationSessionInfo
                description: "The sessionId and txnNumber of this transaction."
                cpp_name: id
            participants:
                type: array<shard_id>
                description: "The list of transaction participants."
            decision:
                optional: true
                type: CoordinatorCommitDecision
                description: "The coordinator's decision for the transaction including the decision
                              ('commit' or 'abort') and a commit timestamp (if the decision is
                              'commit'). Only set if the coordinator has made a decision."