aboutsummaryrefslogtreecommitdiff
path: root/tools/aconfig/aconfig_storage_write_api/include/aconfig_storage/aconfig_storage_write_api.hpp
blob: 9e6332ac27292cf69ea4449b0e16b8e42cfc8a5c (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
#pragma once

#include <stdint.h>
#include <string>

#include <android-base/result.h>

using namespace android::base;

namespace aconfig_storage {

/// Mapped flag value file
struct MappedFlagValueFile{
  void* file_ptr;
  size_t file_size;
};

/// DO NOT USE APIS IN THE FOLLOWING NAMESPACE DIRECTLY
namespace private_internal_api {

Result<MappedFlagValueFile> get_mapped_flag_value_file_impl(
    std::string const& pb_file,
    std::string const& container);

} // namespace private_internal_api

/// Get mapped writeable flag value file
Result<MappedFlagValueFile> get_mapped_flag_value_file(
    std::string const& container);

/// Set boolean flag value
Result<void> set_boolean_flag_value(
    const MappedFlagValueFile& file,
    uint32_t offset,
    bool value);

} // namespace aconfig_storage