forked from couchbase/kv_engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
concurrency_semaphores.h
48 lines (43 loc) · 1.87 KB
/
concurrency_semaphores.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
/*
* Copyright 2023-Present Couchbase, Inc.
*
* Use of this software is governed by the Business Source License included
* in the file licenses/BSL-Couchbase.txt. As of the Change Date specified
* in that file, in accordance with the Business Source License, use of this
* software will be governed by the Apache License, Version 2.0, included in
* the file licenses/APL2.txt.
*/
#pragma once
#include <platform/awaitable_semaphore.h>
/**
* A singleton holding the various semaphores used to control the
* concurrency of various components in the core
*/
class ConcurrencySemaphores {
public:
ConcurrencySemaphores(const ConcurrencySemaphores&) = delete;
static ConcurrencySemaphores& instance();
/// authentication should be used to limit the parallellism of
/// authentication requests (SASL START / STEP)
cb::AwaitableSemaphore authentication{6};
/// bucket_management should be used to serialize bucket create/pause/delete
cb::AwaitableSemaphore bucket_management{4};
/// cccp_notification is used to ensure that we only run one task at a
/// time pushing the CCCP notifications
cb::AwaitableSemaphore cccp_notification{1};
/// ifconfig controls that only one interface gets updated at a time
cb::AwaitableSemaphore ifconfig{1};
/// rbac_reload makes sure that only one task is trying to read and
/// update the RBAC database
cb::AwaitableSemaphore rbac_reload{1};
/// sasl_reload makes sure that only one client can force us to read
/// the password database at the same time
cb::AwaitableSemaphore sasl_reload{1};
/// settings makes sure that only one client can run the settings reload
/// at the same time
cb::AwaitableSemaphore settings{1};
/// Compress Cluster Config should be serialized.
cb::AwaitableSemaphore compress_cluster_config{1};
protected:
ConcurrencySemaphores();
};