aboutsummaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/client/lock.h
blob: 7e2c7a127d4e419c5a4bf67188a53266b1c75e16 (plain) (blame)
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
#pragma once

#include "client.h"

#include <yt/cpp/mapreduce/interface/client.h>

namespace NYT {
namespace NDetail {

////////////////////////////////////////////////////////////////////////////////

class TLock
    : public ILock
{
public:
    TLock(const TLockId& lockId, TClientPtr client, bool waitable);

    virtual const TLockId& GetId() const override;
    virtual TNodeId GetLockedNodeId() const override;
    virtual const ::NThreading::TFuture<void>& GetAcquiredFuture() const override;

private:
    const TLockId LockId_;
    mutable TMaybe<::NThreading::TFuture<void>> Acquired_;
    TClientPtr Client_;
};

////////////////////////////////////////////////////////////////////////////////

} // namespace NDetail
} // namespace NYT