• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

realm / realm-core / nicola.cabiddu_1040

26 Sep 2023 05:08PM UTC coverage: 91.056% (-1.9%) from 92.915%
nicola.cabiddu_1040

Pull #6766

Evergreen

nicola-cab
several fixes and final client reset algo for collection in mixed
Pull Request #6766: Client Reset for collections in mixed / nested collections

97128 of 178458 branches covered (0.0%)

1524 of 1603 new or added lines in 5 files covered. (95.07%)

4511 existing lines in 109 files now uncovered.

236619 of 259862 relevant lines covered (91.06%)

7169640.31 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.67
/src/realm/impl/transact_log.cpp
1
/*************************************************************************
2
 *
3
 * Copyright 2016 Realm Inc.
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at
8
 *
9
 * http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 *
17
 **************************************************************************/
18

19
#include <realm/impl/transact_log.hpp>
20
#include <realm/util/overload.hpp>
21

22
namespace realm::_impl {
23

24

25
bool TransactLogEncoder::select_table(TableKey key)
26
{
1,393,953✔
27
    size_t levels = 0;
1,393,953✔
28
    append_simple_instr(instr_SelectTable, levels, key.value); // Throws
1,393,953✔
29
    return true;
1,393,953✔
30
}
1,393,953✔
31

32
bool TransactLogEncoder::select_collection(ColKey col_key, ObjKey key, const StablePath& path)
33
{
269,862✔
34
    auto path_size = path.size();
269,862✔
35
    if (path_size > 1) {
269,862✔
36
        append_simple_instr(instr_SelectCollectionByPath, col_key, key.value);
1,464✔
37
        append_simple_instr(path_size - 1);
1,464✔
38

732✔
39
        for (size_t n = 1; n < path_size; n++) {
2,970✔
40
            append_simple_instr(path[n].get_salt());
1,506✔
41
        }
1,506✔
42
    }
1,464✔
43
    else {
268,398✔
44
        append_simple_instr(instr_SelectCollection, col_key, key.value); // Throws
268,398✔
45
    }
268,398✔
46
    return true;
269,862✔
47
}
269,862✔
48

49
void TransactLogEncoder::encode_string(StringData string)
UNCOV
50
{
×
UNCOV
51
    size_t max_required_bytes = max_enc_bytes_per_int + string.size();
×
UNCOV
52
    char* ptr = reserve(max_required_bytes); // Throws
×
UNCOV
53
    ptr = encode(ptr, size_t(string.size()));
×
UNCOV
54
    ptr = std::copy(string.data(), string.data() + string.size(), ptr);
×
UNCOV
55
    advance(ptr);
×
UNCOV
56
}
×
57

58
REALM_NORETURN
59
void TransactLogParser::parser_error() const
UNCOV
60
{
×
UNCOV
61
    throw Exception(ErrorCodes::BadChangeset, "Bad transaction log");
×
UNCOV
62
}
×
63

64
} // namespace realm::_impl
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc