LibreOffice Module store (master) 1
storbios.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
22#include <sal/types.h>
23#include <rtl/ref.hxx>
24#include <osl/mutex.hxx>
25
26#include <store/types.h>
27#include "object.hxx"
28#include "storbase.hxx"
29
30namespace store
31{
32
33class ILockBytes;
34class PageCache;
35struct SuperBlockPage;
36
38{
39public:
41
44 inline operator osl::Mutex& (void) const;
45
52 virtual storeError initialize (
53 ILockBytes * pLockBytes,
54 storeAccessMode eAccessMode,
55 sal_uInt16 & rnPageSize);
56
58 {
59 return m_xAllocator;
60 }
61
63 sal_uInt32 nAddr, void *pData, sal_uInt32 nSize) const;
64
66 sal_uInt32 nAddr, const void *pData, sal_uInt32 nSize) const;
67
68 inline bool isWriteable() const;
69
70 inline bool isValid() const;
71
73 const OStorePageDescriptor& rDescr, storeAccessMode eMode);
74
76
78
79 storeError free (sal_uInt32 nAddr);
80
84 OStorePageObject& rPage, sal_uInt32 nAddr);
85
87 OStorePageObject& rPage, sal_uInt32 nAddr);
88
93
98
99protected:
100 virtual ~OStorePageBIOS() override;
101
102private:
104 osl::Mutex m_aMutex;
105
106 std::unique_ptr<SuperBlockPage> m_pSuper;
107
109
112
113public:
116 struct Ace
117 {
120
121 sal_uInt32 m_addr;
122 sal_uInt32 m_used;
123
124 Ace();
125 ~Ace();
126
127 static int SAL_CALL constructor (void * obj, void * arg);
128
129 static Ace * find (Ace * head, sal_uInt32 addr);
130 static void insert (Ace * head, Ace * entry);
131 };
132
133private:
135
136 class AceCache;
137
139 ILockBytes * pLockBytes,
140 storeAccessMode eAccessMode,
141 sal_uInt16 & rnPageSize);
142 void cleanup_Impl();
143
145 OStorePageObject & rPage, sal_uInt32 nAddr) const;
147 OStorePageObject & rPage, sal_uInt32 nAddr) const;
148
151};
152
153inline OStorePageBIOS::operator osl::Mutex& (void) const
154{
155 return const_cast<osl::Mutex&>(m_aMutex);
156}
157
159{
160 return m_bWriteable;
161}
162
163inline bool OStorePageBIOS::isValid() const
164{
165 return m_xLockBytes.is();
166}
167
168} // namespace store
169
170/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
storeError write(sal_uInt32 nAddr, const void *pData, sal_uInt32 nSize) const
Definition: storbios.cxx:630
bool isValid() const
Definition: storbios.hxx:163
storeError acquirePage(const OStorePageDescriptor &rDescr, storeAccessMode eMode)
Definition: storbios.cxx:646
storeError loadObjectAt_Impl(OStorePageObject &rPage, sal_uInt32 nAddr) const
Definition: storbios.cxx:796
rtl::Reference< PageData::Allocator > & allocator()
Definition: storbios.hxx:57
storeError saveObjectAt(OStorePageObject &rPage, sal_uInt32 nAddr)
Definition: storbios.cxx:822
storeError read(sal_uInt32 nAddr, void *pData, sal_uInt32 nSize) const
Definition: storbios.cxx:616
storeError loadObjectAt(OStorePageObject &rPage, sal_uInt32 nAddr)
Page I/O.
Definition: storbios.cxx:781
rtl::Reference< ILockBytes > m_xLockBytes
Definition: storbios.hxx:103
storeError free(sal_uInt32 nAddr)
Definition: storbios.cxx:760
OStorePageBIOS & operator=(const OStorePageBIOS &)=delete
std::unique_ptr< SuperBlockPage > m_pSuper
Definition: storbios.hxx:106
storeError saveObjectAt_Impl(OStorePageObject &rPage, sal_uInt32 nAddr) const
Definition: storbios.cxx:840
virtual ~OStorePageBIOS() override
Definition: storbios.cxx:479
OStorePageBIOS(const OStorePageBIOS &)=delete
storeError allocate(OStorePageObject &rPage)
Definition: storbios.cxx:715
bool isWriteable() const
Definition: storbios.hxx:158
storeError flush()
flush.
Definition: storbios.cxx:877
storeError close()
close.
Definition: storbios.cxx:862
storeError releasePage(const OStorePageDescriptor &rDescr)
Definition: storbios.cxx:687
storeError initialize_Impl(ILockBytes *pLockBytes, storeAccessMode eAccessMode, sal_uInt16 &rnPageSize)
initialize_Impl.
Definition: storbios.cxx:506
virtual storeError initialize(ILockBytes *pLockBytes, storeAccessMode eAccessMode, sal_uInt16 &rnPageSize)
Initialization.
Definition: storbios.cxx:484
rtl::Reference< PageCache > m_xCache
Definition: storbios.hxx:111
rtl::Reference< PageData::Allocator > m_xAllocator
Definition: storbios.hxx:110
std::mutex m_aMutex
Old OStorePageCache implementation.
Definition: lockbyte.cxx:133
Page Access (control).
Definition: storbios.hxx:117
static Ace * find(Ace *head, sal_uInt32 addr)
Definition: storbios.cxx:369
static void insert(Ace *head, Ace *entry)
Definition: storbios.cxx:381
static int SAL_CALL constructor(void *obj, void *arg)
Definition: storbios.cxx:360
storeAccessMode
Access Mode enumeration.
Definition: types.h:62
storeError
Error Code enumeration.
Definition: types.h:73