-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathdevice_handler.h
59 lines (43 loc) · 1.6 KB
/
device_handler.h
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
#pragma once
#include "public.h"
#include "request.h"
#include <cloud/storage/core/libs/common/guarded_sglist.h>
namespace NCloud::NBlockStore {
////////////////////////////////////////////////////////////////////////////////
struct IDeviceHandler
{
virtual ~IDeviceHandler() = default;
virtual NThreading::TFuture<NProto::TReadBlocksLocalResponse> Read(
TCallContextPtr callContext,
ui64 from,
ui64 length,
TGuardedSgList sgList,
const TString& checkpointId) = 0;
virtual NThreading::TFuture<NProto::TWriteBlocksLocalResponse> Write(
TCallContextPtr callContext,
ui64 from,
ui64 length,
TGuardedSgList sgList) = 0;
virtual NThreading::TFuture<NProto::TZeroBlocksResponse> Zero(
TCallContextPtr callContext,
ui64 from,
ui64 length) = 0;
virtual TStorageBuffer AllocateBuffer(size_t bytesCount) = 0;
};
////////////////////////////////////////////////////////////////////////////////
struct IDeviceHandlerFactory
{
virtual ~IDeviceHandlerFactory() = default;
virtual IDeviceHandlerPtr CreateDeviceHandler(
IStoragePtr storage,
TString diskId,
TString clientId,
ui32 blockSize,
bool unalignedRequestsDisabled,
bool checkBufferModificationDuringWriting,
bool isReliableMediaKind) = 0;
};
////////////////////////////////////////////////////////////////////////////////
IDeviceHandlerFactoryPtr CreateDefaultDeviceHandlerFactory();
IDeviceHandlerFactoryPtr CreateDeviceHandlerFactory(ui32 maxSubRequestSize);
} // namespace NCloud::NBlockStore