aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/vespa/storageapi/mbusprot/protobuf/feed.proto
blob: 403752b0c846c595477572792d03feaacc999cf0 (plain) (blame)
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
syntax = "proto3";

option cc_enable_arenas = true;

package storage.mbusprot.protobuf;

import "common.proto";

message TestAndSetCondition {
    bytes selection = 1;
}

message PutRequest {
    Bucket   bucket                 = 1;
    Document document               = 2;
    uint64   new_timestamp          = 3;
    uint64   expected_old_timestamp = 4; // If zero; no expectation.
    TestAndSetCondition condition   = 5;
    bool     create_if_non_existent = 6;
}

message PutResponse {
    BucketInfo bucket_info        = 1;
    BucketId   remapped_bucket_id = 2;
    bool       was_found          = 3;
}

message Update {
    bytes payload = 1;
}

message UpdateRequest {
    enum CreateIfMissing {
        UNSPECIFIED = 0; // Legacy fallback: must deserialize `update` to find flag value
        TRUE        = 1;
        FALSE       = 2;
    }

    Bucket              bucket                 = 1;
    Update              update                 = 2;
    uint64              new_timestamp          = 3;
    uint64              expected_old_timestamp = 4; // If zero; no expectation.
    TestAndSetCondition condition              = 5;
    CreateIfMissing     create_if_missing      = 6;
}

message UpdateResponse {
    BucketInfo bucket_info        = 1;
    BucketId   remapped_bucket_id = 2;
    uint64     updated_timestamp  = 3;
}

message RemoveRequest {
    Bucket bucket                 = 1;
    bytes  document_id            = 2;
    uint64 new_timestamp          = 3;
    TestAndSetCondition condition = 4;
}

message RemoveResponse {
    BucketInfo bucket_info        = 1;
    BucketId   remapped_bucket_id = 2;
    uint64     removed_timestamp  = 3;
}

message GetRequest {
    Bucket bucket           = 1;
    bytes  document_id      = 2;
    bytes  field_set        = 3;
    uint64 before_timestamp = 4;
    enum InternalReadConsistency {
        Strong = 0; // Default for a good reason.
        Weak = 1;
    }
    InternalReadConsistency internal_read_consistency = 5;
    TestAndSetCondition condition = 6;
}

message GetResponse {
    Document   document                = 1;
    uint64     last_modified_timestamp = 2;
    BucketInfo bucket_info             = 3;
    BucketId   remapped_bucket_id      = 4;
    // Note: last_modified_timestamp and tombstone_timestamp are mutually exclusive.
    // Tracked separately (rather than being a flag bool) to avoid issues during rolling upgrades.
    uint64     tombstone_timestamp     = 5;
    bool       condition_matched       = 6;
}

message RevertRequest {
    Bucket   bucket               = 1;
    repeated uint64 revert_tokens = 2;
}

message RevertResponse {
    BucketInfo bucket_info        = 1;
    BucketId   remapped_bucket_id = 2;
}

message IdAndTimestamp {
    DocumentId id    = 1;
    uint64 timestamp = 2;
}

message PhaseOneRemove {
    // Currently empty; its presence is enough
}

message PhaseTwoRemove {
    repeated IdAndTimestamp explicit_remove_set = 1;
}

message RemoveLocationRequest {
    Bucket bucket                = 1;
    bytes  document_selection    = 2;
    oneof phased_remove {
        PhaseOneRemove phase_one = 3;
        PhaseTwoRemove phase_two = 4;
    }
}

message RemoveLocationStats {
    uint32 documents_removed = 1;
}

message RemoveLocationResponse {
    BucketInfo bucket_info                    = 1;
    BucketId   remapped_bucket_id             = 2;
    RemoveLocationStats stats                 = 3;
    repeated IdAndTimestamp selection_matches = 4; // Iff reply to phase 1 remove
}