Microsoft Information Protection SDK - C++ 1.17
API Reference Documentation for C++
Loading...
Searching...
No Matches
storage_delegate.h
Go to the documentation of this file.
1/*
2 *
3 * Copyright (c) Microsoft Corporation.
4 * All rights reserved.
5 *
6 * This code is licensed under the MIT License.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files(the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions :
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 * THE SOFTWARE.
25 *
26 */
33#ifndef API_MIP_STORAGE_DELEGATE_H_
34#define API_MIP_STORAGE_DELEGATE_H_
35
36#include <string>
37#include <vector>
38
39#include "mip/common_types.h"
41#include "mip/mip_namespace.h"
42#include "mip/storage_table.h"
43
44MIP_NAMESPACE_BEGIN
45
49enum class MipComponent : unsigned int {
50 Policy = 0, /* For Policy sdk */
51 File = 1, /* For File sdk */
52 Protection = 2, /* For Protection sdk */
53};
54
58typedef mip::DelegateResponse<mip::StorageTable> StorageTableResult;
59
64public:
65
79 virtual mip::StorageTableResult CreateStorageTable(
80 const std::string& path,
81 const MipComponent mipComponent,
82 const std::string& tableName,
83 const std::vector<std::string>& allColumns,
84 const std::vector<std::string>& encryptedColumns,
85 const std::vector<std::string>& keyColumns) const = 0;
86
91 public:
100 bool isRemoteStorage,
101 bool isInMemoryStorageSupported,
102 const std::string& onDiskExtension = GetSqliteExtension())
103 : mIsRemoteStorage(isRemoteStorage),
104 mIsInMemoryStorageSupported(isInMemoryStorageSupported),
105 mOnDiskExtension(onDiskExtension) {}
106
112 bool IsRemoteStorage() const { return mIsRemoteStorage; }
113
119 bool IsInMemoryStorageSupported() const { return mIsInMemoryStorageSupported; }
120
128 std::string OnDiskExtension() const { return mOnDiskExtension; }
129
131 ~StorageSettings() { }
133 private:
134 bool mIsRemoteStorage;
135 bool mIsInMemoryStorageSupported;
136 std::string mOnDiskExtension;
138 };
139
145 virtual StorageSettings GetSettings() const = 0;
146
148 virtual ~StorageDelegate() {}
149
150protected:
151 StorageDelegate() {}
153};
154
155MIP_NAMESPACE_END
156#endif // API_MIP_STORAGE_DELEGATE_H_
157
Settings used by StorageDelegate.
Definition storage_delegate.h:90
StorageSettings(bool isRemoteStorage, bool isInMemoryStorageSupported, const std::string &onDiskExtension=GetSqliteExtension())
Interface for configuring the storage settings.
Definition storage_delegate.h:99
bool IsInMemoryStorageSupported() const
Gets whether the delegate supports in-memory storage.
Definition storage_delegate.h:119
std::string OnDiskExtension() const
Gets the extension that the delegate will use when storing a table on disk.
Definition storage_delegate.h:128
bool IsRemoteStorage() const
Gets whether remote storage is used or not.
Definition storage_delegate.h:112
A class that defines the interface to the MIP SDK storage for caching.
Definition storage_delegate.h:63
virtual StorageSettings GetSettings() const =0
Gets settings used by StorageDelegate.
virtual mip::StorageTableResult CreateStorageTable(const std::string &path, const MipComponent mipComponent, const std::string &tableName, const std::vector< std::string > &allColumns, const std::vector< std::string > &encryptedColumns, const std::vector< std::string > &keyColumns) const =0
Creates an instance of a storage table that MIP uses for caching. If a table already exists & schema ...
A file Containing the common types used by the upe, file and protection modules.
const std::string & GetSqliteExtension()
Definition common_types.h:256
A simple framework to create a response to delegate calls that can result in error.
MIP namespace macros.
mip::DelegateResponse< mip::StorageTable > StorageTableResult
A delegate response type for StorageTable.
Definition storage_delegate.h:58
MipComponent
Describes the MIP component to be used in the application.
Definition storage_delegate.h:49
Defines StorageTable interface.